Systemverilog Reference

Total Page:16

File Type:pdf, Size:1020Kb

Systemverilog Reference SystemVerilog Reference Product Version 9.2 July 2010 © 1995-2010 Cadence Design Systems, Inc. All rights reserved worldwide. Printed in the United States of America. Cadence Design Systems, Inc., 555 River Oaks Parkway, San Jose, CA 95134, USA Trademarks: Trademarks and service marks of Cadence Design Systems, Inc. (Cadence) contained in this document are attributed to Cadence with the appropriate symbol. For queries regarding Cadence’s trademarks, contact the corporate legal department at the address shown above or call 800.862.4522. Open SystemC, Open SystemC Initiative, OSCI, SystemC, and SystemC Initiative are trademarks or registered trademarks of Open SystemC Initiative, Inc. in the United States and other countries and are used with permission. All other trademarks are the property of their respective holders. Restricted Print Permission: This publication is protected by copyright and any unauthorized use of this publication may violate copyright, trademark, and other laws. Except as specified in this permission statement, this publication may not be copied, reproduced, modified, published, uploaded, posted, transmitted, or distributed in any way, without prior written permission from Cadence. This statement grants you permission to print one (1) hard copy of this publication subject to the following conditions: 1. The publication may be used solely for personal, informational, and noncommercial purposes; 2. The publication may not be modified in any way; 3. Any copy of the publication or portion thereof must include all original copyright, trademark, and other proprietary notices and this permission statement; and 4. Cadence reserves the right to revoke this authorization at any time, and any such use shall be discontinued immediately upon written notice from Cadence. Disclaimer: Information in this publication is subject to change without notice and does not represent a commitment on the part of Cadence. The information contained herein is the proprietary and confidential information of Cadence or its licensors, and is supplied subject to, and may be used only by Cadence’s customer in accordance with, a written agreement between Cadence and its customer. Except as may be explicitly set forth in such agreement, Cadence does not make, and expressly disclaims, any representations or warranties as to the completeness, accuracy or usefulness of the information contained in this document. Cadence does not warrant that use of such information will not infringe any third party rights, nor does Cadence assume any liability for damages or costs of any kind that may result from use of such information. Patents: Cadence products described in this document are protected by U.S. Patents 5,095,454, 5,418,931, 5,606,698, 6,487,704, 7,039,887, 7,055,116, 5,838,949, 6,263,301, 6,163,763, 6,301,578 Restricted Rights: Use, duplication, or disclosure by the Government is subject to restrictions as set forth in FAR52.227-14 and DFAR252.227-7013 et seq. or its successor. Licensed Copyrights: This software includes, in binary form, a software package called CUDD V.2.4.1 1995–2004, Regents of the University of Colorado. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of the University of Colorado nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. SystemVerilog Reference Contents 1 Overview of SystemVerilog . 15 Availability of Constructs within Simulators . 15 SystemVerilog in Simulation . 15 SystemVerilog VPI Extensions . 15 SystemVerilog Assertions . 16 SystemVerilog Coverage . 16 SystemVerilog with AMS . 16 SystemVerilog Examples . 16 Language Support . 17 Getting Help . 17 About Online Help . 17 Getting Help on Commands to Run Tools . 19 Getting Help on Tool Messages . 19 Other Documentation . 20 Customer Support . 20 2 Compiling SystemVerilog Constructs . 23 Using ncvlog . 23 Using the irun Utility . 23 SystemVerilog and the PLI tf_nodeinfo() Interface . 24 3 List of Supported Constructs . 25 4 Convenience Enhancements. 31 Literal Value Assignments . 31 July 2010 3 Product Version 9.2 SystemVerilog Reference Matching End Names . 31 Time Unit and Time Precision . 33 .name Implicit Port Connection . 34 Dot Star (.*) Implicit Port Connection . 35 5 Data Types. 37 Data Types Overview . 37 Overview of Verilog Data Types . 38 Primitive Data Types . 38 User-Defined Data Types . 39 logic Data Type . 40 bit Data Type . 41 byte, shortint, int, and longint Data Types . 42 Chandle Data Type . 43 Strings . 43 String Operators . 44 String Methods . 45 Strings and System Tasks . 48 Using Strings with Classes . 48 Using Strings with Packages . 49 Using Strings within begin...end Blocks . 50 Declaring a Fixed Array of Strings . 50 Declaring Arrays and Queues of Strings . 51 Using Elements of a Dynamic Array of Strings . 52 Using Strings as Parameters and localparams . 53 Using Out-of-Module References to Strings . 54 Limitations on Strings . 55 typedef Declaration . 56 Limitations on Typedefs . 56 Creating a New Data Type Definition . 57 Handling Data Type Visibility . 59 enum Data Type . 60 Limitations on Enumerations . 61 Declaring an Enumeration . 62 July 2010 4 Product Version 9.2 SystemVerilog Reference Specifying Enumeration Constants . 63 Treating Enumeration Objects as Bit Vectors . 64 Enumeration Type Checking . 65 Enumeration Type Methods . ..
Recommended publications
  • Programming for Engineers Pointers in C Programming: Part 02
    Programming For Engineers Pointers in C Programming: Part 02 by Wan Azhar Wan Yusoff1, Ahmad Fakhri Ab. Nasir2 Faculty of Manufacturing Engineering [email protected], [email protected] PFE – Pointers in C Programming: Part 02 by Wan Azhar Wan Yusoff and Ahmad Fakhri Ab. Nasir 0.0 Chapter’s Information • Expected Outcomes – To further use pointers in C programming • Contents 1.0 Pointer and Array 2.0 Pointer and String 3.0 Pointer and dynamic memory allocation PFE – Pointers in C Programming: Part 02 by Wan Azhar Wan Yusoff and Ahmad Fakhri Ab. Nasir 1.0 Pointer and Array • We will review array data type first and later we will relate array with pointer. • Previously, we learn about basic data types such as integer, character and floating numbers. In C programming language, if we have 5 test scores and would like to average the scores, we may code in the following way. PFE – Pointers in C Programming: Part 02 by Wan Azhar Wan Yusoff and Ahmad Fakhri Ab. Nasir 1.0 Pointer and Array PFE – Pointers in C Programming: Part 02 by Wan Azhar Wan Yusoff and Ahmad Fakhri Ab. Nasir 1.0 Pointer and Array • This program is manageable if the scores are only 5. What should we do if we have 100,000 scores? In such case, we need an efficient way to represent a collection of similar data type1. In C programming, we usually use array. • Array is a fixed-size sequence of elements of the same data type.1 • In C programming, we declare an array like the following statement: PFE – Pointers in C Programming: Part 02 by Wan Azhar Wan Yusoff and Ahmad Fakhri Ab.
    [Show full text]
  • C Programming: Data Structures and Algorithms
    C Programming: Data Structures and Algorithms An introduction to elementary programming concepts in C Jack Straub, Instructor Version 2.07 DRAFT C Programming: Data Structures and Algorithms, Version 2.07 DRAFT C Programming: Data Structures and Algorithms Version 2.07 DRAFT Copyright © 1996 through 2006 by Jack Straub ii 08/12/08 C Programming: Data Structures and Algorithms, Version 2.07 DRAFT Table of Contents COURSE OVERVIEW ........................................................................................ IX 1. BASICS.................................................................................................... 13 1.1 Objectives ...................................................................................................................................... 13 1.2 Typedef .......................................................................................................................................... 13 1.2.1 Typedef and Portability ............................................................................................................. 13 1.2.2 Typedef and Structures .............................................................................................................. 14 1.2.3 Typedef and Functions .............................................................................................................. 14 1.3 Pointers and Arrays ..................................................................................................................... 16 1.4 Dynamic Memory Allocation .....................................................................................................
    [Show full text]
  • Data Structure
    EDUSAT LEARNING RESOURCE MATERIAL ON DATA STRUCTURE (For 3rd Semester CSE & IT) Contributors : 1. Er. Subhanga Kishore Das, Sr. Lect CSE 2. Mrs. Pranati Pattanaik, Lect CSE 3. Mrs. Swetalina Das, Lect CA 4. Mrs Manisha Rath, Lect CA 5. Er. Dillip Kumar Mishra, Lect 6. Ms. Supriti Mohapatra, Lect 7. Ms Soma Paikaray, Lect Copy Right DTE&T,Odisha Page 1 Data Structure (Syllabus) Semester & Branch: 3rd sem CSE/IT Teachers Assessment : 10 Marks Theory: 4 Periods per Week Class Test : 20 Marks Total Periods: 60 Periods per Semester End Semester Exam : 70 Marks Examination: 3 Hours TOTAL MARKS : 100 Marks Objective : The effectiveness of implementation of any application in computer mainly depends on the that how effectively its information can be stored in the computer. For this purpose various -structures are used. This paper will expose the students to various fundamentals structures arrays, stacks, queues, trees etc. It will also expose the students to some fundamental, I/0 manipulation techniques like sorting, searching etc 1.0 INTRODUCTION: 04 1.1 Explain Data, Information, data types 1.2 Define data structure & Explain different operations 1.3 Explain Abstract data types 1.4 Discuss Algorithm & its complexity 1.5 Explain Time, space tradeoff 2.0 STRING PROCESSING 03 2.1 Explain Basic Terminology, Storing Strings 2.2 State Character Data Type, 2.3 Discuss String Operations 3.0 ARRAYS 07 3.1 Give Introduction about array, 3.2 Discuss Linear arrays, representation of linear array In memory 3.3 Explain traversing linear arrays, inserting & deleting elements 3.4 Discuss multidimensional arrays, representation of two dimensional arrays in memory (row major order & column major order), and pointers 3.5 Explain sparse matrices.
    [Show full text]
  • Lecture 2: Variables and Primitive Data Types
    Lecture 2: Variables and Primitive Data Types MIT-AITI Kenya 2005 1 In this lecture, you will learn… • What a variable is – Types of variables – Naming of variables – Variable assignment • What a primitive data type is • Other data types (ex. String) MIT-Africa Internet Technology Initiative 2 ©2005 What is a Variable? • In basic algebra, variables are symbols that can represent values in formulas. • For example the variable x in the formula f(x)=x2+2 can represent any number value. • Similarly, variables in computer program are symbols for arbitrary data. MIT-Africa Internet Technology Initiative 3 ©2005 A Variable Analogy • Think of variables as an empty box that you can put values in. • We can label the box with a name like “Box X” and re-use it many times. • Can perform tasks on the box without caring about what’s inside: – “Move Box X to Shelf A” – “Put item Z in box” – “Open Box X” – “Remove contents from Box X” MIT-Africa Internet Technology Initiative 4 ©2005 Variables Types in Java • Variables in Java have a type. • The type defines what kinds of values a variable is allowed to store. • Think of a variable’s type as the size or shape of the empty box. • The variable x in f(x)=x2+2 is implicitly a number. • If x is a symbol representing the word “Fish”, the formula doesn’t make sense. MIT-Africa Internet Technology Initiative 5 ©2005 Java Types • Integer Types: – int: Most numbers you’ll deal with. – long: Big integers; science, finance, computing. – short: Small integers.
    [Show full text]
  • Source Code Auditing: Day 2
    Source Code Auditing: Day 2 Penetration Testing & Vulnerability Analysis Brandon Edwards [email protected] Data Types Continued Data Type Signedness Remember, by default all data types are signed unless specifically declared otherwise But many functions which accept size arguments take unsigned values What is the difference of the types below? char y; unsigned char x; x = 255; y = -1; 3 Data Type Signedness These types are the same size (8-bits) char y; unsigned char x; 4 Data Type Signedness A large value in the unsigned type (highest bit set) is a negative value in the signed type char y; unsigned char x; 5 Data Type Bugs Same concept applies to 16 and 32 bit data types What are the implications of mixing signed & unsigned types ? #define MAXSOCKBUF 4096 int readNetworkData(int sock) { char buf[MAXSOCKBUF]; int length; read(sock, (char *)&length, 4); if (length < MAXSOCKBUF) { read(sock, buf, length); } } 6 Data Type Signedness The check is between two signed values… #define MAXSOCKBUF 4096 if (length < MAXSOCKBUF) So if length is negative (highest bit / signed bit set), it will evaluate as less than MAXSOCKBUF But the read() function takes only unsigned values for it’s size Remember, the highest bit (or signed bit is set), and the compiler implicitly converts the length to unsigned for read() 7 Data Type Signedness So what if length is -1 (or 0xFFFFFFFF in hex)? #define MAXSOCKBUF 4096 if (length < MAXSOCKBUF) { read(sock, buf, length); } When the length check is performed, it is asking if -1 is less than 4096 When the length is passed to read, it is converted to unsigned and becomes the unsigned equivalent of -1, which for 32bits is 4294967295 8 Data Type Bugs Variation in data type sizes can also introduce bugs Remember the primitive data type sizes? (x86): An integer type is 32bits A short type is 16bits A char type is 8 bits Sometimes code is written without considering differences between these.
    [Show full text]
  • Programming the Capabilities of the PC Have Changed Greatly Since the Introduction of Electronic Computers
    1 www.onlineeducation.bharatsevaksamaj.net www.bssskillmission.in INTRODUCTION TO PROGRAMMING LANGUAGE Topic Objective: At the end of this topic the student will be able to understand: History of Computer Programming C++ Definition/Overview: Overview: A personal computer (PC) is any general-purpose computer whose original sales price, size, and capabilities make it useful for individuals, and which is intended to be operated directly by an end user, with no intervening computer operator. Today a PC may be a desktop computer, a laptop computer or a tablet computer. The most common operating systems are Microsoft Windows, Mac OS X and Linux, while the most common microprocessors are x86-compatible CPUs, ARM architecture CPUs and PowerPC CPUs. Software applications for personal computers include word processing, spreadsheets, databases, games, and myriad of personal productivity and special-purpose software. Modern personal computers often have high-speed or dial-up connections to the Internet, allowing access to the World Wide Web and a wide range of other resources. Key Points: 1. History of ComputeWWW.BSSVE.INr Programming The capabilities of the PC have changed greatly since the introduction of electronic computers. By the early 1970s, people in academic or research institutions had the opportunity for single-person use of a computer system in interactive mode for extended durations, although these systems would still have been too expensive to be owned by a single person. The introduction of the microprocessor, a single chip with all the circuitry that formerly occupied large cabinets, led to the proliferation of personal computers after about 1975. Early personal computers - generally called microcomputers - were sold often in Electronic kit form and in limited volumes, and were of interest mostly to hobbyists and technicians.
    [Show full text]
  • UML Profile for Communicating Systems a New UML Profile for the Specification and Description of Internet Communication and Signaling Protocols
    UML Profile for Communicating Systems A New UML Profile for the Specification and Description of Internet Communication and Signaling Protocols Dissertation zur Erlangung des Doktorgrades der Mathematisch-Naturwissenschaftlichen Fakultäten der Georg-August-Universität zu Göttingen vorgelegt von Constantin Werner aus Salzgitter-Bad Göttingen 2006 D7 Referent: Prof. Dr. Dieter Hogrefe Korreferent: Prof. Dr. Jens Grabowski Tag der mündlichen Prüfung: 30.10.2006 ii Abstract This thesis presents a new Unified Modeling Language 2 (UML) profile for communicating systems. It is developed for the unambiguous, executable specification and description of communication and signaling protocols for the Internet. This profile allows to analyze, simulate and validate a communication protocol specification in the UML before its implementation. This profile is driven by the experience and intelligibility of the Specification and Description Language (SDL) for telecommunication protocol engineering. However, as shown in this thesis, SDL is not optimally suited for specifying communication protocols for the Internet due to their diverse nature. Therefore, this profile features new high-level language concepts rendering the specification and description of Internet protocols more intuitively while abstracting from concrete implementation issues. Due to its support of several concrete notations, this profile is designed to work with a number of UML compliant modeling tools. In contrast to other proposals, this profile binds the informal UML semantics with many semantic variation points by defining formal constraints for the profile definition and providing a mapping specification to SDL by the Object Constraint Language. In addition, the profile incorporates extension points to enable mappings to many formal description languages including SDL. To demonstrate the usability of the profile, a case study of a concrete Internet signaling protocol is presented.
    [Show full text]
  • UNIT–IV: Pointers
    Q&A for Previous Year Questions Subject: CPDS (B.Tech. I Year) Subject Code: GR11A1003 UNIT-IV ------------------------------------------------------------------------------------------------------------------------------------------ UNIT–IV: Pointers: Pointers and Addresses, Pointers and function Arguments, Pointers and arrays, Address Arithmetic, Character pointers and Functions, Pointer Arrays, Pointers to Structures, Pointers to Pointers, Command Line Arguments. Files: Introduction, Types of Files, File Access Functions, I/O on Files, Random Access to Files, Error Handling. UNIT-IV 1) What is pointer in c programming? What are its benefits? Pointer is a user defined data type that creates special types of variables which can hold the address of primitive data type like char, int, float, double or user defined data type like function, pointer etc. or derived data type like array, structure, union, enum. Examples: int *ptr; int (*ptr)(); int (*ptr)[2]; Benefits of using pointers are:- 1) Pointers are more efficient in handling arrays and data tables. 2) Pointers can be used to return multiple values from a function via function arguments. 3) The use of pointer arrays to character strings results in saving of data storage space in memory. 4) Pointers allow C to support dynamic memory management. 5) Pointers provide an efficient tool for manipulating dynamic data structures such as structures , linked lists , queues , stacks and trees. 6) Pointers reduce length and complexity of programs. 7) They increase the execution speed and thus reduce the program execution time. 2) Explain the concept of pointers? In C programming every variable keeps two type of values. 1. Value of variable. 2. Address of variable where it has stored in the memory.
    [Show full text]
  • Preprocessing C++ : Meta-Class Aspects
    Preprocessing C++ : Meta-Class Aspects Edward D. Willink Racal Research Limited, Worton Drive, Reading, England +44 118 923 8278 [email protected] Vyacheslav B. Muchnick Department of Computing, University of Surrey, Guildford, England +44 1483 300800 x2206 [email protected] ABSTRACT C++ satisfies the previously conflicting goals of Object-Orientation and run-time efficiency within an industrial strength language. Run-time efficiency is achieved by ignoring the meta-level aspects of Object-Orientation. In a companion paper [15] we show how extensions that replace the traditional preprocessor lexical substitution by an Object-Oriented meta-level substitution fit naturally into C++. In this paper, we place those extensions in the context of a compile-time meta-level, in which application meta-programs can execute to browse, check or create program declarations. An extended example identifies the marshalling aspect as a programming concern that can be fully separated and automatically generated by an application meta-program. Keywords Object-Oriented Language; Preprocessor; C++; Meta-Level; Composition; Weaving; Aspect-Oriented Programming; Pattern Implementation 1 INTRODUCTION Prior to C++, Object Orientation, as exemplified by Smalltalk, was perceived to be inherently inefficient because of the run-time costs associated with message dispatch. C++ introduced a more restrictive Object Model that enabled most of the run-time costs to be resolved by compile-time computation. As a result Object Orientation in C++ is efficient and widely used. C++ requires that the layout of objects be frozen at compile-time, and that the type of the recipient of any message is known. The layout constraint enables a single contiguous memory allocation for each object.
    [Show full text]
  • Lecture Notes)
    Sri Vidya College of Engineering & Technology Course Material ( Lecture Notes) Data structures can be classified as · Simple data structure · Compound data structure · Linear data structure · Non linear data structure Simple Data Structure: Simple data structure can be constructed with the help of primitive data structure. A primitive data structure used to represent the standard data types of any one of the computer languages. Variables, arrays, pointers, structures, unions, etc. are examples of primitive data structures. Compound Data structure: Compound data structure can be constructed with the help of any one of the primitive data structure and it is having a specific functionality. It can be designed by user. It can be classified as 1) Linear data structure 2) Non-linear data structure Linear data structure : Collection of nodes which are logically adjacent in which logical adjacency is maintained by pointers (or) Linear data structures can be constructed as a continuous arrangement of data elements in the memory. It can be constructed by using array data type. In the linear Data Structures the relation ship of adjacency is maintained between the Data elements. Operations applied on linear data structure : The following list of operations applied on linear data structures 1. Add an element 2. Delete an element 3. Traverse 4. Sort the list of elements CS8391 – Data Structures - Unit I Page 1 Sri Vidya College of Engineering & Technology Course Material ( Lecture Notes) 5. Search for a data element By applying one or more functionalities to create different types of data structures For example Stack, Queue, Tables, List, and Linked Lists. Non-linear data structure: Non-linear data structure can be constructed as a collection of randomly distributed set of data item joined together by using a special pointer (tag).
    [Show full text]
  • Array Data Structure
    © 2014 IJIRT | Volume 1 Issue 6 | ISSN : 2349-6002 ARRAY DATA STRUCTURE Isha Batra, Divya Raheja Information Technology Dronacharya College Of Engineering, Farukhnagar,Gurgaon Abstract- In computer science, an array data structure valid index tuples and the addresses of the elements or simply an array is a data structure consisting of a (and hence the element addressing formula) are collection of elements (values or variables), each usually but not always fixed while the array is in use. identified by at least one array index or key. An array is The term array is often used to mean array data type, stored so that the position of each element can be a kind of data type provided by most high-level computed from its index tuple by a mathematical formula. The simplest type of data structure is a linear programming languages that consists of a collection array, also called one-dimensional array. For example, of values or variables that can be selected by one or an array of 10 32-bit integer variables, with indices 0 more indices computed at run-time. Array types are through 9, may be stored as 10 words at memory often implemented by array structures; however, in addresses 2000, 2004, 2008, … 2036, so that the element some languages they may be implemented by hash with index i has the address 2000 + 4 × i. The term array tables, linked lists, search trees, or other data is often used to mean array data type, a kind of data structures. The term is also used, especially in the type provided by most high-level programming description of algorithms, to mean associative array languages that consists of a collection of values or or "abstract array", a theoretical computer science variables that can be selected by one or more indices computed at run-time.
    [Show full text]
  • Reference Metamodel for the EXPRESS Information Modeling Language Specification
    Reference Metamodel for the EXPRESS Information Modeling Language Specification Version 1.0 - October 2010 OMG Document Number: formal/2010-10-01 Standard document URL: http://www.omg.org/spec/EXPRESS/1.0 Associated Files*: http://www.omg.org/spec/EXPRESS/20091201 * Original files: dtc/09-12-09 (cmof.xmi) Copyright © 2008, JBIC (Japan Biological Informatics Consortium) Copyright © 2010, Object Management Group, Inc. USE OF SPECIFICATION - TERMS, CONDITIONS & NOTICES The material in this document details an Object Management Group specification in accordance with the terms, conditions and notices set forth below. This document does not represent a commitment to implement any portion of this specification in any company’s products. The information contained in this document is subject to change without notice. LICENSES The companies listed above have granted to the Object Management Group, Inc. (OMG) a nonexclusive, royalty-free, paid up, worldwide license to copy and distribute this document and to modify this document and distribute copies of the modified version. Each of the copyright holders listed above has agreed that no person shall be deemed to have infringed the copyright in the included material of any such copyright holder by reason of having used the specification set forth herein or having conformed any computer software to the specification. Subject to all of the terms and conditions below, the owners of the copyright in this specification hereby grant you a fully-paid up, non-exclusive, nontransferable, perpetual, worldwide
    [Show full text]