bug in carry32 handling in OP_CMP
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 2 Sep 2020 14:13:22 +0000 (15:13 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Wed, 2 Sep 2020 14:13:22 +0000 (15:13 +0100)
src/soc/fu/alu/main_stage.py

index f2e751d6965e58a0872a5956a61a1f43de06e5fa..7f98c344535ea6665262afb2f71fb4e8e4f0f18c 100644 (file)
@@ -100,7 +100,7 @@ class ALUMainStage(PipeModBase):
 
                 # this is supposed to be inverted (b-a, not a-b)
                 comb += a_n.eq(~a) # sigh a gets inverted
-                comb += carry_32.eq(add_o[33] ^ a_n[32] ^ b[32])
+                comb += carry_32.eq(add_o[33] ^ a[32] ^ b[32])
                 comb += carry_64.eq(add_o[65])
 
                 comb += zerolo.eq(~((a_n[0:32] ^ b[0:32]).bool()))