allow small decimal opcodes convert-csv-opcode-to-binary
authorJacob Lifshay <programmerjake@gmail.com>
Thu, 18 Mar 2021 07:16:49 +0000 (00:16 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Thu, 18 Mar 2021 07:16:49 +0000 (00:16 -0700)
src/soc/decoder/power_decoder.py

index 2b52cf5fbc19f156a3020576e0fee59aabee27d5..ace1ae280c6334bc9ca30b17c3da0379ef949d06 100644 (file)
@@ -178,7 +178,9 @@ def parse_opcode(opcode, opint=True):
     if isinstance(opcode, (int, PatternOpcode)):
         return opcode
     assert isinstance(opcode, str)
-    assert opcode.startswith('0b')
+    if len(opcode) > 4 or '-' in opcode:
+        # all binary numbers must start with 0b
+        assert opcode.startswith('0b')
     if '-' not in opcode:
         opcode = int(opcode, 0)
     else: