Skip to content

Commit 59822e7

Browse files
instr_scan.sv: remove useless condition (#2748)
is_rvc is redundant with riscv::OpcodeC1, riscv::OpcodeC2 Signed-off-by: André Sintzoff <[email protected]> Co-authored-by: JeanRochCoulon <[email protected]>
1 parent be5ac20 commit 59822e7

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

core/frontend/instr_scan.sv

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,8 @@ module instr_scan #(
6969
};
7070
endfunction
7171

72-
logic is_rvc;
73-
assign is_rvc = (instr_i[1:0] != 2'b11);
74-
7572
logic rv32_rvc_jal;
76-
assign rv32_rvc_jal = (CVA6Cfg.XLEN == 32) & ((instr_i[15:13] == riscv::OpcodeC1Jal) & is_rvc & (instr_i[1:0] == riscv::OpcodeC1));
73+
assign rv32_rvc_jal = (CVA6Cfg.XLEN == 32) & ((instr_i[15:13] == riscv::OpcodeC1Jal) & (instr_i[1:0] == riscv::OpcodeC1));
7774

7875
logic is_xret;
7976
assign is_xret = logic'(instr_i[31:30] == 2'b00) & logic'(instr_i[28:0] == 29'b10000001000000000000001110011);
@@ -90,22 +87,20 @@ module instr_scan #(
9087
assign rvi_jump_o = logic'(instr_i[6:0] == riscv::OpcodeJal) | is_xret;
9188

9289
// opcode JAL
93-
assign rvc_jump_o = ((instr_i[15:13] == riscv::OpcodeC1J) & is_rvc & (instr_i[1:0] == riscv::OpcodeC1)) | rv32_rvc_jal;
90+
assign rvc_jump_o = ((instr_i[15:13] == riscv::OpcodeC1J) & (instr_i[1:0] == riscv::OpcodeC1)) | rv32_rvc_jal;
9491

9592
// always links to register 0
9693
logic is_jal_r;
9794
assign is_jal_r = (instr_i[15:13] == riscv::OpcodeC2JalrMvAdd)
9895
& (instr_i[6:2] == 5'b00000)
99-
& (instr_i[1:0] == riscv::OpcodeC2)
100-
& is_rvc;
96+
& (instr_i[1:0] == riscv::OpcodeC2);
10197
assign rvc_jr_o = is_jal_r & ~instr_i[12];
10298
// always links to register 1 e.g.: it is a jump
10399
assign rvc_jalr_o = is_jal_r & instr_i[12];
104100
assign rvc_call_o = rvc_jalr_o | rv32_rvc_jal;
105101

106102
assign rvc_branch_o = ((instr_i[15:13] == riscv::OpcodeC1Beqz) | (instr_i[15:13] == riscv::OpcodeC1Bnez))
107-
& (instr_i[1:0] == riscv::OpcodeC1)
108-
& is_rvc;
103+
& (instr_i[1:0] == riscv::OpcodeC1);
109104
// check that rs1 is x1 or x5
110105
assign rvc_return_o = ((instr_i[11:7] == 5'd1) | (instr_i[11:7] == 5'd5)) & rvc_jr_o;
111106

0 commit comments

Comments
 (0)