add carry handling to pia_res_to_output
authorJacob Lifshay <programmerjake@gmail.com>
Fri, 9 Oct 2020 03:23:17 +0000 (20:23 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Fri, 9 Oct 2020 03:23:17 +0000 (20:23 -0700)
src/soc/fu/test/pia.py

index b51ab7db7ad2a26d487dca0ac6b548798b26d10e..0cb51661c23779a28ec813936bb232d74a4a014e 100644 (file)
@@ -30,4 +30,14 @@ def pia_res_to_output(pia_res):
     else:
         retval["xer_ov"] = 0
         retval["xer_so"] = 0
+    if pia_res.carry is not None:
+        carry = pia_res.carry
+        v = 0
+        if carry.ca:
+            v |= 1
+        if carry.ca32:
+            v |= 2
+        retval["xer_ca"] = v
+    else:
+        retval["xer_ca"] = 0
     return retval