Skip to content

Commit f6116cf

Browse files
committed
Make right-shifts one cycle faster
This allows removing the stage_two_req register as well.
1 parent 629e672 commit f6116cf

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

rtl/serv_bufreg2.v

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ module serv_bufreg2
55
input wire i_en,
66
input wire i_init,
77
input wire i_cnt7,
8+
input wire i_cnt_done,
9+
input wire i_sh_right,
810
input wire [1:0] i_lsb,
911
input wire [1:0] i_bytecnt,
1012
output wire o_sh_done,
@@ -42,7 +44,7 @@ module serv_bufreg2
4244

4345
wire shift_en = i_shift_op ? (i_en & i_init & (i_bytecnt == 2'b00)) : (i_en & byte_valid);
4446

45-
wire cnt_en = (i_shift_op & !i_init);
47+
wire cnt_en = (i_shift_op & (!i_init | (i_cnt_done & i_sh_right)));
4648

4749
/* The dat register has three different use cases for store, load and
4850
shift operations.

rtl/serv_state.v

+2-7
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ module serv_state
5959
input wire i_rf_ready,
6060
output wire o_rf_rd_en);
6161

62-
reg stage_two_req;
6362
reg init_done;
6463
wire misalign_trap_sync;
6564

@@ -101,7 +100,7 @@ module serv_state
101100
//Right shift. o_sh_done
102101
//Mem ops. i_dbus_ack
103102
//MDU ops. i_mdu_ready
104-
assign o_rf_wreq = (i_shift_op & (i_sh_right ? (i_sh_done & !o_cnt_en & init_done) : last_init)) |
103+
assign o_rf_wreq = (i_shift_op & (i_sh_right ? (i_sh_done & (last_init | !o_cnt_en & init_done)) : last_init)) |
105104
i_dbus_ack | (MDU & i_mdu_ready) |
106105
(i_branch_op & (last_init & !trap_pending)) |
107106
(i_rd_alu_en & i_alu_rd_sel1 & last_init);
@@ -126,7 +125,7 @@ module serv_state
126125
for the first cycle after init). Shift out during phase 2
127126
*/
128127

129-
assign o_bufreg_en = (o_cnt_en & (o_init | ((o_ctrl_trap | i_branch_op) & i_two_stage_op))) | (i_shift_op & init_done & (i_sh_right ? !stage_two_req : i_sh_done));
128+
assign o_bufreg_en = (o_cnt_en & (o_init | ((o_ctrl_trap | i_branch_op) & i_two_stage_op))) | (i_shift_op & init_done & (i_sh_right | i_sh_done));
130129

131130
assign o_ibus_cyc = ibus_cyc & !i_rst;
132131

@@ -152,14 +151,10 @@ module serv_state
152151
o_ctrl_jump <= o_init & take_branch;
153152
end
154153

155-
//Need a strobe for the first cycle in the IDLE state after INIT
156-
stage_two_req <= o_cnt_done & o_init;
157-
158154
if (i_rst) begin
159155
if (RESET_STRATEGY != "NONE") begin
160156
init_done <= 1'b0;
161157
o_ctrl_jump <= 1'b0;
162-
stage_two_req <= 1'b0;
163158
end
164159
end
165160
end

rtl/serv_top.v

+2
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,8 @@ module serv_top
400400
.i_en (cnt_en),
401401
.i_init (init),
402402
.i_cnt7 (cnt7),
403+
.i_cnt_done (cnt_done),
404+
.i_sh_right (sh_right),
403405
.i_lsb (lsb),
404406
.i_bytecnt (mem_bytecnt),
405407
.o_sh_done (sh_done),

0 commit comments

Comments
 (0)