• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
        • Warnings
        • Primitives
        • Use-set
        • Syntax
        • Getting-started
        • Utilities
        • Loader
        • Transforms
        • Lint
          • Vl-lintconfig-p
          • Lucid
          • Skip-detection
          • Vl-lintresult-p
          • Lint-warning-suppression
          • Condcheck
          • Selfassigns
          • Leftright-check
            • Vl-modulelist-leftright-check
            • Vl-expr-leftright-check
            • Vl-leftright-exprlist-duplicates
            • Vl-collect-ac-args
            • Vl-module-leftright-check
            • Vl-exprctxalist-leftright-check
            • Vl-expr-indexy-via-ctx
            • Vl-design-leftright-check
            • Vl-op-ac-p
          • Dupeinst-check
          • Oddexpr-check
          • Remove-toohard
          • Qmarksize-check
          • Portcheck
          • Duplicate-detect
          • Vl-print-certain-warnings
          • Duperhs-check
          • *vl-lint-help*
          • Lint-stmt-rewrite
          • Drop-missing-submodules
          • Check-case
          • Drop-user-submodules
          • Check-namespace
          • Vl-lint
        • Mlib
        • Server
        • Kit
        • Printer
        • Esim-vl
        • Well-formedness
      • Sv
      • Fgl
      • Vwsim
      • Vl
      • X86isa
      • Svl
      • Rtl
    • Software-verification
    • Math
    • Testing-utilities
  • Lint

Leftright-check

Check for strange expressions like A [op] A.

This is a heuristic for generating warnings, inspired by PVS Studio. It has found a few pretty minor things that we were able to clean up, and also found one interesting copy/paste bug.

We look for identical sub-expressions on the left and right of most binary operations, for instance A | A and A == A. It is usually pretty strange to write such an expression, and sometimes these indicate copy/paste errors. We do similar checking for the then- and else-branches of ?: operators.

We also look for part-selects that use the same expressions for both indices, e.g., foo[3:3], but these are somewhat more common and minor, and sometimes result from macros or parameterized modules, so we generally think these are pretty minor and uninteresting.

Subtopics

Vl-modulelist-leftright-check
(vl-modulelist-leftright-check x) maps vl-module-leftright-check across a list.
Vl-expr-leftright-check
Search for strange expressions like A [op] A.
Vl-leftright-exprlist-duplicates
Optimized duplicate expression gatherer for leftright checking.
Vl-collect-ac-args
Collect the nested arguments to an associative/commutative operator.
Vl-module-leftright-check
(vl-module-leftright-check x) carries our our leftright-check on all the expressions in a module, and adds any resulting warnings to the module.
Vl-exprctxalist-leftright-check
(vl-exprctxalist-leftright-check x) extends vl-expr-leftright-check across an vl-exprctxalist-p.
Vl-expr-indexy-via-ctx
Vl-design-leftright-check
Vl-op-ac-p
Recognizes the associative/commutative binary vl-op-ps.