• 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
        • Kit
          • Vl-lint
            • Vl-lintconfig-p
            • Condcheck
              • Vl-interfacelist-condcheck
              • Vl-modulelist-condcheck
              • Vl-expr-condcheck
              • Vl-condcheck-fix
              • Vl-module-condcheck!
              • Vl-interface-condcheck!
              • Vl-modelement-condcheck!
              • Vl-iftest-condcheck
              • Vl-maybe-delayoreventcontrol-condcheck
              • Vl-repeateventcontrol-condcheck
              • Vl-delayoreventcontrol-condcheck
              • Vl-design-condcheck!
              • Vl-vardecllist-condcheck
              • Vl-typedeflist-condcheck
              • Vl-portdecllist-condcheck
              • Vl-paramtype-condcheck
              • Vl-paramdecllist-condcheck
              • Vl-maybe-gatedelay-condcheck
              • Vl-maybe-exprdist-condcheck
              • Vl-exprdistlist-condcheck
              • Vl-blockitemlist-condcheck
              • Vl-blockitem-condcheck
              • Vl-vardecl-condcheck
              • Vl-repetition-condcheck
              • Vl-propspec-condcheck
              • Vl-portdecl-condcheck
              • Vl-importlist-condcheck
              • Vl-gatedelay-condcheck
              • Vl-eventcontrol-condcheck
              • Vl-distlist-condcheck
              • Vl-distitem-condcheck
              • Vl-delaycontrol-condcheck
              • Vl-typedef-condcheck
              • Vl-paramdecl-condcheck
              • Vl-maybe-rhs-condcheck
              • Vl-letdecl-condcheck
              • Vl-exprdist-condcheck
              • Vl-rhs-condcheck
              • Vl-import-condcheck
              • Vl-fundecl-condcheck!-aux
              • Vl-taskdecl-condcheck!-aux
              • Vl-package-condcheck!
              • Vl-function-specialization-map-condcheck!
              • Vl-portdecl-or-blockitem-list-condcheck!
              • Vl-portdecl-or-blockitem-condcheck!
              • Vl-condcheck-negate
              • Vl-class-condcheck!
              • Vl-parse-temps-condcheck!
              • Vl-modinst-condcheck!-aux
              • Vl-function-specialization-condcheck!
              • Vl-clkdecl-condcheck!
              • Vl-ansi-portdecl-condcheck!
              • Vl-vardecl-condcheck!-aux
              • Vl-modport-portlist-condcheck!
              • Vl-gateinst-condcheck!-aux
              • Vl-defaultdisablelist-condcheck!
              • Vl-defaultdisable-condcheck!
              • Vl-assign-condcheck!-aux
              • Vl-ansi-portdecllist-condcheck!
              • Vl-udp-condcheck!
              • Vl-taskdecllist-condcheck!
              • Vl-sequencelist-condcheck!
              • Vl-sequence-condcheck!
              • Vl-propportlist-condcheck!
              • Vl-propport-condcheck!
              • Vl-propertylist-condcheck!
              • Vl-property-condcheck!
              • Vl-plainarglist-condcheck!
              • Vl-paramdecl-condcheck!-aux
              • Vl-namedarglist-condcheck!
              • Vl-modport-port-condcheck!
              • Vl-maybe-parse-temps-condcheck!
              • Vl-gclkdecllist-condcheck!
              • Vl-gateinstlist-condcheck!
              • Vl-fwdtypedeflist-condcheck!
              • Vl-elabtasklist-condcheck!
              • Vl-dpiimportlist-condcheck!
              • Vl-dpiimport-condcheck!
              • Vl-dpiexportlist-condcheck!
              • Vl-covergrouplist-condcheck!
              • Vl-clkassignlist-condcheck!
              • Vl-cassertionlist-condcheck!
              • Vl-assertionlist-condcheck!
              • Vl-typedef-condcheck!-aux
              • Vl-regularport-condcheck!
              • Vl-programlist-condcheck!
              • Vl-plainarg-condcheck!
              • Vl-packagelist-condcheck!
              • Vl-namedarg-condcheck!
              • Vl-modportlist-condcheck!
              • Vl-modinstlist-condcheck!
              • Vl-maybe-clkskew-condcheck!
              • Vl-interfaceport-condcheck!
              • Vl-interface-condcheck
              • Vl-initiallist-condcheck!
              • Vl-initial-condcheck!-aux
              • Vl-genvarlist-condcheck!
              • Vl-gclkdecl-condcheck!
              • Vl-fundecllist-condcheck!
              • Vl-finallist-condcheck!
              • Vl-final-condcheck!-aux
              • Vl-configlist-condcheck!
              • Vl-clkdecllist-condcheck!
              • Vl-clkassign-condcheck!
              • Vl-classlist-condcheck!
              • Vl-bind-condcheck!
              • Vl-assignlist-condcheck!
              • Vl-arguments-condcheck!
              • Vl-alwayslist-condcheck!
              • Vl-always-condcheck!-aux
              • Vl-aliaslist-condcheck!
              • Vl-alias-condcheck!-aux
              • Vl-udplist-condcheck!
              • Vl-taskdecl-condcheck!
              • Vl-program-condcheck!
              • Vl-portlist-condcheck!
              • Vl-port-condcheck!
              • Vl-paramdecl-condcheck!
              • Vl-module-condcheck
              • Vl-modport-condcheck!
              • Vl-gateinst-condcheck!
              • Vl-fwdtypedef-condcheck!
              • Vl-elabtask-condcheck!
              • Vl-dpiexport-condcheck!
              • Vl-design-condcheck
              • Vl-covergroup-condcheck!
              • Vl-clkskew-condcheck!
              • Vl-bindlist-condcheck!
              • Vl-vardecl-condcheck!
              • Vl-typedef-condcheck!
              • Vl-modinst-condcheck!
              • Vl-initial-condcheck!
              • Vl-genvar-condcheck!
              • Vl-fundecl-condcheck!
              • Vl-final-condcheck!
              • Vl-config-condcheck!
              • Vl-assign-condcheck!
              • Vl-always-condcheck!
              • Vl-alias-condcheck!
            • Lint-warning-suppression
            • Lucid
            • Lvaluecheck
            • Vl-interfacelist-alwaysstyle
            • Truncation-warnings
            • Vl-modulelist-alwaysstyle
            • Skip-detection
            • Vl-lint-report
            • Vl-lintresult
            • Vl::vl-design-sv-use-set
            • Oddexpr-check
            • Leftright-check
            • Duplicate-detect
            • Selfassigns
            • *vl-lint-help*
            • Arith-compare-check
            • Dupeinst-check
            • Qmarksize-check
            • Lint-whole-file-suppression
            • Run-vl-lint-main
            • Logicassign
            • Run-vl-lint
            • Vl-print-certain-warnings
            • Duperhs-check
            • Vl-lint-top
            • Sd-filter-problems
            • Vl-modulelist-add-svbad-warnings
            • Vl-module-add-svbad-warnings
            • Check-case
            • Vl-lint-extra-actions
            • Drop-lint-stubs
            • Vl-lint-print-warnings
            • Drop-user-submodules
            • Check-namespace
            • Vl-lintconfig-loadconfig
            • Vl-lint-design->svex-modalist-wrapper
            • Vl-delete-sd-problems-for-modnames-aux
            • Vl-collect-new-names-from-orignames
            • Vl-lint-print-all-warnings
            • Vl-design-remove-unnecessary-modules
            • Vl-delete-sd-problems-for-modnames
            • Vl-always-check-style
            • Vl-vardecllist-svbad-warnings
            • Vl-vardecl-svbad-warnings
            • Vl-reportcard-remove-suppressed
            • Vl-reportcard-keep-suppressed
            • Vl-alwayslist-check-style
            • Vl-remove-nameless-descriptions
            • Vl-lint-apply-quiet
            • Vl-warninglist-remove-suppressed
            • Vl-warninglist-keep-suppressed
            • Vl-print-eliminated-descs
            • Vl-module-alwaysstyle
            • Vl-jp-reportcard-aux
            • Vl-interface-alwaysstyle
            • Vl-design-alwaysstyle
            • Vl-jp-description-locations
            • Vl-jp-reportcard
            • Vl-pp-stringlist-lines
            • Vl-jp-design-locations
            • Vl-datatype-svbad-p
            • Unpacked-range-check
            • Sd-problem-major-p
            • Vl-alwaysstyle
          • Vl-server
          • Vl-gather
          • Vl-zip
          • Vl-main
          • Split-plusargs
          • Vl-shell
          • Vl-json
        • Mlib
        • Transforms
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Vl-lint

