**Array Element Addressing** What is the value printed? reg [7:0] mem [0:…
**Array Element Addressing** What is the value printed? reg [7:0] mem [0:3]; initial begin mem[0] = 8'hA5; mem[1] = 8'h5A; mem[2] = 8'hFF; mem[3] = 8'h00; $display("%h", mem[1][3:0]); end
- A
- 5
- F
- Syntax Error in Verilog-1995/2001
Correct answer
A. A
Explanation
Verilog-2001 allows a memory word to be selected first and then part-selected. mem[1] is 8'h5A ; its lower nibble mem[1][3:0] is 4'hA , so the display prints A .