• Top
    • Documentation
    • Books
    • Recursion-and-induction
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Vwsim
      • Fgl
      • 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-maybe-strip-outer-linestart
            • Vl-pp-module
            • Vl-print-wirename
            • Vl-print-loc
            • Vl-pp-genblob-guts
            • Vl-pp-describe
            • Vl-print-modname
            • Vl-pp-modinst
            • Vl-pps-module
            • Vl-ppc-modulelist
            • Vl-pp-origexpr
            • Vl-binaryop-precedence
            • Vl-pp-interface
            • Vl-pps-expr
            • Vl-pp-modulename-link
            • Vl-ppcs-module
            • Vl-pp-paramdecl
            • Vl-pp-modulename-link-aux
            • Vl-pp-interfacelist
            • Vl-pp-genblob
            • Vl-pp-vardecl-aux
            • Vl-pp-repetition
            • Vl-pp-packagelist
            • Vl-pp-package
            • Vl-pp-modulelist
            • Vl-pp-modinstlist
            • Vl-pp-modelement
            • Vl-pp-bind
            • Vl-pp-arguments
            • Vl-maybe-escape-string
            • Vl-ps-update-mimic-linebreaks
            • Vl-pp-definition-scope-summary
            • Vl-pp-bindlist
            • Vl-pp-ansi-portdecl
            • Vl-cw-obj
            • Vl-ps-update-show-atts
            • Vl-ps-update-copious-parens
            • Vl-pps-modulelist
            • Vl-ppcs-modulelist
            • Vl-pp-vardecl-atts-begin
            • Vl-pp-portdecl
            • Vl-pp-clkdecl
            • Vl-gatetype-string
            • Vl-coretypename-string
            • Vl-pps-origexpr
            • Vl-pp-vardecl-atts-end
            • Vl-pp-propport
            • Vl-pp-modinst-atts-begin
            • Vl-pp-gateinst-atts-begin
            • Vl-pp-gateinst
            • Vl-pp-gatedelay
            • Vl-pp-foreachstmt-loopvars
            • Vl-pp-dpiimport
            • Vl-nettypename-string
            • Vl-fwdtypedefkind-string
            • Vl-expr-precedence
            • Vl-atts-find-paramname
            • Vl-randomqualifier-string
            • Vl-ps-update-use-origexprs
            • Vl-pp-taskdecl
            • Vl-pp-scope-summary
            • Vl-pp-namedparamvaluelist
            • Vl-pp-modport-port
            • Vl-pp-gatestrength
            • Vl-pp-fundecl
            • Vl-pp-design
            • Vl-pp-assign
            • Vl-distweighttype-string
            • Vl-blocktype-startstring
            • Vl-blocktype-endstring
            • Vl-asserttype-string
            • Vl-assertdeferral-string
            • Vl-alwaystype-string
            • Vl-pp-vardecllist-comma-separated
            • Vl-pp-scopetype
            • Vl-pp-repeateventcontrol
            • Vl-pp-regularport
            • Vl-pp-plainarglist
            • Vl-pp-plainarg
            • Vl-pp-paramvaluelist
            • Vl-pp-namedarglist
            • Vl-pp-interfaceportlist
            • Vl-pp-interfaceport
            • Vl-pp-forloop-assigns
            • Vl-pp-exprdistlist-with-commas
            • Vl-pp-dpiexport
            • Vl-pp-distitem
            • Vl-pp-delayoreventcontrol
            • Vl-direction-string
            • Vl-cstrength-string
            • Vl-casetype-string
            • Vl-casecheck-string
            • Vl-pp-vardecllist-indented
            • Vl-pp-typedeflist-indented
            • Vl-pp-typedef
            • Vl-pp-set-portnames
            • Vl-pp-sequence
            • Vl-pp-regularportlist
            • Vl-pp-propspec
            • Vl-pp-propportlist
            • Vl-pp-property
            • Vl-pp-paramdecllist-indented
            • Vl-pp-namedparamvalue
            • Vl-pp-namedarg
            • Vl-pp-modport-portlist
            • Vl-pp-importlist-indented
            • Vl-pp-eventcontrol
            • Vl-pp-delaycontrol
            • Vl-pp-defaultdisablelist
            • Vl-pp-defaultdisable
            • Vl-pp-covergroup
            • Vl-pp-constint
            • Vl-pp-clkskew
            • Vl-pp-clkassign
            • Vl-pp-cassertionlist
            • Vl-pp-alias
            • Vl-leftright-string
            • Vl-pps-range
            • Vl-pp-weirdint
            • Vl-pp-vardecllist
            • Vl-pp-typedeflist
            • Vl-pp-taskdecllist
            • Vl-pp-specialkey
            • Vl-pp-sequencelist
            • Vl-pp-scopename
            • Vl-pp-rhs
            • Vl-pp-propertylist
            • Vl-pp-programlist
            • Vl-pp-program
            • Vl-pp-portlist
            • Vl-pp-portdecllist
            • Vl-pp-paramvalue
            • Vl-pp-paramdecllist
            • Vl-pp-paramargs
            • Vl-pp-modport
            • Vl-pp-modelementlist
            • Vl-pp-initiallist
            • Vl-pp-import
            • Vl-pp-gclkdecllist
            • Vl-pp-gclkdecl
            • Vl-pp-gateinstlist
            • Vl-pp-fwdtypedeflist
            • Vl-pp-fwdtypedef
            • Vl-pp-fundecllist
            • Vl-pp-exprdist
            • Vl-pp-elabtasklist
            • Vl-pp-dpiimportlist
            • Vl-pp-dpiexportlist
            • Vl-pp-distlist
            • Vl-pp-covergrouplist
            • Vl-pp-config
            • Vl-pp-clkdecllist
            • Vl-pp-clkassignlist
            • Vl-pp-class
            • Vl-pp-assertionlist
            • Vl-pp-alwayslist
            • Vl-vardecl-hiddenp
            • Vl-pp-vardecl
            • Vl-pp-value
            • Vl-pp-udplist
            • Vl-pp-udp
            • Vl-pp-string
            • Vl-pp-rangelist
            • Vl-pp-lifetime
            • Vl-pp-initial
            • Vl-pp-importlist
            • Vl-pp-genvar
            • Vl-pp-finallist
            • Vl-pp-final
            • Vl-pp-extint
            • Vl-pp-elabtask
            • Vl-pp-configlist
            • Vl-pp-classlist
            • Vl-pp-assignlist
            • Vl-pp-always
            • Vl-lifetime-string
            • Vl-dpiprop->string
            • Vl-dpifntask->string
            • Vl-pp-time
            • Vl-pp-real
            • Vl-pp-port
            • Vl-expr-dollarsign-p
            • Vl-dpispec->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
    • Testing-utilities
    • Math
  • 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-maybe-strip-outer-linestart
