• 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
        • Loader
        • Warnings
        • Getting-started
        • Utilities
        • Printer
          • Ps
          • Verilog-printing
            • Vl-pp-expr
            • Vl-fmt
            • Vl-progindent
            • Vl-ppc-module
            • Vl-mimic-linestart
            • Vl-maybe-escape-identifier
            • Vl-print-ext-wirename
            • Vl-print-wirename
            • Vl-print-loc
            • Vl-pp-module
            • Vl-pp-describe
            • Vl-print-modname
            • Vl-pp-genblob-guts
            • Vl-pp-origexpr
            • Vl-pp-modinst
            • Vl-pps-module
            • Vl-ppc-modulelist
            • Vl-pp-interface
            • Vl-maybe-strip-outer-linestart
            • Vl-pps-expr
            • Vl-pp-modulename-link
            • Vl-binaryop-precedence
            • Vl-pp-genblob
            • Vl-ppcs-module
            • Vl-pp-paramdecl
            • Vl-pp-package
            • Vl-pp-modulename-link-aux
            • Vl-pp-modelement
            • Vl-pp-interfacelist
            • Vl-pp-bind
            • Vl-pp-arguments
            • Vl-ps-update-mimic-linebreaks
            • Vl-pp-vardecl-aux
            • Vl-pp-repetition
            • Vl-pp-packagelist
            • Vl-pp-modulelist
            • Vl-pp-modinstlist
            • Vl-pp-definition-scope-summary
            • Vl-pp-bindlist
            • Vl-maybe-escape-string
            • Vl-ps-update-show-atts
            • Vl-pps-modulelist
            • Vl-ppcs-modulelist
            • Vl-pp-portdecl
            • Vl-pp-ansi-portdecl
            • Vl-cw-obj
            • Vl-ps-update-copious-parens
            • Vl-pps-origexpr
            • Vl-pp-vardecl-atts-begin
            • Vl-pp-propport
            • Vl-pp-gateinst-atts-begin
            • Vl-pp-gatedelay
            • Vl-pp-foreachstmt-loopvars
            • Vl-pp-dpiimport
            • Vl-pp-clkdecl
            • Vl-gatetype-string
            • Vl-coretypename-string
            • Vl-atts-find-paramname
            • Vl-randomqualifier-string
            • Vl-ps-update-use-origexprs
            • Vl-pp-vardecl-atts-end
            • Vl-pp-taskdecl
            • Vl-pp-scope-summary
            • Vl-pp-namedparamvaluelist
            • Vl-pp-modinst-atts-begin
            • Vl-pp-gatestrength
            • Vl-pp-gateinst
            • Vl-pp-fundecl
            • Vl-nettypename-string
            • Vl-fwdtypedefkind-string
            • Vl-expr-precedence
            • Vl-distweighttype-string
            • Vl-assertdeferral-string
            • Vl-pp-vardecllist-comma-separated
            • Vl-pp-repeateventcontrol
            • Vl-pp-regularport
            • Vl-pp-plainarglist
            • Vl-pp-plainarg
            • Vl-pp-paramvaluelist
            • Vl-pp-namedarglist
            • Vl-pp-modport-port
            • Vl-pp-interfaceport
            • Vl-pp-forloop-assigns
            • Vl-pp-exprdistlist-with-commas
            • Vl-pp-dpiexport
            • Vl-pp-distitem
            • Vl-pp-design
            • Vl-pp-delayoreventcontrol
            • Vl-pp-assign
            • Vl-blocktype-startstring
            • Vl-blocktype-endstring
            • Vl-asserttype-string
            • Vl-alwaystype-string
            • Vl-pp-vardecllist-indented
            • Vl-pp-typedeflist-indented
            • Vl-pp-typedef
            • Vl-pp-set-portnames
            • Vl-pp-sequence
            • Vl-pp-scopetype
            • Vl-pp-regularportlist
            • Vl-pp-propspec
            • Vl-pp-property
            • Vl-pp-paramdecllist-indented
            • Vl-pp-namedparamvalue
            • Vl-pp-namedarg
            • Vl-pp-modport-portlist
            • Vl-pp-interfaceportlist
            • Vl-pp-delaycontrol
            • Vl-pp-defaultdisablelist
            • Vl-pp-defaultdisable
            • Vl-pp-covergroup
            • Vl-pp-constint
            • Vl-pp-clkskew
            • Vl-pp-clkassign
            • Vl-leftright-string
            • Vl-direction-string
            • Vl-cstrength-string
            • Vl-casetype-string
            • Vl-casecheck-string
            • Vl-pp-taskdecllist
            • Vl-pp-specialkey
            • Vl-pp-scopename
            • Vl-pp-rhs
            • Vl-pp-propportlist
            • Vl-pp-program
            • Vl-pp-paramdecllist
            • Vl-pp-paramargs
            • Vl-pp-modelementlist
            • Vl-pp-importlist-indented
            • Vl-pp-import
            • Vl-pp-gclkdecl
            • Vl-pp-fwdtypedeflist
            • Vl-pp-fwdtypedef
            • Vl-pp-exprdist
            • Vl-pp-eventcontrol
            • Vl-pp-dpiimportlist
            • Vl-pp-dpiexportlist
            • Vl-pp-covergrouplist
            • Vl-pp-clkassignlist
            • Vl-pp-class
            • Vl-pp-cassertionlist
            • Vl-pp-assertionlist
            • Vl-pp-alias
            • Vl-vardecl-hiddenp
            • Vl-pps-range
            • Vl-pp-weirdint
            • Vl-pp-vardecllist
            • Vl-pp-value
            • Vl-pp-udp
            • Vl-pp-typedeflist
            • Vl-pp-string
            • Vl-pp-sequencelist
            • Vl-pp-rangelist
            • Vl-pp-propertylist
            • Vl-pp-programlist
            • Vl-pp-portlist
            • Vl-pp-portdecllist
            • Vl-pp-paramvalue
            • Vl-pp-modport
            • Vl-pp-lifetime
            • Vl-pp-initiallist
            • Vl-pp-initial
            • Vl-pp-importlist
            • Vl-pp-genvar
            • Vl-pp-gclkdecllist
            • Vl-pp-gateinstlist
            • Vl-pp-fundecllist
            • Vl-pp-finallist
            • Vl-pp-extint
            • Vl-pp-elabtasklist
            • Vl-pp-distlist
            • Vl-pp-configlist
            • Vl-pp-config
            • Vl-pp-clkdecllist
            • Vl-pp-classlist
            • Vl-pp-assignlist
            • Vl-pp-alwayslist
            • Vl-pp-always
            • Vl-pp-vardecl
            • Vl-pp-udplist
            • Vl-pp-time
            • Vl-pp-real
            • Vl-pp-port
            • Vl-pp-final
            • Vl-pp-elabtask
            • Vl-lifetime-string
            • Vl-expr-dollarsign-p
            • Vl-dpispec->string
            • Vl-dpiprop->string
            • Vl-dpifntask->string
            • Vl-ps->copious-parens-p
            • Vl-ps->show-atts-p
            • Vl-ps->mimic-linebreaks-p
            • Vl-ps->use-origexprs-p
            • Vl-progindent-block-start
            • Vl-progindent-block-end
            • Vl-cw
          • Basic-printing
          • Printing-locally
          • Formatted-printing
          • Accessing-printed-output
          • Json-printing
          • Vl-printedlist
        • Kit
        • Mlib
        • Transforms
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Printer

