Vl-weirdint
Representation for constant integer literals with any X or Z bits,
e.g., 4'b11xx.
This is a product type, introduced by deftagsum in support of vl-value.
Fields
- bits — vl-bitlist
- An MSB-first list of the four-valued Verilog bits making up
this constant's value; see vl-bit-p.
- origsign — vl-exprsign-p
- Subtle; generally should not be used; see below.
- wasunsized — booleanp
- Did this constant have an explicit size?
Additional Requirements
The following invariant is enforced on the fields:
(consp bits)
Detailed Explanation
Weird integers are produced by source code constructs like
1'bz, 3'b0X1, and so on.
Weirdints are mostly like vl-constints except that instead
of having a natural number value they have bits, a list of
four-valued vl-bits, which are always represented in MSB-first
order.
The origsign and wasunsized fields are analogous to
those from a vl-constint; see the discussion there for
details.
Unlike a constint, a weirdint has no origwidth. Instead, its
original width is implicitly just the length of its bits. When our
lexer encounters a weirdint like 5'b1x, it automatically
extends it to the desired width; see for instance vl-correct-bitlist. Note that, as with constints, you usually
should not be looking at this length or at the origsign
field, because these original values are not necessarily the correct
post-sizing sizes and signedness.
Like constinsts, all weirdints are automatically constructed with
hons. This may not be worthwhile since there are probably
usually not too many weirdints, but by the same reasoning it
shouldn't be too harmful.
Subtopics
- Vl-bitlist-nonempty-fix
- Fixing function for non-empty vl-bitlists.
- Vl-weirdint->bits
- Get the bits field from a vl-weirdint.
- Make-vl-weirdint
- Basic constructor macro for vl-weirdint structures.
- Vl-weirdint->wasunsized
- Get the wasunsized field from a vl-weirdint.
- Vl-weirdint->origsign
- Get the origsign field from a vl-weirdint.
- Vl-bit
- Representation of a single Verilog bit (0, 1, X, or Z).
- Change-vl-weirdint
- Modifying constructor for vl-weirdint structures.