From: Luke Kenneth Casson Leighton Date: Fri, 23 Apr 2021 13:25:40 +0000 (+0100) Subject: sort out imports created by pywriter X-Git-Tag: 0.0.1~36 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8deb49efabfdbc515e454bdb307135265301b3ef;p=openpower-isa.git sort out imports created by pywriter --- diff --git a/Makefile b/Makefile index 04db8f2d..d4091c3d 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ PYTHON3 ?= "python3" -.PHONY: help Makefile gitupdate svanalysis test htmlupload pypiuload +.PHONY: help Makefile gitupdate svanalysis test htmlupload pypiuload pywriter gitupdate: git submodule init @@ -9,6 +9,10 @@ gitupdate: svanalysis: python3 openpower/sv_analysis.py +# now installed as a command (/usr/local/bin/pywriter) by setup.py +pywriter: + pywriter + develop: python3 setup.py develop # yes, develop, not install diff --git a/src/openpower/decoder/pseudo/pywriter.py b/src/openpower/decoder/pseudo/pywriter.py index 355d8ae5..7f3a2148 100644 --- a/src/openpower/decoder/pseudo/pywriter.py +++ b/src/openpower/decoder/pseudo/pywriter.py @@ -19,14 +19,14 @@ def get_isasrc_dir(): header = """\ # auto-generated by pywriter.py, do not edit or commit -from soc.decoder.isa.caller import inject, instruction_info -from soc.decoder.helpers import (EXTS, EXTS64, EXTZ64, ROTL64, ROTL32, MASK, - ne, eq, gt, ge, lt, le, ltu, gtu, length, +from openpower.decoder.isa.caller import inject, instruction_info +from openpower.decoder.helpers import (EXTS, EXTS64, EXTZ64, ROTL64, ROTL32, + MASK, ne, eq, gt, ge, lt, le, ltu, gtu, length, trunc_divs, trunc_rems, MULS, DIVS, MODS, EXTS128, undefined) -from soc.decoder.selectable_int import SelectableInt -from soc.decoder.selectable_int import selectconcat as concat -from soc.decoder.orderedset import OrderedSet +from openpower.decoder.selectable_int import SelectableInt +from openpower.decoder.selectable_int import selectconcat as concat +from openpower.decoder.orderedset import OrderedSet class %s: @@ -47,7 +47,7 @@ class PyISAWriter(ISA): def write_pysource(self, pagename): self.pages_written.append(pagename) - instrs = isa.page[pagename] + instrs = self.page[pagename] isadir = get_isasrc_dir() fname = os.path.join(isadir, "%s.py" % pagename) with open(fname, "w") as f: @@ -116,7 +116,8 @@ class PyISAWriter(ISA): f.write('# auto-generated by pywriter.py: do not edit or commit\n') f.write('from soc.decoder.isa.caller import ISACaller\n') for page in self.pages_written: - f.write('from soc.decoder.isa.%s import %s\n' % (page, page)) + f.write('from openpower.decoder.isa.%s ' \ + 'import %s\n' % (page, page)) f.write('\n') classes = ', '.join(['ISACaller'] + self.pages_written)