From c1ac6bcedbb6cf08db95f4c794e127e64b74fe39 Mon Sep 17 00:00:00 2001 From: Michael Nolan Date: Tue, 19 May 2020 11:05:41 -0400 Subject: [PATCH] Handle carry in caller.py --- src/soc/decoder/isa/caller.py | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/soc/decoder/isa/caller.py b/src/soc/decoder/isa/caller.py index 35ea2197..85bd96bc 100644 --- a/src/soc/decoder/isa/caller.py +++ b/src/soc/decoder/isa/caller.py @@ -239,17 +239,19 @@ class ISACaller: self.namespace['XER'] = self.spr['XER'] self.namespace['CA'] = self.spr['XER'][XER_bits['CA']].value - def handle_carry(self, inputs, outputs): - inv_a = yield self.dec2.invert_a + def handle_carry_(self, inputs, outputs): + inv_a = yield self.dec2.e.invert_a if inv_a: inputs[0] = ~inputs[0] assert len(outputs) >= 1 output = outputs[0] gts = [(x > output) == SelectableInt(1, 1) for x in inputs] print(gts) - if all(gts): - return True - return False + if any(gts): + cy = True + else: + cy = False + self.spr['XER'][XER_bits['CA']] = cy def handle_comparison(self, outputs): out = outputs[0] @@ -296,11 +298,11 @@ class ISACaller: results = info.func(self, *inputs) print(results) - carry_en = yield self.dec2.e.rc.data - if carry_en: - cy = self.handle_carry(inputs, results) - + rc_en = yield self.dec2.e.rc.data + if rc_en: self.handle_comparison(results) + carry_en = yield self.dec2.e.output_carry + yield from self.handle_carry_(inputs, results) # any modified return results? if info.write_regs: -- 2.30.2