force opcode field to be always specified in binary for opint=True CSVs
authorJacob Lifshay <programmerjake@gmail.com>
Thu, 18 Mar 2021 02:45:39 +0000 (19:45 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Thu, 18 Mar 2021 02:48:40 +0000 (19:48 -0700)
src/soc/decoder/power_decoder.py

index 239541424497c6cc95014f4fa46ff2d2c975065e..79dd79518be18a680315091e4230eaac1cf3438c 100644 (file)
@@ -382,8 +382,12 @@ class PowerDecoder(Elaboratable):
                 eq += seqs
                 for row in d.opcodes:
                     opcode = row['opcode']
-                    if d.opint and '-' not in opcode:
-                        opcode = int(opcode, 0)
+                    if d.opint:
+                        assert opcode.startswith('0b')
+                        if '-' not in opcode:
+                            opcode = int(opcode, 0)
+                        else:
+                            opcode = opcode[2:]
                     if not row['unit']:
                         continue
                     if self.row_subsetfn: