success using SelectableInt in cnttzd test
[soc.git] / src / soc / decoder / helpers.py
index 4c595ca9653af82d4e802f8292774c34dfbc0204..941bcbc8f46bc9f263aeef0596061879b2df390c 100644 (file)
@@ -1,4 +1,5 @@
 import unittest
+from soc.decoder.selectable_int import SelectableInt
 
 
 def exts(value, bits):
@@ -7,11 +8,15 @@ def exts(value, bits):
 
 
 def EXTS64(value):
-    return exts(value, 32) & ((1 << 64)-1)
+    if isinstance(value, SelectableInt):
+        value = value.value
+    return SelectableInt(exts(value, 32) & ((1 << 64)-1), 64)
 
 
 def EXTZ64(value):
-    return value & ((1<<32)-1)
+    if isinstance(value, SelectableInt):
+        value = value.value
+    return SelectableInt(value & ((1<<32)-1), 64)
 
 def rotl(value, bits, wordlen):
     mask = (1 << wordlen) - 1