aboutsummaryrefslogtreecommitdiff
path: root/chisel_utils.py
diff options
context:
space:
mode:
authorTim Hutt <timothy.hutt@codasip.com>2024-10-29 21:49:07 +0000
committerTim Hutt <timothy.hutt@codasip.com>2024-10-31 11:42:41 +0000
commit284a5fa0f79ae5415d6ab2009193d3bead64d2aa (patch)
treed14a4037534bcba684a97c8d8987415fcc0fb0d3 /chisel_utils.py
parentbd5e598abfa066178ab1b0d581a579c913ccfda9 (diff)
downloadriscv-opcodes-284a5fa0f79ae5415d6ab2009193d3bead64d2aa.zip
riscv-opcodes-284a5fa0f79ae5415d6ab2009193d3bead64d2aa.tar.gz
riscv-opcodes-284a5fa0f79ae5415d6ab2009193d3bead64d2aa.tar.bz2
Add static type hints
This makes the code easier to understand and navigate, and also detected a few of bugs: 1. Missing brackets on e.upper. (Fixed) 2. Not strictly related to types, but a lot of the regexes were not raw strings and therefore contained invalid escape sequences. Python prints a warning about these in recent versions. (Fixed) 3. Expression in `process_pseudo_instructions()` that is always false. (Not fixed) 4. Missing definition of `log_and_exit()`. (Fixed) This is validated via pre-commit in CI.
Diffstat (limited to 'chisel_utils.py')
-rw-r--r--chisel_utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/chisel_utils.py b/chisel_utils.py
index 0943584..9916b76 100644
--- a/chisel_utils.py
+++ b/chisel_utils.py
@@ -10,7 +10,7 @@ pp = pprint.PrettyPrinter(indent=2)
logging.basicConfig(level=logging.INFO, format="%(levelname)s:: %(message)s")
-def make_chisel(instr_dict, spinal_hdl=False):
+def make_chisel(instr_dict: InstrDict, spinal_hdl: bool = False):
chisel_names = ""
cause_names_str = ""
@@ -31,7 +31,7 @@ def make_chisel(instr_dict, spinal_hdl=False):
elif "rv_" in e:
e_format = e.replace("rv_", "").upper()
else:
- e_format = e.upper
+ e_format = e.upper()
chisel_names += f' val {e_format+"Type"} = Map(\n'
for instr in e_instrs:
tmp_instr_name = '"' + instr.upper().replace(".", "_") + '"'