Systemverilog Reference
Total Page:16
File Type:pdf, Size:1020Kb
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 . ..