From: Luke Kenneth Casson Leighton Date: Thu, 2 Apr 2020 15:53:05 +0000 (+0100) Subject: use Ops in pagereader X-Git-Tag: div_pipeline~1564 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=44364c17dfbb440fd12d9945418ad9ec1dfc38a4;p=soc.git use Ops in pagereader --- 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)