Category: SystemVerilog Datatypes

  • Variable-size arrays- Dynamic arrays and queues in SystemVerilog

    Variable-sized arrays have dynamic sizes that are set, extended, or shrunk during run time. They are not synthesizable and are used for verification. Dynamic array: Dynamic arrays are declared with variable names followed by []. No memory is allocated when declared. Memory is allocated only when it is instantiated with new[size], where size is a…

  • Arrays in SystemVerilog- Fixed-size arrays, packed and unpacked arrays

    Arrays in SystemVerilog are data structures to store a collection of elements of the same datatype. They can be single or multi-dimensional. In fixed-size arrays, dimensions are declared before compilation. Square brackets are used to represent dimensions. They can be packed or unpacked- packed dimensions are mentioned before a variable name and take contiguous memory…

  • Strings in SystemVerilog

    string is a dynamic datatype to store strings. They resize dynamically based on the length of the string. %s format specifier is used for strings. They are not synthesizeable and are used in simulation. Strings have multiple built-in functions. A few of those are given in the below example. Log message: Original dog_name: PorkChopThird character…

  • Enum datatype in SystemVerilog

    An enumeration (enum) is a custom-defined data type that restricts a variable to a predefined set of named values. Enums are designed to make code more intuitive by using descriptive names for these values. For example, an enum can be used to represent one of the states in a finite state machine, one of the…

  • Integer and real datatypes in SystemVerilog

    reg, wire, and logic: Signal modeling in Verilog uses two main datatypes, wire and reg. wire is used for connections between components such as gates or modules and is continuously driven in continuous assignment statements. Keyword assign is used in continuous assignment statements. reg is generally used for register modeling and their values are driven…