From: Luke Kenneth Casson Leighton Date: Thu, 2 Apr 2020 15:47:00 +0000 (+0100) Subject: add pagename to list X-Git-Tag: div_pipeline~1565 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=39ac3ecc7f7c9aa3cbfe45cf0f0cbcb865d4c9f0;p=soc.git add pagename to list --- diff --git a/src/soc/decoder/pseudo/pagereader.py b/src/soc/decoder/pseudo/pagereader.py index a9582481..9914a815 100644 --- a/src/soc/decoder/pseudo/pagereader.py +++ b/src/soc/decoder/pseudo/pagereader.py @@ -41,15 +41,16 @@ this translates to: Special Registers Altered: 4-space-indented register description blank - blank (optional) - + blank(s) (optional for convenience at end-of-page) """ from collections import namedtuple, OrderedDict from copy import copy import os -op = namedtuple("Ops", ("desc", "form", "opcode", "regs", "pcode", "sregs")) +opfields = ("desc", "form", "opcode", "regs", "pcode", "sregs", "page") +op = namedtuple("Ops", opfields) + def get_isa_dir(): fdir = os.path.abspath(os.path.dirname(__file__)) @@ -59,6 +60,7 @@ def get_isa_dir(): fdir = os.path.split(fdir)[0] return os.path.join(fdir, "libreriscv", "openpower", "isa") + class ISA: def __init__(self): @@ -70,11 +72,14 @@ class ISA: self.read_file(pth) def read_file(self, fname): + pagename = fname.split('.')[0] fname = os.path.join(get_isa_dir(), fname) with open(fname) as f: lines = f.readlines() - d = {} + # set up dict with current page name + d = {'pagename': pagename} + l = lines.pop(0).rstrip() # get first line while lines: print (l)