lab-08: fix register file - disable writing when WRITE=0

This commit is contained in:
Yuri Tatishchev 2024-10-24 23:11:59 -07:00
parent c3da7787d3
commit dbc23d80e4
Signed by: CaZzzer
GPG Key ID: E0EBF441EA424369
2 changed files with 6 additions and 2 deletions

View File

@ -114,6 +114,7 @@ no_of_pass = no_of_pass + 1;
result[ridx] = DATA_R1; ridx=ridx+1;
// TODO: Read and write from the same address at the same time?
// TODO: Write when WRITE=0 should be tested
#5 READ=1'b0; WRITE=1'b0; // No op

View File

@ -42,8 +42,11 @@ output [`DATA_INDEX_LIMIT:0] DATA_R1;
output [`DATA_INDEX_LIMIT:0] DATA_R2;
wire [31:0] Q [31:0];
wire [31:0] r_write;
DECODER_5x32 d_write(r_write, ADDR_W);
wire [31:0] r_write_sel, r_write;
DECODER_5x32 d_write(r_write_sel, ADDR_W);
// only write when WRITE=1
and write_active [31:0] (r_write, r_write_sel, WRITE);
REG32 r[31:0] (Q, DATA_W, r_write, CLK, RST);