• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vwsim
      • Vl
        • Syntax
          • Vl-module
          • Vl-vardecl
          • Vl-fundecl
          • Vl-interface
          • Vl-design
          • Vl-assign
          • Vl-modinst
          • Vl-gateinst
          • Vl-taskdecl
          • Vl-portdecl
          • Vl-commentmap
          • Vl-dpiimport
          • Vl-ansi-portdecl
          • Vl-package
          • Vl-paramdecl
          • Vl-dpiexport
          • Vl-class
          • Vl-sort-blockitems-aux
          • Vl-plainarglist->exprs
          • Vl-taskdecllist->names
          • Expressions-and-datatypes
            • Vl-atts
            • Vl-expr
            • Vl-datatype
              • Vl-datatype-p
              • Vl-usertype
              • Vl-struct
                • Vl-structmember
                • Make-vl-struct
                • Vl-struct->udims
                • Vl-struct->signedp
                • Vl-struct->packedp
                • Vl-struct->members
                • Vl-struct->pdims
                • Change-vl-struct
              • Vl-coredatatype-info
              • Vl-union
              • Vl-datatype->udims
              • Vl-datatype-update-dims
              • Vl-coretype
              • Vl-enum
              • Vl-datatype->pdims
              • Vl-maybe-datatype
              • Vl-datatype-case
              • Vl-datatype-update-udims
              • Vl-datatype-update-pdims
              • Vl-datatype-equiv
              • Vl-datatype-kind
              • Vl-coretypename->info
              • *vl-core-data-type-table*
              • *vl-plain-old-logic-type*
              • Vl-datatype-fix
              • Vl-datatype-count
              • *vl-plain-old-time-type*
              • *vl-plain-old-reg-type*
              • *vl-plain-old-realtime-type*
              • *vl-plain-old-real-type*
              • *vl-plain-old-integer-type*
            • New-expression-representation
            • Vl-paramargs
            • Vl-evatom
            • Vl-maybe-paramargs
            • Vl-evatomlist
            • Vl-call-namedargs
            • Vl-paramvaluelist
            • Vl-namedparamvaluelist
          • Vl-fundecllist->names
          • Vl-udp
          • Vl-port
          • Vl-genelement
          • Vl-clkdecl
          • Vl-parse-temps
          • Vl-bind
          • Vl-namedarg
          • Vl-exprdist
          • Vl-clkassign
          • Vl-range
          • Vl-propport
          • Vl-typedef
          • Vl-gatedelay
          • Vl-dimension
          • Vl-sequence
          • Vl-clkskew
          • Vl-program
          • Vl-gatestrength
          • Vl-property
          • Vl-config
          • Vl-always
          • Vl-import
          • Vl-repeateventcontrol
          • Vl-timeliteral
          • Vl-initial
          • Vl-eventcontrol
          • Vl-final
          • Vl-udpsymbol-p
          • Vl-maybe-clkskew
          • Vl-function-specialization
          • Vl-alias
          • Vl-maybe-nettypename
          • Vl-maybe-gatedelay
          • Vl-letdecl
          • Vl-direction-p
          • Vl-modelement
          • Vl-maybe-timeprecisiondecl
          • Vl-maybe-scopeid
          • Vl-maybe-gatestrength
          • Vl-maybe-direction
          • Vl-maybe-delayoreventcontrol
          • Vl-gclkdecl
          • Vl-fwdtypedef
          • Vl-maybe-udpsymbol-p
          • Vl-maybe-timeunitdecl
          • Vl-maybe-timeliteral
          • Vl-maybe-parse-temps
          • Vl-maybe-cstrength
          • Vl-arguments
          • Vl-maybe-module
          • Vl-maybe-design
          • Vl-covergroup
          • Vl-udpline
          • Vl-timeunitdecl
          • Vl-genvar
          • Vl-defaultdisable
          • Vl-context1
          • Vl-timeprecisiondecl
          • Vl-sort-blockitems
          • Vl-elabtask
          • Vl-udpedge
          • Vl-delaycontrol
          • Vl-context
          • Vl-ctxelement
          • Vl-ctxelement->loc
          • Vl-modelement->loc
          • Statements
          • Vl-blockitem
          • Vl-vardecllist
          • Vl-interface->ifports
          • Vl-syntaxversion
          • Vl-nettypename-p
          • Vl-module->ifports
          • Vl-lifetime-p
          • Vl-paramdecllist
          • Vl-modelementlist->genelements
          • Vl-importlist
          • Vl-typedeflist
          • Vl-gatetype-p
          • Vl-cstrength-p
          • Vl-port->name
          • Vl-genelement->loc
          • Vl-delayoreventcontrol
          • Vl-udpentry-p
          • Vl-portdecllist
          • Vl-elabtask->loc
          • Property-expressions
          • Vl-taskdecllist
          • Vl-port->loc
          • Vl-fundecllist
          • Vl-sequencelist
          • Vl-propertylist
          • Vl-portlist
          • Vl-dpiimportlist
          • Vl-dpiexportlist
          • Vl-classlist
          • Vl-arguments->args
          • Vl-alwaystype-p
          • Vl-modinstlist
          • Vl-importpart-p
          • Vl-importpart-fix
          • Vl-bindlist
          • Vl-initiallist
          • Vl-genvarlist
          • Vl-gclkdecllist
          • Vl-function-specialization-map
          • Vl-finallist
          • Vl-elabtasklist
          • Vl-defaultdisablelist
          • Vl-clkdecllist
          • Vl-cassertionlist
          • Vl-blockstmt-p
          • Vl-assignlist
          • Vl-assertionlist
          • Vl-alwayslist
          • Vl-aliaslist
          • Vl-udptable
          • Vl-udplist
          • Vl-udpentrylist
          • Vl-propportlist
          • Vl-programlist
          • Vl-packagelist
          • Vl-namedarglist
          • Vl-modulelist
          • Vl-modportlist
          • Vl-modport-portlist
          • Vl-letdecllist
          • Vl-interfacelist
          • Vl-gateinstlist
          • Vl-fwdtypedeflist
          • Vl-covergrouplist
          • Vl-configlist
          • Vl-clkassignlist
          • Vl-blockitemlist
          • Vl-ansi-portdecllist
          • Vl-regularportlist
          • Vl-paramdecllist-list
          • Vl-modelementlist
          • Vl-interfaceportlist
          • Vl-casekey-p
          • Sv::maybe-4veclist
        • Loader
        • Warnings
        • Getting-started
        • Utilities
        • Printer
        • Kit
        • Mlib
        • Transforms
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Vl-datatype

