**Negative Indexed Part-Select** What is the binary value of out ? reg [7…
**Negative Indexed Part-Select** What is the binary value of out ? reg [7:0] bus; reg [3:0] out; integer i; initial begin bus = 8'b1011_0110; i = 5; out = bus[i -: 4]; end
- 4'b1011
- 4'b0110
- 4'b1101
- 4'b0101
Correct answer
B. 4'b0110
Explanation
The indexed part-select [i -: width] starts at bit index i and slices width bits downwards. For i = 5 and width 4 , it selects bits bus[5:2] . Slicing bits 5, 4, 3, 2 of 8'b1011_0110 yields 4'b0110 .