check for div_overflow equal to None rather than == 1
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 10 Jul 2020 15:04:08 +0000 (16:04 +0100)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 10 Jul 2020 15:04:08 +0000 (16:04 +0100)
src/soc/decoder/isa/caller.py

index bf78fb19cf778e9054970bb566f17bb3b39217bd..711c9650788a03e2b22a8528694014ff7006ad3f 100644 (file)
@@ -419,13 +419,13 @@ class ISACaller:
             inputs.append(SelectableInt(imm, 64))
         assert len(outputs) >= 1
         print ("handle_overflow", inputs, outputs, div_overflow)
             inputs.append(SelectableInt(imm, 64))
         assert len(outputs) >= 1
         print ("handle_overflow", inputs, outputs, div_overflow)
-        if len(inputs) < 2 and div_overflow != 1:
+        if len(inputs) < 2 and div_overflow is None:
             return
 
         # div overflow is different: it's returned by the pseudo-code
         # because it's more complex than can be done by analysing the output
             return
 
         # div overflow is different: it's returned by the pseudo-code
         # because it's more complex than can be done by analysing the output
-        if div_overflow == 1:
-            ov, ov32 = 1, 1
+        if div_overflow is not None:
+            ov, ov32 = div_overflow, div_overflow
         # arithmetic overflow can be done by analysing the input and output
         elif len(inputs) >= 2:
             output = outputs[0]
         # arithmetic overflow can be done by analysing the input and output
         elif len(inputs) >= 2:
             output = outputs[0]