Vl-struct

A SystemVerilog struct datatype, or an array of structs.

This is a product type, introduced by deftagsum in support of vl-datatype.

Fields
members — vl-structmemberlist
The list of structure members, i.e., the fields of the structure, in order.
packedp — booleanp
Roughly: says whether this struct is packed or not, but warning! this is complicated and generally should not be used; see below for details.
pdims — vl-dimensionlist
Packed dimensions for the structure.
udims — vl-dimensionlist
Unpacked dimensions for the structure.
signedp — booleanp
Roughly: says whether this struct is signed or not, but warning! this is really complicated and generally should not be used; see below for details.

If you look at the SystemVerilog grammar you might notice that there aren't unpacked dimensions:

data_type ::= ... | struct_union [ 'packed' [signing] ] '{'
                      struct_union_member { struct_union_member }
                    '}' { packed_dimension }

But it seems much cleaner to make the unpacked dimensions part of a structure, so when we deal with a variable declaration like:

mystruct_t [3:0] foo [4:0];

We can record, in the type of foo itself, all of the relevant type information, instead of having to keep the unpacked dimensions separated.

Warning about Packedp and Signedp

The packedness/signedness of structures/arrays is complicated; you should usually use utilities like vl-datatype-packedp and vl-datatype-arithclass instead of directly using the packedp and signedp fields.

What are the issues? At parse time, we use the packedp and signedp fields to record whether the struct was declared to be packed and/or signed.

For a single (non-array) structure, packedp is basically correct, except that BOZO really we should be checking that all of the members of the struct are packed as well. But for arrays of structs, even if the struct itself is packed, the array itself might be unpacked. For instance, if we write:

struct packed { logic [3:0] a; logic [3:0] b; } myvar [3:0];

then myvar will be marked as packed, but this packedness refers to the elements of myvar instead of to myvar itself!

Signedness has similar issues except that it is more complicated; see the documentation in vl-datatype-arithclass and also vl-usertype for more details.

Subtopics

Vl-structmember
A single member of a struct or union.
Make-vl-struct
Basic constructor macro for vl-struct structures.
Vl-struct->udims
Get the udims field from a vl-struct.
Vl-struct->signedp
Get the signedp field from a vl-struct.
Vl-struct->packedp
Get the packedp field from a vl-struct.
Vl-struct->members
Get the members field from a vl-struct.
Vl-struct->pdims
Get the pdims field from a vl-struct.
Change-vl-struct
Modifying constructor for vl-struct structures.