• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • 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
                • Make-vl-usertype
                • Vl-usertype->virtual-intfc
                • Vl-usertype->intfc-params
                • Vl-usertype->udims
                • Vl-usertype->res
                • Vl-usertype->pdims
                • Vl-usertype->name
                • Change-vl-usertype
              • 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-usertype

Represents a reference to some user-defined SystemVerilog datatype.

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

Fields
name — vl-scopeexpr
Typedef name, like foo_t. May have a package scope, but should not otherwise be hierarchical.
res — vl-maybe-datatype
The resolved type that name refers to. If present, it means we've already looked up the type and resolved its value. See below for more notes.
pdims — vl-dimensionlist
Packed dimensions for this user type.
udims — vl-dimensionlist
Unpacked dimensions for this user type.
virtual-intfc — booleanp
Indicates a virtual interface type, which we don't really support.
intfc-params — vl-maybe-paramargs
Parameter values -- relevant for the virtual-intfc case

Notes about the res Field

Originally, to deal with user-defined types, we tried to just substitute definitions for usertypes. However, it turns out that this isn't correct: e.g.

typedef logic signed [3:0] snib;
snib [3:0] foo1;

is not the same as just

logic signed [3:0] [3:0] foo2;

Here, foo1 is an unsigned array of signed slots, whereas foo2 is a signed array of unsigned slots. (NCV and VCS also treat them differently; we believe NCV gets it right with respect to the spec, whereas VCS seems to do the substitution.)

We then decided we'd just deal with usertypes directly. We rewrote all our type-manipulating functions to operate on a datatype and scopestack simultaneously. However, we don't want to store scopestacks between transformations. So there's a problem with e.g. type parameters: e.g.

module sub #(type and_t = logic [3:0])
            (input and_t a, b, output and_t o);
  assign o = a & b;
endmodule

module super ();
  typedef logic signed [5:0] my_and_t;
  my_and_t a, b;
  my_and_t o;
  sub #(.and_t(my_and_t)) inst (a, b, o);
endmodule

Here, we want to transform sub, replacing the and_t parameter with the overridden version my_and_t. But my_and_t is only defined in super! So we might want to do something like replacing the and_t type parameter with typedef my_and_t and_t;, or leaving it as a parameter #(type and_t = my_and_t). But neither of these work, because my_and_t isn't defined in the scope of sub.

Our solution is to go back to doing substitution, but instead of strictly substituting usertype <- definition, we leave the usertype but add the res field, a vl-maybe-datatype which, if present, means we've resolved this usertype and its definition is the res.

Subtopics

Make-vl-usertype
Basic constructor macro for vl-usertype structures.
Vl-usertype->virtual-intfc
Get the virtual-intfc field from a vl-usertype.
Vl-usertype->intfc-params
Get the intfc-params field from a vl-usertype.
Vl-usertype->udims
Get the udims field from a vl-usertype.
Vl-usertype->res
Get the res field from a vl-usertype.
Vl-usertype->pdims
Get the pdims field from a vl-usertype.
Vl-usertype->name
Get the name field from a vl-usertype.
Change-vl-usertype
Modifying constructor for vl-usertype structures.