Complete the code to declare a synchronous read memory.
reg [7:0] memory [0:15]; reg [3:0] addr; reg [7:0] data_out; always @(posedge clk) begin data_out <= memory[[1]]; end
The synchronous read uses the address addr inside the clocked block to read memory.
Complete the code to declare an asynchronous read memory.
reg [7:0] memory [0:15]; reg [3:0] addr; wire [7:0] data_out; assign data_out = memory[[1]];
For asynchronous read, the output data_out is assigned directly from memory at the address addr.
Fix the error in the synchronous read block to correctly read memory.
always @(posedge clk) begin
data_out <= memory[[1]];
endThe memory should be indexed by the address addr inside the clocked block.
Fill both blanks to create a synchronous read with address and clock signals.
reg [7:0] memory [0:15]; reg [3:0] [1]; reg [7:0] data_out; always @(posedge [2]) begin data_out <= memory[addr]; end
The address register is addr and the clock signal is clk.
Fill all three blanks to create an asynchronous read with address, output, and memory signals.
reg [7:0] [1] [0:15]; reg [3:0] addr; wire [7:0] [2]; assign [2] = [1][addr];
The memory array is named memory, and the output wire is data_out. The assignment reads from memory at addr.