Skip to content

Commit

Permalink
a workaround for LB=0
Browse files Browse the repository at this point in the history
  • Loading branch information
uhit332 committed Oct 20, 2023
1 parent 9376f9d commit bedcc28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions rtl/serv_bufreg.v
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ module qerv_bufreg #(
//Data
input wire [BITS_PER_CYCLE-1:0] i_rs1,
input wire [BITS_PER_CYCLE-1:0] i_imm,
input wire [LB-1:0] i_shift_counter_lsb,
// i_shift_counter_lsb[LB] must be zero to support the case LB=0
input wire [LB:0] i_shift_counter_lsb,
output wire [BITS_PER_CYCLE-1:0] o_q,
//External
output wire [31:0] o_dbus_adr,
Expand All @@ -38,8 +39,8 @@ module qerv_bufreg #(
reg [1:0] lsb;
wire [LB:0] shift_counter_rev = BITS_PER_CYCLE - i_shift_counter_lsb;

wire [LB-1:0] shift_amount = i_shift_op ? (
i_right_shift_op ? (i_shift_counter_lsb == 2'b00 ? 2'b00 : (shift_counter_rev[LB-1:0])) : i_shift_counter_lsb
wire [LB:0] shift_amount = i_shift_op ? (
i_right_shift_op ? (i_shift_counter_lsb == 00 ? 0 : (shift_counter_rev[LB:0])) : i_shift_counter_lsb
) : 0;

wire clr_lsb = i_cnt0 & i_clr_lsb;
Expand Down
2 changes: 1 addition & 1 deletion rtl/serv_top.v
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ module qerv_top
//Data
.i_rs1 (rs1),
.i_imm (imm),
.i_shift_counter_lsb(shift_counter_lsb[1:0]),
.i_shift_counter_lsb({1'b0, shift_counter_lsb[1:0]}),
.o_q (bufreg_q),
//External
.o_dbus_adr (o_dbus_adr),
Expand Down

0 comments on commit bedcc28

Please sign in to comment.