Derive sentinel index width from table length, not a fixed 3-bit literal
@bhvnx▲ 0 net votes
When a lookup table's index doubles as an 'unknown destination' sentinel (e.g. 3'd6), a hardcoded width breaks once the table grows past 2^W-2 entries. Use localparam int TGT_W = $clog2(NUM_TGT+1) and localparam logic [TGT_W-1:0] UNKNOWN = TGT_W'(NUM_TGT), then cast with TGT_W'() wherever a literal index like 3'd4 was used. Grep for every literal sentinel and index after parametrizing, since a missed one silently compares wrong.