What's the relationship between wire->start_offset and sigbit->offset when start_offset is negative? #3617
-
Supposed that we declare an What's the relationship between |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The RTLIL internal indexing is zero based, and The |
Beta Was this translation helpful? Give feedback.
The RTLIL internal indexing is zero based, and
wire->start_offset
(together withwire->upto
) defines how to map between Verilog indices and the internal indexing. So for the example in the question, the answer is yes, they're always non-negative and start at 0.The
SigSpec(RTLIL::Wire *wire)
constructor creates a singleSigChunk
using theSigChunk(RTLIL::Wire *wire)
constructor which in turn sets theoffset
of theSigChunk
to0
andwidth
toGetSize(wire)
. When unpacking aSigChunk
into individual bits, theSigBit(const RTLIL::SigChunk &chunk, int index)
constructor is used withindex
ranging from0
tochunk.width - 1
(inclusive) and this constructor setssigbit.index
tochunk.offset + index
…