Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/35277 )
Change subject: arch: Move the ISA parser into a package.
......................................................................
arch: Move the ISA parser into a package.
This will make splitting the parser into components easier, since it
will keep help keep everything together and organized.
Change-Id: I737641e124b6da8b1b18a49de9110c8424d8cc4f
---
M src/arch/SConscript
A src/arch/isa_parser/__init__.py
R src/arch/isa_parser/isa_parser.py
3 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/src/arch/SConscript b/src/arch/SConscript
index 12e605f..5fb543e 100644
--- a/src/arch/SConscript
+++ b/src/arch/SConscript
@@ -105,15 +105,17 @@
# output from the ISA description (*.isa) files.
#
-parser_py = File('isa_parser.py')
+parser_files = Glob('isa_parser/*.py')
micro_asm_py = File('micro_asm.py')
# import ply here because SCons screws with sys.path when performing
actions.
import ply
+arch_dir = Dir('.')
+
def run_parser(target, source, env):
# Add the current directory to the system path so we can import files.
- sys.path[0:0] = [ parser_py.dir.abspath ]
+ sys.path[0:0] = [ arch_dir.abspath ]
import isa_parser
parser = isa_parser.ISAParser(target[0].dir.abspath)
@@ -207,7 +209,7 @@
source_gen('generic_cpu_exec_%d.cc' % i)
# Actually create the builder.
- sources = [desc, parser_py, micro_asm_py]
+ sources = [desc, micro_asm_py] + parser_files
IsaDescBuilder(target=gen, source=sources, env=env)
return gen
diff --git a/src/arch/isa_parser/__init__.py
b/src/arch/isa_parser/__init__.py
new file mode 100644
index 0000000..02f4999
--- /dev/null
+++ b/src/arch/isa_parser/__init__.py
@@ -0,0 +1,26 @@
+# Copyright 2020 Google, Inc.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met: redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer;
+# redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution;
+# neither the name of the copyright holders nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+from .isa_parser import ISAParser
diff --git a/src/arch/isa_parser.py b/src/arch/isa_parser/isa_parser.py
similarity index 100%
rename from src/arch/isa_parser.py
rename to src/arch/isa_parser/isa_parser.py
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/35277
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I737641e124b6da8b1b18a49de9110c8424d8cc4f
Gerrit-Change-Number: 35277
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s