Condcheck

Check for ?:-expressions with strange conditions.

This is a heuristic for generating warnings. We look for things like the following,targeting the ?: operator as well as if statements.

if A { ... }
else if B { ... }
else if A { ... }   // already checked A above, so this is unreachable
else if C { ... }
else ...

And also things like:

if A { ... }
else if B { ... }
else if !A { ... }   // already checked A above, so this is just true
else if C { ... }
else ...

And for if (constant) {...}.

All of this could be adapted to if statements too, but we target the ?: operator because we care a lot less about procedural code (like test benches) than we do about the actual hardware modules. Note that the qmarksize-check can also be used for some additional checking on ?: operators, but it tries to identify a different class of problems.

Since this is just a heuristic and it is completely unrelated to soundness, we feel justified in doing a couple of seemingly unsound things. In particular, we basically ignore widths of test expressions and treat ! and ~ as equivalent. We also treat ^ as != and ~^ as ==. This is completely wrong in general, but it makes sense if you assume that the tests are all going to be one-bit wide.

This check has no prerequisites and can in principle be run at any time. But it is probably best to run it very early before throwing things out, and it should probably be run before any transform that might alter expressions. (Historically it was important to run it before, e.g., vl2014::oprewrite, but now we generally are not rewriting expressions like that so it may be that we don't need to care much about this anymore.)

Subtopics

Vl-interfacelist-condcheck
(vl-interfacelist-condcheck x) maps vl-interface-condcheck across a list.
Vl-modulelist-condcheck
(vl-modulelist-condcheck x) maps vl-module-condcheck across a list.
Vl-expr-condcheck
Look for strange conditions throughout an expression.
Vl-condcheck-fix
Canonicalize an test expression for condcheck.
Vl-module-condcheck!
Vl-interface-condcheck!
Vl-modelement-condcheck!
Vl-iftest-condcheck
Vl-maybe-delayoreventcontrol-condcheck
Vl-repeateventcontrol-condcheck
Vl-delayoreventcontrol-condcheck
Vl-design-condcheck!
Vl-vardecllist-condcheck
Vl-typedeflist-condcheck
Vl-portdecllist-condcheck
Vl-paramtype-condcheck
Vl-paramdecllist-condcheck
Vl-maybe-gatedelay-condcheck
Vl-maybe-exprdist-condcheck
Vl-exprdistlist-condcheck
Vl-blockitemlist-condcheck
Vl-blockitem-condcheck
Vl-vardecl-condcheck
Vl-repetition-condcheck
Vl-propspec-condcheck
Vl-portdecl-condcheck
Vl-importlist-condcheck
Vl-gatedelay-condcheck
Vl-eventcontrol-condcheck
Vl-distlist-condcheck
Vl-distitem-condcheck
Vl-delaycontrol-condcheck
Vl-typedef-condcheck
Vl-paramdecl-condcheck
Vl-maybe-rhs-condcheck
Vl-letdecl-condcheck
Vl-exprdist-condcheck
Vl-rhs-condcheck
Vl-import-condcheck
Vl-fundecl-condcheck!-aux
Vl-taskdecl-condcheck!-aux
Vl-package-condcheck!
Vl-function-specialization-map-condcheck!
Vl-portdecl-or-blockitem-list-condcheck!
Vl-portdecl-or-blockitem-condcheck!
Vl-condcheck-negate
Smartly negate a canonicalized expression.
Vl-class-condcheck!
Vl-parse-temps-condcheck!
Vl-modinst-condcheck!-aux
Vl-function-specialization-condcheck!
Vl-clkdecl-condcheck!
Vl-ansi-portdecl-condcheck!
Vl-vardecl-condcheck!-aux
Vl-modport-portlist-condcheck!
Vl-gateinst-condcheck!-aux
Vl-defaultdisablelist-condcheck!
Vl-defaultdisable-condcheck!
Vl-assign-condcheck!-aux
Vl-ansi-portdecllist-condcheck!
Vl-udp-condcheck!
Vl-taskdecllist-condcheck!
Vl-sequencelist-condcheck!
Vl-sequence-condcheck!
Vl-propportlist-condcheck!
Vl-propport-condcheck!
Vl-propertylist-condcheck!
Vl-property-condcheck!
Vl-plainarglist-condcheck!
Vl-paramdecl-condcheck!-aux
Vl-namedarglist-condcheck!
Vl-modport-port-condcheck!
Vl-maybe-parse-temps-condcheck!
Vl-gclkdecllist-condcheck!
Vl-gateinstlist-condcheck!
Vl-fwdtypedeflist-condcheck!
Vl-elabtasklist-condcheck!
Vl-dpiimportlist-condcheck!
Vl-dpiimport-condcheck!
Vl-dpiexportlist-condcheck!
Vl-covergrouplist-condcheck!
Vl-clkassignlist-condcheck!
Vl-cassertionlist-condcheck!
Vl-assertionlist-condcheck!
Vl-typedef-condcheck!-aux
Vl-regularport-condcheck!
Vl-programlist-condcheck!
Vl-plainarg-condcheck!
Vl-packagelist-condcheck!
Vl-namedarg-condcheck!
Vl-modportlist-condcheck!
Vl-modinstlist-condcheck!
Vl-maybe-clkskew-condcheck!
Vl-interfaceport-condcheck!
Vl-interface-condcheck
Vl-initiallist-condcheck!
Vl-initial-condcheck!-aux
Vl-genvarlist-condcheck!
Vl-gclkdecl-condcheck!
Vl-fundecllist-condcheck!
Vl-finallist-condcheck!
Vl-final-condcheck!-aux
Vl-configlist-condcheck!
Vl-clkdecllist-condcheck!
Vl-clkassign-condcheck!
Vl-classlist-condcheck!
Vl-bind-condcheck!
Vl-assignlist-condcheck!
Vl-arguments-condcheck!
Vl-alwayslist-condcheck!
Vl-always-condcheck!-aux
Vl-aliaslist-condcheck!
Vl-alias-condcheck!-aux
Vl-udplist-condcheck!
Vl-taskdecl-condcheck!
Vl-program-condcheck!
Vl-portlist-condcheck!
Vl-port-condcheck!
Vl-paramdecl-condcheck!
Vl-module-condcheck
Vl-modport-condcheck!
Vl-gateinst-condcheck!
Vl-fwdtypedef-condcheck!
Vl-elabtask-condcheck!
Vl-dpiexport-condcheck!
Vl-design-condcheck
Vl-covergroup-condcheck!
Vl-clkskew-condcheck!
Vl-bindlist-condcheck!
Vl-vardecl-condcheck!
Vl-typedef-condcheck!
Vl-modinst-condcheck!
Vl-initial-condcheck!
Vl-genvar-condcheck!
Vl-fundecl-condcheck!
Vl-final-condcheck!
Vl-config-condcheck!
Vl-assign-condcheck!
Vl-always-condcheck!
Vl-alias-condcheck!