Gabe Black has uploaded this change for review. (
https://gem5-review.googlesource.com/c/public/gem5/+/13536
Change subject: systemc: Remove the USE_SYSTEMC scons option.
......................................................................
systemc: Remove the USE_SYSTEMC scons option.
Always include the systemc support to keep it from being accidentally
broken.
Change-Id: I82346740e9f7fde93a08c66630d422bbec94d902
---
D src/systemc/SConsopts
M src/systemc/channel/SConscript
M src/systemc/core/SConscript
M src/systemc/dt/SConscript
M src/systemc/dt/bit/SConscript
M src/systemc/dt/fx/SConscript
M src/systemc/dt/int/SConscript
M src/systemc/dt/misc/SConscript
M src/systemc/tests/SConscript
M src/systemc/tests/verify.py
M src/systemc/utils/SConscript
11 files changed, 192 insertions(+), 236 deletions(-)
diff --git a/src/systemc/SConsopts b/src/systemc/SConsopts
deleted file mode 100644
index fc0abb2..0000000
--- a/src/systemc/SConsopts
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2018 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.
-#
-# Authors: Gabe Black
-
-Import('*')
-
-sticky_vars.AddVariables(
- BoolVariable('USE_SYSTEMC', 'Enable SystemC API support', True)
- )
-
-export_vars.append('USE_SYSTEMC')
diff --git a/src/systemc/channel/SConscript b/src/systemc/channel/SConscript
index 30ae76a..f735f1a 100644
--- a/src/systemc/channel/SConscript
+++ b/src/systemc/channel/SConscript
@@ -27,14 +27,13 @@
Import('*')
-if env['USE_SYSTEMC']:
- Source('messages.cc')
- Source('sc_clock.cc')
- Source('sc_event_queue.cc')
- Source('sc_in_resolved.cc')
- Source('sc_inout_resolved.cc')
- Source('sc_out_resolved.cc')
- Source('sc_mutex.cc')
- Source('sc_semaphore.cc')
- Source('sc_signal.cc')
- Source('sc_signal_resolved.cc')
+Source('messages.cc')
+Source('sc_clock.cc')
+Source('sc_event_queue.cc')
+Source('sc_in_resolved.cc')
+Source('sc_inout_resolved.cc')
+Source('sc_out_resolved.cc')
+Source('sc_mutex.cc')
+Source('sc_semaphore.cc')
+Source('sc_signal.cc')
+Source('sc_signal_resolved.cc')
diff --git a/src/systemc/core/SConscript b/src/systemc/core/SConscript
index 1f5498b..47e2cb7 100644
--- a/src/systemc/core/SConscript
+++ b/src/systemc/core/SConscript
@@ -27,36 +27,35 @@
Import('*')
-if env['USE_SYSTEMC']:
- SimObject('SystemC.py')
+SimObject('SystemC.py')
- Source('channel.cc')
- Source('event.cc')
- Source('kernel.cc')
- Source('messages.cc')
- Source('module.cc')
- Source('object.cc')
- Source('port.cc')
- Source('process.cc')
- Source('python.cc')
- Source('scheduler.cc')
- Source('sched_event.cc')
- Source('sensitivity.cc')
- Source('time.cc')
+Source('channel.cc')
+Source('event.cc')
+Source('kernel.cc')
+Source('messages.cc')
+Source('module.cc')
+Source('object.cc')
+Source('port.cc')
+Source('process.cc')
+Source('python.cc')
+Source('scheduler.cc')
+Source('sched_event.cc')
+Source('sensitivity.cc')
+Source('time.cc')
- Source('sc_attr.cc')
- Source('sc_event.cc')
- Source('sc_export.cc')
- Source('sc_interface.cc')
- Source('sc_join.cc')
- Source('sc_main.cc')
- Source('sc_module.cc')
- Source('sc_module_name.cc')
- Source('sc_object.cc')
- Source('sc_port.cc')
- Source('sc_process_handle.cc')
- Source('sc_prim.cc')
- Source('sc_sensitive.cc')
- Source('sc_simcontext.cc')
- Source('sc_spawn.cc')
- Source('sc_time.cc')
+Source('sc_attr.cc')
+Source('sc_event.cc')
+Source('sc_export.cc')
+Source('sc_interface.cc')
+Source('sc_join.cc')
+Source('sc_main.cc')
+Source('sc_module.cc')
+Source('sc_module_name.cc')
+Source('sc_object.cc')
+Source('sc_port.cc')
+Source('sc_process_handle.cc')
+Source('sc_prim.cc')
+Source('sc_sensitive.cc')
+Source('sc_simcontext.cc')
+Source('sc_spawn.cc')
+Source('sc_time.cc')
diff --git a/src/systemc/dt/SConscript b/src/systemc/dt/SConscript
index 2580875..9e412e4 100644
--- a/src/systemc/dt/SConscript
+++ b/src/systemc/dt/SConscript
@@ -27,5 +27,4 @@
Import('*')
-if env['USE_SYSTEMC']:
- Source('sc_mempool.cc')
+Source('sc_mempool.cc')
diff --git a/src/systemc/dt/bit/SConscript b/src/systemc/dt/bit/SConscript
index e44a9d8..28298df 100644
--- a/src/systemc/dt/bit/SConscript
+++ b/src/systemc/dt/bit/SConscript
@@ -27,9 +27,8 @@
Import('*')
-if env['USE_SYSTEMC']:
- Source('messages.cc')
- Source('sc_bit.cc')
- Source('sc_bv_base.cc')
- Source('sc_logic.cc')
- Source('sc_lv_base.cc')
+Source('messages.cc')
+Source('sc_bit.cc')
+Source('sc_bv_base.cc')
+Source('sc_logic.cc')
+Source('sc_lv_base.cc')
diff --git a/src/systemc/dt/fx/SConscript b/src/systemc/dt/fx/SConscript
index 824e47d..5ca41bf 100644
--- a/src/systemc/dt/fx/SConscript
+++ b/src/systemc/dt/fx/SConscript
@@ -27,16 +27,15 @@
Import('*')
-if env['USE_SYSTEMC']:
- Source('messages.cc')
- Source('sc_fxcast_switch.cc')
- Source('sc_fxdefs.cc')
- Source('scfx_mant.cc')
- Source('sc_fxnum.cc')
- Source('sc_fxnum_observer.cc')
- Source('scfx_pow10.cc')
- Source('scfx_rep.cc')
- Source('sc_fxtype_params.cc')
- Source('scfx_utils.cc')
- Source('sc_fxval.cc')
- Source('sc_fxval_observer.cc')
+Source('messages.cc')
+Source('sc_fxcast_switch.cc')
+Source('sc_fxdefs.cc')
+Source('scfx_mant.cc')
+Source('sc_fxnum.cc')
+Source('sc_fxnum_observer.cc')
+Source('scfx_pow10.cc')
+Source('scfx_rep.cc')
+Source('sc_fxtype_params.cc')
+Source('scfx_utils.cc')
+Source('sc_fxval.cc')
+Source('sc_fxval_observer.cc')
diff --git a/src/systemc/dt/int/SConscript b/src/systemc/dt/int/SConscript
index 3721c2f..cd7cc6c 100644
--- a/src/systemc/dt/int/SConscript
+++ b/src/systemc/dt/int/SConscript
@@ -27,13 +27,12 @@
Import('*')
-if env['USE_SYSTEMC']:
- Source('messages.cc')
- Source('sc_int_base.cc')
- Source('sc_int_mask.cc')
- Source('sc_length_param.cc')
- Source('sc_nbexterns.cc')
- Source('sc_nbutils.cc')
- Source('sc_signed.cc')
- Source('sc_uint_base.cc')
- Source('sc_unsigned.cc')
+Source('messages.cc')
+Source('sc_int_base.cc')
+Source('sc_int_mask.cc')
+Source('sc_length_param.cc')
+Source('sc_nbexterns.cc')
+Source('sc_nbutils.cc')
+Source('sc_signed.cc')
+Source('sc_uint_base.cc')
+Source('sc_unsigned.cc')
diff --git a/src/systemc/dt/misc/SConscript b/src/systemc/dt/misc/SConscript
index 6f6d819..a100966 100644
--- a/src/systemc/dt/misc/SConscript
+++ b/src/systemc/dt/misc/SConscript
@@ -27,6 +27,5 @@
Import('*')
-if env['USE_SYSTEMC']:
- Source('sc_concatref.cc')
- Source('sc_value_base.cc')
+Source('sc_concatref.cc')
+Source('sc_value_base.cc')
diff --git a/src/systemc/tests/SConscript b/src/systemc/tests/SConscript
index 74ec0e0..b822cba 100644
--- a/src/systemc/tests/SConscript
+++ b/src/systemc/tests/SConscript
@@ -29,145 +29,143 @@
Import('*')
-if env['USE_SYSTEMC']:
+from gem5_scons import Transform
- from gem5_scons import Transform
+import os.path
+import json
- import os.path
- import json
+src = str(Dir('.').srcdir)
- src = str(Dir('.').srcdir)
+class SystemCTest(object):
+ def __init__(self, dirname, name):
+ self.name = name
+ self.reldir = os.path.relpath(dirname, src)
+ self.target = os.path.join(self.reldir, name)
+ self.sources = []
- class SystemCTest(object):
- def __init__(self, dirname, name):
- self.name = name
- self.reldir = os.path.relpath(dirname, src)
- self.target = os.path.join(self.reldir, name)
- self.sources = []
+ self.compile_only = False
- self.compile_only = False
+ def add_source(self, source):
+ self.sources.append(os.path.join(self.reldir, source))
- def add_source(self, source):
- self.sources.append(os.path.join(self.reldir, source))
+ def add_sources(self, sources):
+ for source in sources:
+ self.sources.append(os.path.join(self.reldir, '..', source))
- def add_sources(self, sources):
- for source in sources:
- self.sources.append(os.path.join(self.reldir, '..',
source))
+ def properties(self):
+ return {
+ 'name' : self.name,
+ 'path' : self.reldir,
+ 'compile_only' : self.compile_only
+ }
- def properties(self):
- return {
- 'name' : self.name,
- 'path' : self.reldir,
- 'compile_only' : self.compile_only
- }
+ext_dir = Dir('..').Dir('ext')
+test_dir = Dir('.')
+class SystemCTestBin(Executable):
+ def __init__(self, test):
+ super(SystemCTestBin, self).__init__(test.target, *test.sources)
- ext_dir = Dir('..').Dir('ext')
- test_dir = Dir('.')
- class SystemCTestBin(Executable):
- def __init__(self, test):
- super(SystemCTestBin, self).__init__(test.target,
*test.sources)
+ @classmethod
+ def declare_all(cls, env):
+ env = env.Clone()
- @classmethod
- def declare_all(cls, env):
- env = env.Clone()
+ # Turn off extra warnings and Werror for the tests.
+ to_remove = ['-Wall', '-Wundef', '-Wextra', '-Werror']
+ env['CCFLAGS'] = \
+ filter(lambda f: f not in to_remove, env['CCFLAGS'])
- # Turn off extra warnings and Werror for the tests.
- to_remove = ['-Wall', '-Wundef', '-Wextra', '-Werror']
- env['CCFLAGS'] = \
- filter(lambda f: f not in to_remove, env['CCFLAGS'])
+ env.Append(CPPPATH=test_dir.Dir('include'))
+ env.Append(CPPPATH=ext_dir)
- env.Append(CPPPATH=test_dir.Dir('include'))
- env.Append(CPPPATH=ext_dir)
+ shared_lib_path = env['SHARED_LIB'][0].abspath
+ sl_dir, sl_base = os.path.split(shared_lib_path)
+ env.Append(LIBPATH=[sl_dir], LIBS=[sl_base])
- shared_lib_path = env['SHARED_LIB'][0].abspath
- sl_dir, sl_base = os.path.split(shared_lib_path)
- env.Append(LIBPATH=[sl_dir], LIBS=[sl_base])
+ super(SystemCTestBin, cls).declare_all(env)
- super(SystemCTestBin, cls).declare_all(env)
+ def declare(self, env):
+ env = env.Clone()
+ sources = list(self.sources)
+ for f in self.filters:
+ sources = Source.all.apply_filter(f)
+ objs = self.srcs_to_objs(env, sources)
+ objs = objs + env['MAIN_OBJS']
+ relpath = os.path.relpath(
+ env['SHARED_LIB'][0].dir.abspath,
+ self.path(env).dir.abspath)
+ env.Append(LINKFLAGS=Split('-z origin'))
+ env.Append(RPATH=env.Literal(os.path.join('\\$$ORIGIN', relpath)))
+ return super(SystemCTestBin, self).declare(env, objs)
- def declare(self, env):
- env = env.Clone()
- sources = list(self.sources)
- for f in self.filters:
- sources = Source.all.apply_filter(f)
- objs = self.srcs_to_objs(env, sources)
- objs = objs + env['MAIN_OBJS']
- relpath = os.path.relpath(
- env['SHARED_LIB'][0].dir.abspath,
- self.path(env).dir.abspath)
- env.Append(LINKFLAGS=Split('-z origin'))
- env.Append(RPATH=env.Literal(os.path.join('\\$$ORIGIN',
relpath)))
- return super(SystemCTestBin, self).declare(env, objs)
-
- tests = []
- def new_test(dirname, name):
- test = SystemCTest(dirname, name)
- tests.append(test)
- return test
+tests = []
+def new_test(dirname, name):
+ test = SystemCTest(dirname, name)
+ tests.append(test)
+ return test
- def scan_dir_for_tests(subdir):
- def visitor(arg, dirname, names):
- # If there's a 'DONTRUN' file in this directory, skip it and
any
- # child directories.
- if 'DONTRUN' in names:
- del names[:]
+def scan_dir_for_tests(subdir):
+ def visitor(arg, dirname, names):
+ # If there's a 'DONTRUN' file in this directory, skip it and any
+ # child directories.
+ if 'DONTRUN' in names:
+ del names[:]
+ return
+
+ endswith = lambda sfx: filter(lambda n: n.endswith(sfx), names)
+
+ cpps = endswith('.cpp')
+ if not cpps:
+ return
+
+ # If there's only one source file, then that files name is the test
+ # name, and it's the source for that test.
+ if len(cpps) == 1:
+ cpp = cpps[0]
+
+ test = new_test(dirname, os.path.splitext(cpp)[0])
+ test.add_source(cpp)
+
+ # Otherwise, expect there to be a file that ends in .f. That files
+ # name is the test name, and it will list the source files with
+ # one preceeding path component.
+ else:
+ fs = endswith('.f')
+ if len(fs) != 1:
+ print("In %s, expected 1 *.f file, but found %d.",
+ dirname, len(fs))
+ for f in fs:
+ print(os.path.join(dirname, f))
return
+ f = fs[0]
- endswith = lambda sfx: filter(lambda n: n.endswith(sfx), names)
+ test = new_test(dirname, os.path.splitext(f)[0])
+ with open(os.path.join(dirname, f)) as content:
+ lines = content.readlines
+ # Get rid of leading and trailing whitespace.
+ lines = map(lambda x: x.strip(), content.readlines())
+ # Get rid of blank lines.
+ lines = filter(lambda x: x, lines)
+ # Add all the sources to this test.
+ test.add_sources(lines)
- cpps = endswith('.cpp')
- if not cpps:
- return
+ if 'COMPILE' in names:
+ test.compile_only = True
- # If there's only one source file, then that files name is the
test
- # name, and it's the source for that test.
- if len(cpps) == 1:
- cpp = cpps[0]
+ subdir_src = Dir('.').srcdir.Dir(subdir)
+ os.path.walk(str(subdir_src), visitor, None)
- test = new_test(dirname, os.path.splitext(cpp)[0])
- test.add_source(cpp)
-
- # Otherwise, expect there to be a file that ends in .f. That
files
- # name is the test name, and it will list the source files with
- # one preceeding path component.
- else:
- fs = endswith('.f')
- if len(fs) != 1:
- print("In %s, expected 1 *.f file, but found %d.",
- dirname, len(fs))
- for f in fs:
- print(os.path.join(dirname, f))
- return
- f = fs[0]
-
- test = new_test(dirname, os.path.splitext(f)[0])
- with open(os.path.join(dirname, f)) as content:
- lines = content.readlines
- # Get rid of leading and trailing whitespace.
- lines = map(lambda x: x.strip(), content.readlines())
- # Get rid of blank lines.
- lines = filter(lambda x: x, lines)
- # Add all the sources to this test.
- test.add_sources(lines)
-
- if 'COMPILE' in names:
- test.compile_only = True
-
- subdir_src = Dir('.').srcdir.Dir(subdir)
- os.path.walk(str(subdir_src), visitor, None)
-
- scan_dir_for_tests('systemc')
+scan_dir_for_tests('systemc')
- def build_tests_json(target, source, env):
- data = { test.target : test.properties() for test in tests }
- with open(str(target[0]), "w") as tests_json:
- json.dump(data, tests_json)
+def build_tests_json(target, source, env):
+ data = { test.target : test.properties() for test in tests }
+ with open(str(target[0]), "w") as tests_json:
+ json.dump(data, tests_json)
- AlwaysBuild(env.Command(File('tests.json'), None,
- MakeAction(build_tests_json, Transform("TESTJSON"))))
+AlwaysBuild(env.Command(File('tests.json'), None,
+ MakeAction(build_tests_json, Transform("TESTJSON"))))
- for test in tests:
- SystemCTestBin(test)
+for test in tests:
+ SystemCTestBin(test)
diff --git a/src/systemc/tests/verify.py b/src/systemc/tests/verify.py
index 87c5d12..b9fef5c 100755
--- a/src/systemc/tests/verify.py
+++ b/src/systemc/tests/verify.py
@@ -131,7 +131,7 @@
if args.j == 0:
self.args = ('-j', str(self.main_args.j)) + self.args
- scons_args = [ 'USE_SYSTEMC=1' ] + list(self.args) + targets
+ scons_args = list(self.args) + targets
scons(*scons_args)
class RunPhase(TestPhaseBase):
diff --git a/src/systemc/utils/SConscript b/src/systemc/utils/SConscript
index eae586f..fe5e03d 100644
--- a/src/systemc/utils/SConscript
+++ b/src/systemc/utils/SConscript
@@ -27,13 +27,12 @@
Import('*')
-if env['USE_SYSTEMC']:
- Source('functions.cc')
- Source('messages.cc')
- Source('report.cc')
- Source('sc_report.cc')
- Source('sc_report_handler.cc')
- Source('sc_trace_file.cc')
- Source('sc_vector.cc')
- Source('tracefile.cc')
- Source('vcd.cc')
+Source('functions.cc')
+Source('messages.cc')
+Source('report.cc')
+Source('sc_report.cc')
+Source('sc_report_handler.cc')
+Source('sc_trace_file.cc')
+Source('sc_vector.cc')
+Source('tracefile.cc')
+Source('vcd.cc')
--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/13536
To unsubscribe, or for help writing mail filters, visit
https://gem5-review.googlesource.com/settings
Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I82346740e9f7fde93a08c66630d422bbec94d902
Gerrit-Change-Number: 13536
Gerrit-PatchSet: 1
Gerrit-Owner: Gabe Black <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev