Expand description
Module that supports arbitrary width bit vectors
Enums
Constants
LITERAL_BITS is set to the number of bits in the LiteralType. I.e., it is guaranteed that the number of bits in LiteralType is LITERAL_BITS.
Traits
Functions
Cast from one bit width to another with truncation or zero padding The bit_cast function allows you to convert from one bit width to another. It handles the different widths in the following simplified manner: - if casting to a narrower bit width, the most significant bits are discarded until the new value fits into the specified bits - if casting to a wider bit width, the most significant bits are padded with zeros until the new value occupies the specified bits This may seem a bit counterintuitive, but it fits logical circuitry behavior. Narrowing is usually done by preserving the least significant bits (so that the carry bits are discarded when adding, for example). Widening is also usually done (for unsigned values) by zero extending the most significant bits. The bit_cast operation does both of these operations depending on the arguments.
Compute the minimum number of bits to represent a container with t items.
This is basically ceil(log2(t))
as a constant (compile time computable) function.
You can use it where a const generic (bit width) argument is required.
Type Definitions
A type alias for a simple bool. You can use them interchangeably.
The LiteralType is used to set the type for literals that appear in RustHDL expressions. Because of how Rust’s type inference currently works, an expression like