Question: Write the SystemVerilog code for this OTTER register file module. I have this so far: module REGFILE ( input [ 4 : 0 ] ADR

Write the SystemVerilog code for this OTTER register file module. I have this so far:
module REGFILE(
input [4:0] ADR1,
input [4:0] ADR2,
input [4:0] WADR,
input [31:0] WDATA,
input [0:0] WE,
input clk,
output [31:0] RS1,
output [31:0] RS2
);
reg [31:0] REGFILE [31:0];
always @(posedge clk) begin
if (WE) begin
REGFILE[WADR]<= WDATA;
end
end
assign RS1= REGFILE[ADR1];
assign RS2= REGFILE[ADR2];
I also have to initialize all registers to zero and this code was given to help with that:
logic [15:0] ram [0:511];
// Initialize the memory to be all 0s
initial begin
int i;
for (i=0; i<512; i=i+1) begin
ram[i]=0;
end
end
I'm not sure how to implement the initializing to 0 part.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!