Skip to content

Commit 92ae281

Browse files
author
Pasquale Davide Schiavone
committed
Implemented beqimm and bneimm
1 parent 01f21f7 commit 92ae281

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

alu.sv

-5
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,6 @@ module riscv_alu
396396
endcase
397397
end
398398

399-
logic cmp_eqall;
400-
401-
assign cmp_eqall = (operand_a_i == 32'hFFFF_FFFF);
402-
403399
// generate comparison result
404400
logic [3:0] cmp_result;
405401

@@ -417,7 +413,6 @@ module riscv_alu
417413
ALU_SLETS,
418414
ALU_SLETU,
419415
ALU_LES, ALU_LEU: cmp_result = ~is_greater;
420-
ALU_EQALL: cmp_result = {4{cmp_eqall}};
421416

422417
default: ;
423418
endcase

decoder.sv

+12-2
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,18 @@ module riscv_decoder
239239
3'b101: alu_operator_o = ALU_GES;
240240
3'b110: alu_operator_o = ALU_LTU;
241241
3'b111: alu_operator_o = ALU_GEU;
242-
3'b010: alu_operator_o = ALU_EQALL;
243-
242+
3'b010: begin
243+
alu_operator_o = ALU_EQ;
244+
regb_used_o = 1'b0;
245+
alu_op_b_mux_sel_o = OP_B_IMM;
246+
imm_b_mux_sel_o = IMMB_BI;
247+
end
248+
3'b011: begin
249+
alu_operator_o = ALU_NE;
250+
regb_used_o = 1'b0;
251+
alu_op_b_mux_sel_o = OP_B_IMM;
252+
imm_b_mux_sel_o = IMMB_BI;
253+
end
244254
default: begin
245255
illegal_insn_o = 1'b1;
246256
end

id_stage.sv

+3
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ module riscv_id_stage
235235
logic [31:0] imm_uj_type;
236236
logic [31:0] imm_z_type;
237237
logic [31:0] imm_s2_type;
238+
logic [31:0] imm_bi_type;
238239
logic [31:0] imm_s3_type;
239240
logic [31:0] imm_vs_type;
240241
logic [31:0] imm_vu_type;
@@ -371,6 +372,7 @@ module riscv_id_stage
371372
assign imm_z_type = { 27'b0, instr[`REG_S1] };
372373

373374
assign imm_s2_type = { 27'b0, instr[24:20] };
375+
assign imm_bi_type = { {27{instr[24]}}, instr[24:20] };
374376
assign imm_s3_type = { 27'b0, instr[29:25] };
375377
assign imm_vs_type = { {26 {instr[24]}}, instr[24:20], instr[25] };
376378
assign imm_vu_type = { 26'b0, instr[24:20], instr[25] };
@@ -567,6 +569,7 @@ module riscv_id_stage
567569
IMMB_U: imm_b = imm_u_type;
568570
IMMB_PCINCR: imm_b = (is_compressed_i && (~data_misaligned_i)) ? 32'h2 : 32'h4;
569571
IMMB_S2: imm_b = imm_s2_type;
572+
IMMB_BI: imm_b = imm_bi_type;
570573
IMMB_S3: imm_b = imm_s3_type;
571574
IMMB_VS: imm_b = imm_vs_type;
572575
IMMB_VU: imm_b = imm_vu_type;

include/riscv_defines.sv

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ parameter ALU_GES = 6'b001010;
120120
parameter ALU_GEU = 6'b001011;
121121
parameter ALU_EQ = 6'b001100;
122122
parameter ALU_NE = 6'b001101;
123-
parameter ALU_EQALL = 6'b001110;
124123

125124
// Set Lower Than operations
126125
parameter ALU_SLTS = 6'b000010;
@@ -236,6 +235,7 @@ parameter IMMB_VS = 4'b0110;
236235
parameter IMMB_VU = 4'b0111;
237236
parameter IMMB_SHUF = 4'b1000;
238237
parameter IMMB_CLIP = 4'b1001;
238+
parameter IMMB_BI = 4'b1011;
239239

240240
// bit mask selection
241241
parameter BMASK_A_ZERO = 1'b0;

0 commit comments

Comments
 (0)