• 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
            • Lint-warning-suppression
            • Lucid
            • Lvaluecheck
            • Vl-interfacelist-alwaysstyle
            • Truncation-warnings
              • Vl-maybe-warn-about-implicit-truncation
              • Vl-struct-assignpat-keyval-type-err-warn
              • Vl-maybe-warn-about-implicit-extension
              • Vl-check-datatype-compatibility
              • Vl-subexpr-type-error-list-combine
              • Vl-datatype-compatibility-type-error
              • Vl-type-error-qmark-combine
              • Vl-type-error
              • Vl-subexpr-type-error-list-warn
              • Vl-assignpat-cast-type-error-warn
              • Vl-typecast-type-error-warn
              • Vl-check-datatype-assignment-compatibility
              • Vl-okay-to-truncate-expr
              • Vl-check-datatype-equivalence
              • Vl-maybe-type-error
              • Vl-classify-extension-warning-hook
              • Vl-subexpr-type-error
              • Vl-collect-toobig-constant-atoms
              • Vl-dimensionlist-compare-sizes
              • Vl-dimension-compare-sizes
              • Vl-unsized-atom-p
              • Vl-toobig-constant-atom-p
              • Vl-some-unsized-atom-p
              • Vl-expr-is-{'0, ...}-p
              • Vl-expr-is-{n{0}}-p
              • Vl-subexpr-type-error-list
              • Vl-typecompat-p
            • 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

Truncation-warnings

Warnings about implicit truncation and extensions in assignments, casts, and so forth.

Truncation warnings are really, really good to have, and have found many bugs. However, if we just issue a truncation warning about everything, we find that there are way too many nitpicky warnings and it's hard to go through them all. So, we want to be clever and not warn in certain cases that we have seen where the truncation really doesn't matter. Efficiency is of no concern because this is called so infrequently.

Probably the biggest source of spurious truncation warnings is from the use of unsized numbers like 0 and 1. It's a pretty good bet that any truncation from 32-bits to some other number of bits is no big deal and is just being caused by a unsized number.

At any rate, we now have a notion of expression that are okay to truncate. We basically don't want to complain about things like

assign foo[3:0] = 0;              // 32 bits, but who cares, it fits

assign foo[3:0] = 5'd7;           // 5 bits, but who cares, it still fits

assign foo[3:0] = x0 ? 5'h0 :     // each are 5 bits, but who cares, they
                  x1 ? 5'h1 :     // still fit.
                  x2 ? 5'h2 :
                  ...
                  x14 ? 5'h14 :
                  5'h15;

Subtopics

Vl-maybe-warn-about-implicit-truncation
Vl-struct-assignpat-keyval-type-err-warn
Vl-maybe-warn-about-implicit-extension
Lint-like warnings about right hand sides being extended.
Vl-check-datatype-compatibility
Checks two datatypes for compatibility. The compattype argument determines which kind of compatibility -- equivalence, assignment compatibility, or cast compatibility. For assignment and cast compatibility, B is the source type and A the destination type.
Vl-subexpr-type-error-list-combine
Vl-datatype-compatibility-type-error
Vl-type-error-qmark-combine
Vl-type-error
Vl-subexpr-type-error-list-warn
Vl-assignpat-cast-type-error-warn
Vl-typecast-type-error-warn
Vl-check-datatype-assignment-compatibility
Returns NIL if the datatypes are assignment compatible (an object of type B can be assigned to a variable of type A) or an explanatory message if not.
Vl-okay-to-truncate-expr
Heuristic for deciding whether to issue truncation warnings.
Vl-check-datatype-equivalence
Returns NIL if the datatypes are equivalent, or an explanatory message if not.
Vl-maybe-type-error
Option type; vl-type-error or nil.
Vl-classify-extension-warning-hook
Configurable hook for classifying extension warnings.
Vl-subexpr-type-error
Vl-collect-toobig-constant-atoms
Vl-dimensionlist-compare-sizes
Vl-dimension-compare-sizes
Vl-unsized-atom-p
Vl-toobig-constant-atom-p
Vl-some-unsized-atom-p
Vl-expr-is-{'0, ...}-p
Vl-expr-is-{n{0}}-p
Vl-subexpr-type-error-list
A list of vl-subexpr-type-error-p objects.
Vl-typecompat-p