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 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35277 Reviewed-by: Gabe Black <gabeblack@google.com> Maintainer: Gabe Black <gabeblack@google.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -105,15 +105,17 @@ SCons.Tool.SourceFileScanner.add_scanner('.cc.inc', SCons.Tool.CScanner)
|
||||
# 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 @@ def ISADesc(desc, decoder_splits=1, exec_splits=1):
|
||||
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
|
||||
|
||||
|
||||
26
src/arch/isa_parser/__init__.py
Normal file
26
src/arch/isa_parser/__init__.py
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user