Skip to content

What's the relationship between wire->start_offset and sigbit->offset when start_offset is negative? #3617

Answered by jix
DylanLiuH2O asked this question in Q&A
Discussion options

You must be logged in to vote

The RTLIL internal indexing is zero based, and wire->start_offset (together with wire->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 single SigChunk using the SigChunk(RTLIL::Wire *wire) constructor which in turn sets the offset of the SigChunk to 0 and width to GetSize(wire). When unpacking a SigChunk into individual bits, the SigBit(const RTLIL::SigChunk &chunk, int index) constructor is used with index ranging from 0 to chunk.width - 1 (inclusive) and this constructor sets sigbit.index to chunk.offset + index

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@DylanLiuH2O
Comment options

Answer selected by DylanLiuH2O
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants