[][src]Module moore_svlog::ty

A generalized SystemVerilog type system.

This module covers all types that may arise in a SystemVerilog source file, plus some additional things like modules/interfaces to streamline the handling of hierarchical names and interface signals/modports throughout the compiler.

Packed Types

Packed types are the core types of SystemVerilog. They combine a core packed type with an optional sign and zero or more packed dimensions. The core packed types are:

  • Integer vector types: bit, logic, reg
  • Integer atom types: byte, shortint, int, longint, integer, time
  • Packed structs and unions
  • Enums
  • Packed named types
  • Packed type references

The packed dimensions can be:

  • Unsized ([])
  • Ranges ([x:y])

Packed types are implemented by the PackedType struct.

Unpacked Types

Unpacked types are a second level of types in SystemVerilog. They extend a core unpacked type with a variety of unpacked dimensions, depending on which syntactic construct generated the type (variable or otherwise). The core unpacked types are:

  • Packed types
  • Non-integer types: shortreal, real, realtime
  • Unpacked structs and unions
  • string, chandle, event
  • Virtual interfaces
  • Class types
  • Covergroups
  • Unpacked named types
  • Unpacked type references
  • Modules and interfaces

The unpacked dimensions are:

  • Unsized ([])
  • Arrays ([x])
  • Ranges ([x:y])
  • Associative ([T] or [*])
  • Queues ([$] or [$:x])

Unpacked types are implemented by the UnpackedType struct.

Simple Bit Vector Types

Some packed types may be converted into an equivalent Simple Bit Vector Type (SBVT), which has an identical bit pattern as the original type, but consists only of an integer vector type with a single optional packed dimension. An SBVT can be converted back into a packed type. SBVTs can be range-cast, which changes the width of their single dimension.

SBVTs track whether the original packed type explicitly had a dimension or used an integer atom type, or was named. When converting back to a packed type, the SBVT attempts to restore this information, depending on how many changes were applied.

Sign

All packed types have an associated sign, indicating whether they are signed or unsigned. The types have a default sign, which means that the sign may have been omitted in the source file. Packed types can be sign-cast, which changes only their sign.

Domain

All packed types consist of bits that can either carry two or four values. An aggregate type is two-valued iff all its constituent types are two-valued, otherwise it is four-valued. Packed types can be domain-cast, which changes only their value domain.

Structs

EnumType

An enum type.

InterfaceType

An interface instance.

ModuleType

A module instance.

PackedType

A packed type.

Range

The [a:b] part in a vector/array type such as logic [a:b].

SbvType

A simple bit vector type.

StructMember

A member of a struct type.

StructType

A struct type.

TypeStorage

An arena that can internalize type data.

UnpackedType

An unpacked type.

Enums

Dim

A packed or unpacked dimension.

Domain

The number of values each bit of a type can assume.

IntAtomType

An integer atom type.

IntVecType

An integer vector type.

PackedCore

A core packed type.

PackedDim

A packed dimension.

RangeDir

Which side is greater in a range [a:b].

RealType

A real type.

Sign

Whether a type is signed or unsigned.

UnpackedCore

A core unpacked type.

UnpackedDim

An unpacked dimension.

Traits

HasTypeStorage

An object that has type storage.

TypeContext

A container for type operations.