Skip to content

Commit 9d72556

Browse files
authored
Merge pull request #12 from GabPGomes/main
Bug Fix: Correct ALU operation for signed numbers.
2 parents 25db8fd + e6641ba commit 9d72556

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

rtl/core/alu.sv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ always_comb begin : ALU_LOGIC
3636
EQUAL: ALU_RD_o = (ALU_RS1_i == ALU_RS2_i) ? 32'h1 : 32'h0;
3737

3838
// Comparações
39-
SLT: ALU_RD_o = (ALU_RS1_i < ALU_RS2_i) ? 32'h1 : 32'h0;
39+
SLT: ALU_RD_o = ($signed(ALU_RS1_i) < $signed(ALU_RS2_i)) ? 32'h1 : 32'h0;
4040
SLT_U: ALU_RD_o = ($unsigned(ALU_RS1_i) < $unsigned(ALU_RS2_i)) ? 32'h1 : 32'h0;
41-
GREATER_EQUAL: ALU_RD_o = (ALU_RS1_i >= ALU_RS2_i) ? 32'h1 : 32'h0;
41+
GREATER_EQUAL: ALU_RD_o = ($signed(ALU_RS1_i) >= $signed(ALU_RS2_i)) ? 32'h1 : 32'h0;
4242
GREATER_EQUAL_U: ALU_RD_o = ($unsigned(ALU_RS1_i) >= $unsigned(ALU_RS2_i)) ? 32'h1 : 32'h0;
4343

4444
// Shifts

0 commit comments

Comments
 (0)