From 8deb49efabfdbc515e454bdb307135265301b3ef Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 23 Apr 2021 14:25:40 +0100 Subject: [PATCH] sort out imports created by pywriter --- Makefile | 6 +++++- src/openpower/decoder/pseudo/pywriter.py | 17 +++++++++-------- 2 files changed, 14 insertions(+), 9 deletions(-) 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) -- 2.30.2