diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-11-09 09:25:48 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-11-09 09:25:48 -0600 |
| commit | 5d798386c3b1c1dc45a2fbc382c9367ccc27c524 (patch) | |
| tree | a04fff74505af30c8044f80f523fd887331e6234 /rtl/core/regs/regs.sv | |
| parent | 65590be80332d132d7037bfe3bb19e5d6e5bcd7b (diff) | |
Implement reset
Diffstat (limited to 'rtl/core/regs/regs.sv')
| -rw-r--r-- | rtl/core/regs/regs.sv | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/rtl/core/regs/regs.sv b/rtl/core/regs/regs.sv index 9cf7033..f9cecad 100644 --- a/rtl/core/regs/regs.sv +++ b/rtl/core/regs/regs.sv @@ -3,6 +3,8 @@ module core_regs ( input logic clk, + rst_n, + input reg_num rd_r_a, rd_r_b, wr_r, @@ -53,16 +55,15 @@ module core_regs .index(wr_index) ); - always_ff @(posedge clk) begin - if(wr_enable) - wr_current <= wr_value; - - branch <= wr_enable && wr_pc; - end + always_ff @(posedge clk or negedge rst_n) + if(!rst_n) begin + branch <= 0; + wr_current <= 0; + end else begin + if(wr_enable) + wr_current <= wr_value; - initial begin - branch = 0; - wr_current = 0; - end + branch <= wr_enable && wr_pc; + end endmodule |
