From 44364c17dfbb440fd12d9945418ad9ec1dfc38a4 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Thu, 2 Apr 2020 16:53:05 +0100 Subject: [PATCH] use Ops in pagereader --- src/soc/decoder/isa/__init__.py | 0 src/soc/decoder/pseudo/pagereader.py | 14 +++++++------- 2 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 src/soc/decoder/isa/__init__.py diff --git a/src/soc/decoder/isa/__init__.py b/src/soc/decoder/isa/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/src/soc/decoder/pseudo/pagereader.py b/src/soc/decoder/pseudo/pagereader.py index 9914a815..61b7838f 100644 --- a/src/soc/decoder/pseudo/pagereader.py +++ b/src/soc/decoder/pseudo/pagereader.py @@ -49,7 +49,7 @@ from copy import copy import os opfields = ("desc", "form", "opcode", "regs", "pcode", "sregs", "page") -op = namedtuple("Ops", opfields) +Ops = namedtuple("Ops", opfields) def get_isa_dir(): @@ -78,7 +78,7 @@ class ISA: lines = f.readlines() # set up dict with current page name - d = {'pagename': pagename} + d = {'page': pagename} l = lines.pop(0).rstrip() # get first line while lines: @@ -154,7 +154,7 @@ class ISA: op = copy(d) op['regs'] = regs op['opcode'] = opcode - self.instr[opcode] = op + self.instr[opcode] = Ops(**op) # create list of instructions by form form = op['form'] @@ -163,11 +163,11 @@ class ISA: def pprint_ops(self): for k, v in self.instr.items(): - print ("# %s %s" % (v['opcode'], v['desc'])) - print ("Form: %s Regs: %s" % (v['form'], v['regs'])) - print ('\n'.join(map(lambda x: " %s" % x, v['pcode']))) + print ("# %s %s" % (v.opcode, v.desc)) + print ("Form: %s Regs: %s" % (v.form, v.regs)) + print ('\n'.join(map(lambda x: " %s" % x, v.pcode))) print ("Specials") - print ('\n'.join(map(lambda x: " %s" % x, v['sregs']))) + print ('\n'.join(map(lambda x: " %s" % x, v.sregs))) print () for k, v in isa.forms.items(): print (k, v) -- 2.30.2