From: Luke Kenneth Casson Leighton Date: Thu, 2 Apr 2020 14:57:19 +0000 (+0100) Subject: read all files from openpower/isa directory successfully X-Git-Tag: div_pipeline~1569 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=acdabaeed40cc5a0efe87771bd89cb0d7dfff550;p=soc.git read all files from openpower/isa directory successfully --- diff --git a/libreriscv b/libreriscv index b93437fe..03177977 160000 --- a/libreriscv +++ b/libreriscv @@ -1 +1 @@ -Subproject commit b93437fe4b0db7e3d9d066445c9528dc236dc4ed +Subproject commit 03177977f70255421290a59caa3db84658e7f3e5 diff --git a/src/soc/decoder/pseudo/pagereader.py b/src/soc/decoder/pseudo/pagereader.py index 14d6f823..39836b01 100644 --- a/src/soc/decoder/pseudo/pagereader.py +++ b/src/soc/decoder/pseudo/pagereader.py @@ -5,19 +5,21 @@ import os op = namedtuple("Ops", ("desc", "form", "opcode", "regs", "pcode", "sregs")) +def get_isa_dir(): + fdir = os.path.abspath(os.path.dirname(__file__)) + fdir = os.path.split(fdir)[0] + fdir = os.path.split(fdir)[0] + fdir = os.path.split(fdir)[0] + fdir = os.path.split(fdir)[0] + return os.path.join(fdir, "libreriscv", "openpower", "isa") + class ISA: def __init__(self): self.instr = OrderedDict() def read_file(self, fname): - fdir = os.path.abspath(os.path.dirname(__file__)) - fdir = os.path.split(fdir)[0] - fdir = os.path.split(fdir)[0] - fdir = os.path.split(fdir)[0] - fdir = os.path.split(fdir)[0] - print (fdir) - fname = os.path.join(fdir, "libreriscv", "openpower", "isa", fname) + fname = os.path.join(get_isa_dir(), fname) with open(fname) as f: lines = f.readlines() @@ -74,7 +76,7 @@ class ISA: # get special regs li = [] - while True: + while lines: l = lines.pop(0).rstrip() if len(l) == 0: break assert l.startswith(' '), ("4spcs not found in line %s" % l) @@ -106,5 +108,9 @@ class ISA: if __name__ == '__main__': isa = ISA() - isa.read_file("fixedlogical.mdwn") + for pth in os.listdir(os.path.join(get_isa_dir())): + print (get_isa_dir(), pth) + assert pth.endswith(".mdwn"), "only %s in isa dir" % pth + isa.read_file(pth) + isa.pprint_ops()