diff options
| author | Alejandro Soto <alejandro@34project.org> | 2022-11-07 17:20:38 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2022-11-07 17:25:11 -0600 |
| commit | cc7ed6bd05b8143ed4250caf97798c8bbfc6b748 (patch) | |
| tree | 4fef961873f1a52020ee2cb7c49b59c3fc842c10 /rtl/core/control/select.sv | |
| parent | 280cb5bb42f56d13ae2043b955a7bf286022b0b7 (diff) | |
Rework regfile in order to remove negedge trigger
Diffstat (limited to 'rtl/core/control/select.sv')
| -rw-r--r-- | rtl/core/control/select.sv | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/rtl/core/control/select.sv b/rtl/core/control/select.sv index cedf3cf..3c0ec6c 100644 --- a/rtl/core/control/select.sv +++ b/rtl/core/control/select.sv @@ -22,36 +22,44 @@ module core_control_select output psr_mode reg_mode ); - reg_num r_shift; + reg_num r_shift, last_ra, last_rb; assign reg_mode = `MODE_SVC; //TODO - always_ff @(posedge clk) + always_comb begin + ra = last_ra; + rb = last_rb; + unique case(next_cycle) ISSUE: if(issue) begin - ra <= dec_data.rn; - rb <= dec_snd.r; - r_shift <= dec_snd.r_shift; + ra = dec_data.rn; + rb = dec_snd.r; end - RD_INDIRECT_SHIFT: - rb <= r_shift; - TRANSFER: if(cycle != TRANSFER || mem_ready) // final_rd viene de dec_ldst.rd - rb <= pop_valid ? popped : final_rd; + rb = pop_valid ? popped : final_rd; MUL_ACC_LD: begin - ra <= mul_r_add_hi; - rb <= mul_r_add_lo; + ra = mul_r_add_hi; + rb = mul_r_add_lo; end endcase + end + + always_ff @(posedge clk) begin + last_ra <= ra; + last_rb <= rb; + + if(next_cycle == ISSUE && issue) + r_shift <= dec_snd.r_shift; + end initial begin - ra = {$bits(ra){1'b0}}; - rb = {$bits(rb){1'b0}}; + last_ra = {$bits(ra){1'b0}}; + last_rb = {$bits(rb){1'b0}}; r_shift = {$bits(r_shift){1'b0}}; end |
