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