From: Jacob Lifshay Date: Thu, 18 Mar 2021 07:16:49 +0000 (-0700) Subject: allow small decimal opcodes X-Git-Tag: convert-csv-opcode-to-binary X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3600675075bae0f9b2895f78efdfd7b2cb046597;p=soc.git allow small decimal opcodes --- diff --git a/src/soc/decoder/power_decoder.py b/src/soc/decoder/power_decoder.py index 2b52cf5f..ace1ae28 100644 --- a/src/soc/decoder/power_decoder.py +++ b/src/soc/decoder/power_decoder.py @@ -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: