Return the number of bits required to encode a specific value, assuming a sign bit is required.
Return the number of bits required to encode a specific value, assuming a sign bit is required.
Basically, 0 for 0, 1 for -1, and n.bitLength
+ 1 for everything else.
This reflects the Chisel assumption that a zero width wire has a value of 0.
- the number to be encoded.
- an Int representing the number of bits to encode.