Vl-pp-module
Pretty-print a module to ps.
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-genblob-guts
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-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-origexpr
Pretty-print the "original," un-transformed version of an expression.
Vl-binaryop-precedence
Vl-pp-interface
Vl-pps-expr
Pretty-print an expression into a string.
Vl-pp-modulename-link
Vl-ppcs-module
Pretty-print a module with comments to a plain-text string.
Vl-pp-paramdecl
Vl-pp-modulename-link-aux
Vl-pp-interfacelist
Vl-pp-genblob
Vl-pp-vardecl-aux
Vl-pp-repetition
Vl-pp-packagelist
Vl-pp-package
Vl-pp-modulelist
Vl-pp-modinstlist
Vl-pp-modelement
Vl-pp-bind
Vl-pp-arguments
Vl-maybe-escape-string
Vl-ps-update-mimic-linebreaks
Set whether we should emulate linebreaks from the original input.
Vl-pp-definition-scope-summary
Vl-pp-bindlist
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-show-atts
Set whether Verilog-2005 (* key = val *)-style attributes should be displayed.
Vl-ps-update-copious-parens
Set whether we should print expressions with extra parentheses even where they are not needed.
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-vardecl-atts-begin
Vl-pp-portdecl
Vl-pp-clkdecl
Vl-gatetype-string
Vl-coretypename-string
Vl-pps-origexpr
Pretty-print the "original," un-transformed version of an expression into a string.
Vl-pp-vardecl-atts-end
Vl-pp-propport
Vl-pp-modinst-atts-begin
Vl-pp-gateinst-atts-begin
Vl-pp-gateinst
Vl-pp-gatedelay
Vl-pp-foreachstmt-loopvars
Vl-pp-dpiimport
Vl-nettypename-string
Vl-fwdtypedefkind-string
Vl-expr-precedence
Returns a symbol representing the operation that's being done at the top level.
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-taskdecl
Vl-pp-scope-summary
Vl-pp-namedparamvaluelist
Vl-pp-modport-port
Vl-pp-gatestrength
Vl-pp-fundecl
Vl-pp-design
Vl-pp-assign
Vl-distweighttype-string
Vl-blocktype-startstring
Vl-blocktype-endstring
Vl-asserttype-string
Vl-assertdeferral-string
Vl-alwaystype-string
Vl-pp-vardecllist-comma-separated
Vl-pp-scopetype
Vl-pp-repeateventcontrol
Vl-pp-regularport
Vl-pp-plainarglist
Vl-pp-plainarg
Vl-pp-paramvaluelist
Vl-pp-namedarglist
Vl-pp-interfaceportlist
Vl-pp-interfaceport
Vl-pp-forloop-assigns
Vl-pp-exprdistlist-with-commas
Vl-pp-dpiexport
Vl-pp-distitem
Vl-pp-delayoreventcontrol
Vl-direction-string
Vl-cstrength-string
Vl-casetype-string
Vl-casecheck-string
Vl-pp-vardecllist-indented
Vl-pp-typedeflist-indented
Vl-pp-typedef
Vl-pp-set-portnames
Vl-pp-sequence
Vl-pp-regularportlist
Vl-pp-propspec
Vl-pp-propportlist
Vl-pp-property
Vl-pp-paramdecllist-indented
Vl-pp-namedparamvalue
Vl-pp-namedarg
Vl-pp-modport-portlist
Vl-pp-importlist-indented
Vl-pp-eventcontrol
Vl-pp-delaycontrol
Vl-pp-defaultdisablelist
Vl-pp-defaultdisable
Vl-pp-covergroup
Vl-pp-constint
Vl-pp-clkskew
Vl-pp-clkassign
Vl-pp-cassertionlist
Vl-pp-alias
Vl-leftright-string
Vl-pps-range
Vl-pp-weirdint
Vl-pp-vardecllist
Vl-pp-typedeflist
Vl-pp-taskdecllist
Vl-pp-specialkey
Vl-pp-sequencelist
Vl-pp-scopename
Vl-pp-rhs
Vl-pp-propertylist
Vl-pp-programlist
Vl-pp-program
Vl-pp-portlist
Vl-pp-portdecllist
Vl-pp-paramvalue
Vl-pp-paramdecllist
Vl-pp-paramargs
Vl-pp-modport
Vl-pp-modelementlist
Vl-pp-initiallist
Vl-pp-import
Vl-pp-gclkdecllist
Vl-pp-gclkdecl
Vl-pp-gateinstlist
Vl-pp-fwdtypedeflist
Vl-pp-fwdtypedef
Vl-pp-fundecllist
Vl-pp-exprdist
Vl-pp-elabtasklist
Vl-pp-dpiimportlist
Vl-pp-dpiexportlist
Vl-pp-distlist
Vl-pp-covergrouplist
Vl-pp-config
Vl-pp-clkdecllist
Vl-pp-clkassignlist
Vl-pp-class
Vl-pp-assertionlist
Vl-pp-alwayslist
Vl-vardecl-hiddenp
Vl-pp-vardecl
Vl-pp-value
Vl-pp-udplist
Vl-pp-udp
Vl-pp-string
Vl-pp-rangelist
Vl-pp-lifetime
Vl-pp-initial
Vl-pp-importlist
Vl-pp-genvar
Vl-pp-finallist
Vl-pp-final
Vl-pp-extint
Vl-pp-elabtask
Vl-pp-configlist
Vl-pp-classlist
Vl-pp-assignlist
Vl-pp-always
Vl-lifetime-string
Vl-dpiprop->string
Vl-dpifntask->string
Vl-pp-time
Vl-pp-real
Vl-pp-port
Vl-expr-dollarsign-p
Vl-dpispec->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.