Verilog-printing

Printing routines for displaying SystemVerilog constructs.

Using the VL printer, we implement pretty-printing routines to display our internal parse-tree representation (see syntax) as SystemVerilog code. These functions produce either plain text or html output, depending upon the htmlp setting in the printer state, ps.

The pretty-printer is intended to be useful and convenient for humans to read, but it is not necessarily trustworthy. For instance:

  • Internally, VL generally keeps constructs like wire declarations and port declarations separate from assignments and module instances. When we print out a module with routines like vl-pp-module, the result is often reasonable, but it is easy to imagine cases where it could not be given to another Verilog tool because the resulting module no longer corresponds to the original parse order.
  • For certain constructs, such as post-elaborated generate blocks, there is no corresponding Verilog syntax that provides the same scoping and name resolution. In this case we print out something that resembles Verilog and that is not hard for a human to understand, but that would not be accepted by any tool that expected to get well-formed Verilog as input.

Subtopics

Vl-pp-expr
Main pretty-printer for an expression.
Vl-fmt
Print format strings with support for Verilog constructs.
Vl-progindent
Indent until wherever the next line should start, suitable for however many nested constructs are currently open.
Vl-ppc-module
Pretty print a module with comments to ps.
Vl-mimic-linestart
Mechanism to try to indent expressions like the user had done.
Vl-maybe-escape-identifier
Add escape characters to an identifier name, if necessary.
Vl-print-ext-wirename
(vl-print-ext-wirename modname wirename &key (ps 'ps)) prints a wire's name.
Vl-print-wirename
(vl-print-wirename x &key (ps 'ps)) prints a wire's name.
Vl-print-loc
(vl-print-loc x &key (ps 'ps)) prints a vl-location-p.
Vl-pp-module
Pretty-print a module to ps.
Vl-pp-describe
Prints out the definition of name (wherever it can be found in the scopestack) and uses of it in the current module.
Vl-print-modname
(vl-print-modname x &key (ps 'ps)) prints a module's name.
Vl-pp-genblob-guts
Vl-pp-origexpr
Pretty-print the "original," un-transformed version of an expression.
Vl-pp-modinst
Vl-pps-module
Pretty-print a module to a plain-text string.
Vl-ppc-modulelist
Pretty print a list of modules with comments to ps.
Vl-pp-interface
Vl-maybe-strip-outer-linestart
Vl-pps-expr
Pretty-print an expression into a string.
Vl-pp-modulename-link
Vl-binaryop-precedence
Vl-pp-genblob
Vl-ppcs-module
Pretty-print a module with comments to a plain-text string.
Vl-pp-paramdecl
Vl-pp-package
Vl-pp-modulename-link-aux
Vl-pp-modelement
Vl-pp-interfacelist
Vl-pp-bind
Vl-pp-arguments
Vl-ps-update-mimic-linebreaks
Set whether we should emulate linebreaks from the original input.
Vl-pp-vardecl-aux
Vl-pp-repetition
Vl-pp-packagelist
Vl-pp-modulelist
Vl-pp-modinstlist
Vl-pp-definition-scope-summary
Vl-pp-bindlist
Vl-maybe-escape-string
Vl-ps-update-show-atts
Set whether Verilog-2005 (* key = val *)-style attributes should be displayed.
Vl-pps-modulelist
Pretty-print a list of modules to a plain-text string.
Vl-ppcs-modulelist
Pretty-print a list of modules with comments to a plain-text string.
Vl-pp-portdecl
Vl-pp-ansi-portdecl
Vl-cw-obj
Similar to vl-cw, but the arguments are given as a list instead of as macro arguments.
Vl-ps-update-copious-parens
Set whether we should print expressions with extra parentheses even where they are not needed.
Vl-pps-origexpr
Pretty-print the "original," un-transformed version of an expression into a string.
Vl-pp-vardecl-atts-begin
Vl-pp-propport
Vl-pp-gateinst-atts-begin
Vl-pp-gatedelay
Vl-pp-foreachstmt-loopvars
Vl-pp-dpiimport
Vl-pp-clkdecl
Vl-gatetype-string
Vl-coretypename-string
Vl-atts-find-paramname
Vl-randomqualifier-string
Vl-ps-update-use-origexprs
Set whether we should print expressions as VL_ORIG_EXPRs, when they have such annotations.
Vl-pp-vardecl-atts-end
Vl-pp-taskdecl
Vl-pp-scope-summary
Vl-pp-namedparamvaluelist
Vl-pp-modinst-atts-begin
Vl-pp-gatestrength
Vl-pp-gateinst
Vl-pp-fundecl
Vl-nettypename-string
Vl-fwdtypedefkind-string
Vl-expr-precedence
Returns a symbol representing the operation that's being done at the top level.
Vl-distweighttype-string
Vl-assertdeferral-string
Vl-pp-vardecllist-comma-separated
Vl-pp-repeateventcontrol
Vl-pp-regularport
Vl-pp-plainarglist
Vl-pp-plainarg
Vl-pp-paramvaluelist
Vl-pp-namedarglist
Vl-pp-modport-port
Vl-pp-interfaceport
Vl-pp-forloop-assigns
Vl-pp-exprdistlist-with-commas
Vl-pp-dpiexport
Vl-pp-distitem
Vl-pp-design
Vl-pp-delayoreventcontrol
Vl-pp-assign
Vl-blocktype-startstring
Vl-blocktype-endstring
Vl-asserttype-string
Vl-alwaystype-string
Vl-pp-vardecllist-indented
Vl-pp-typedeflist-indented
Vl-pp-typedef
Vl-pp-set-portnames
Vl-pp-sequence
Vl-pp-scopetype
Vl-pp-regularportlist
Vl-pp-propspec
Vl-pp-property
Vl-pp-paramdecllist-indented
Vl-pp-namedparamvalue
Vl-pp-namedarg
Vl-pp-modport-portlist
Vl-pp-interfaceportlist
Vl-pp-delaycontrol
Vl-pp-defaultdisablelist
Vl-pp-defaultdisable
Vl-pp-covergroup
Vl-pp-constint
Vl-pp-clkskew
Vl-pp-clkassign
Vl-leftright-string
Vl-direction-string
Vl-cstrength-string
Vl-casetype-string
Vl-casecheck-string
Vl-pp-taskdecllist
Vl-pp-specialkey
Vl-pp-scopename
Vl-pp-rhs
Vl-pp-propportlist
Vl-pp-program
Vl-pp-paramdecllist
Vl-pp-paramargs
Vl-pp-modelementlist
Vl-pp-importlist-indented
Vl-pp-import
Vl-pp-gclkdecl
Vl-pp-fwdtypedeflist
Vl-pp-fwdtypedef
Vl-pp-exprdist
Vl-pp-eventcontrol
Vl-pp-dpiimportlist
Vl-pp-dpiexportlist
Vl-pp-covergrouplist
Vl-pp-clkassignlist
Vl-pp-class
Vl-pp-cassertionlist
Vl-pp-assertionlist
Vl-pp-alias
Vl-vardecl-hiddenp
Vl-pps-range
Vl-pp-weirdint
Vl-pp-vardecllist
Vl-pp-value
Vl-pp-udp
Vl-pp-typedeflist
Vl-pp-string
Vl-pp-sequencelist
Vl-pp-rangelist
Vl-pp-propertylist
Vl-pp-programlist
Vl-pp-portlist
Vl-pp-portdecllist
Vl-pp-paramvalue
Vl-pp-modport
Vl-pp-lifetime
Vl-pp-initiallist
Vl-pp-initial
Vl-pp-importlist
Vl-pp-genvar
Vl-pp-gclkdecllist
Vl-pp-gateinstlist
Vl-pp-fundecllist
Vl-pp-finallist
Vl-pp-extint
Vl-pp-elabtasklist
Vl-pp-distlist
Vl-pp-configlist
Vl-pp-config
Vl-pp-clkdecllist
Vl-pp-classlist
Vl-pp-assignlist
Vl-pp-alwayslist
Vl-pp-always
Vl-pp-vardecl
Vl-pp-udplist
Vl-pp-time
Vl-pp-real
Vl-pp-port
Vl-pp-final
Vl-pp-elabtask
Vl-lifetime-string
Vl-expr-dollarsign-p
Vl-dpispec->string
Vl-dpiprop->string
Vl-dpifntask->string
Vl-ps->copious-parens-p
Should we print expressions with extra parentheses? This may be useful when you want to show the precedence in a very explicit way.
Vl-ps->show-atts-p
Should Verilog-2005 (* key = val *)-style attributes be shown?
Vl-ps->mimic-linebreaks-p
Should we try to emulate linebreaks from the original input?
Vl-ps->use-origexprs-p
Should we print VL_ORIG_EXPR fields?
Vl-progindent-block-start
Vl-progindent-block-end
Vl-cw
cw-like function for printing to ps, with support for pretty-printing Verilog constructs as in vl-fmt.