Implement bug 278, comment 1 - better version of EXTS
authorMichael Nolan <mtnolan2640@gmail.com>
Sun, 5 Apr 2020 18:31:48 +0000 (14:31 -0400)
committerMichael Nolan <mtnolan2640@gmail.com>
Sun, 5 Apr 2020 18:31:48 +0000 (14:31 -0400)
src/soc/decoder/helpers.py
src/soc/decoder/isa/caller.py
src/soc/decoder/isa/test_caller.py

index 98b3e672f16158f7dd54286c2a843664f1e7bab0..9cb43b269f568a0df3688e975587523c59e58709 100644 (file)
@@ -11,7 +11,7 @@ def EXTS(value):
     """ extends sign bit out from current MSB to all 256 bits
     """
     assert isinstance(value, SelectableInt)
     """ extends sign bit out from current MSB to all 256 bits
     """
     assert isinstance(value, SelectableInt)
-    return SelectableInt(exts(value.value, value.bits) & ((1 << 256)-1), 256)
+    return exts(value.value, value.bits)
 
 def EXTS64(value):
     """ extends sign bit out from current MSB to 64 bits
 
 def EXTS64(value):
     """ extends sign bit out from current MSB to 64 bits
index 874a06973f3666d63917ce2adcf4a11f4efc4690..5b1c4c997148f30f25cf7af60151cf870c04bcd7 100644 (file)
@@ -110,7 +110,9 @@ class ISACaller:
         for name, output in zip(output_names, results):
             regnum = yield getattr(self.decoder, name)
             print('writing reg %d' % regnum)
         for name, output in zip(output_names, results):
             regnum = yield getattr(self.decoder, name)
             print('writing reg %d' % regnum)
-            self.gpr[regnum] = output.narrow(64)
+            if isinstance(output, int):
+                output = SelectableInt(output, 64)
+            self.gpr[regnum] = output
 
 
 def inject():
 
 
 def inject():
index aa6f23ae90f0fe318d06a99717fc9c48a5780a5c..12db98471e02806cd293c8603f7a2af741536d7a 100644 (file)
@@ -9,7 +9,7 @@ from soc.simulator.program import Program
 from soc.decoder.isa.caller import ISACaller, inject
 from soc.decoder.selectable_int import SelectableInt
 from soc.decoder.orderedset import OrderedSet
 from soc.decoder.isa.caller import ISACaller, inject
 from soc.decoder.selectable_int import SelectableInt
 from soc.decoder.orderedset import OrderedSet
-from soc.decoder.isa import ISA
+from soc.decoder.isa.all import ISA
 
 
 class Register:
 
 
 class Register: