Commit 6e8b0f65 authored by Gabe Black's avatar Gabe Black

ext: Revamp the systemc SConscripts.

The existing scripts were including pthread code and QT code at the same time, and also insisting on an having a set of architecture specific source files for whatever the current architecture is. This change selects using either QT or pthreads based on the host architecture, distributes accumulating source files, list source files explicitly (to avoid including redundant coroutine libraries) and makes scons insist on an architecture specific QT implementation only if QT is being used. It also defines a preprocessor symbol which tells some headers whether or not pthreads are being used, and also clones the scons environment to avoid leaking flags into the main environment used to compile gem5 itself. If the host architecture isn't supported by systemc, a warning will be printed, and the various build products and SConscript files will be skipped over. Change-Id: I1a40123a11e49e02922a054f093246cf197087bf Reviewed-on: https://gem5-review.googlesource.com/3461Reviewed-by: 's avatarMatthias Jung <jungma@eit.uni-kl.de> Reviewed-by: 's avatarChristian Menard <christian.menard@tu-dresden.de> Reviewed-by: 's avatarJason Lowe-Power <jason@lowepower.com> Maintainer: Jason Lowe-Power <jason@lowepower.com>
parent 7159ea66
......@@ -24,41 +24,60 @@
# Matthias Jung
import os
from m5.util.terminal import get_termcap
Import('main')
systemc = main.Clone()
main.Prepend(CPPPATH=Dir('./src'))
main.Prepend(CPATH=Dir('./src'))
build_root = Dir('.').abspath
src_root = Dir('.').srcdir.abspath
main.Prepend(CXXFLAGS=['-DSC_INCLUDE_FX', '-pthread'])
main.Prepend(CFLAGS=['-DSC_INCLUDE_FX', '-pthread'])
systemc.Prepend(CPPPATH=Dir('./src'))
systemc.Prepend(CPATH=Dir('./src'))
conf = Configure(main)
systemc.Prepend(CXXFLAGS=['-DSC_INCLUDE_FX'])
systemc.Prepend(CFLAGS=['-DSC_INCLUDE_FX'])
if main['PLATFORM'] == 'darwin':
main.Append(LINKFLAGS=['-undefined', 'dynamic_lookup'])
conf = Configure(systemc,
conf_dir = os.path.join(build_root, '.scons_config'),
log_file = os.path.join(build_root, 'scons_config.log'))
if systemc['PLATFORM'] == 'darwin':
systemc.Append(LINKFLAGS=['-undefined', 'dynamic_lookup'])
arch = None
systemc['COROUTINE_LIB'] = ''
if conf.CheckDeclaration('__i386__'):
systemc['COROUTINE_LIB'] = 'qt'
systemc['QT_ARCH'] = 'i386'
arch = 'i386'
elif conf.CheckDeclaration('__x86_64__'):
systemc['COROUTINE_LIB'] = 'qt'
systemc['QT_ARCH'] = 'iX86_64'
arch = 'x86_64'
else:
termcap = get_termcap(GetOption('use_colors'))
print termcap.Yellow + termcap.Bold + \
"Warning: Unrecognized architecture for systemc." + termcap.Normal
s_file = None
if conf.CheckDeclaration("__i386__"):
s_file = 'i386.s'
if conf.CheckDeclaration("__x86_64__"):
s_file = 'iX86_64.s'
conf.Finish()
if s_file is None:
print 'Unsupported CPU architecture!'
Exit(1)
if systemc['COROUTINE_LIB'] == 'pthreads':
systemc.Prepend(CXXFLAGS=['-DSC_USE_PTHREADS'])
systemc_files = []
def SystemCSource(*args):
for arg in args:
systemc_files.append(systemc.File(arg))
systemc_files = Glob('src/sysc/kernel/*.cpp')
systemc_files += ['src/sysc/qt/qt.c', 'src/sysc/qt/md/' + s_file]
systemc_files += Glob('src/sysc/communication/*.cpp')
systemc_files += Glob('src/sysc/tracing/*.cpp')
systemc_files += Glob('src/sysc/utils/*.cpp')
systemc_files += Glob('src/sysc/datatypes/bit/*.cpp')
systemc_files += Glob('src/sysc/datatypes/fx/*.cpp')
systemc_files += Glob('src/sysc/datatypes/int/*.cpp')
systemc_files += Glob('src/sysc/datatypes/misc/*.cpp')
if arch:
for root, dirs, files in os.walk(src_root):
if 'SConscript.sc' in files:
build_dir = os.path.relpath(root, src_root)
systemc.SConscript(os.path.join(root, 'SConscript.sc'),
exports=['systemc', 'SystemCSource'],
variant_dir=os.path.join(build_root, build_dir))
main.Library('libsystemc', systemc_files)
main.SharedLibrary('libsystemc', systemc_files)
systemc.Library('libsystemc', systemc_files)
systemc.SharedLibrary('libsystemc', systemc_files)
# Copyright (c) 2017, TU Dresden
# Copyright (c) 2017, University of Kaiserslautern
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: Christian Menard
# Matthias Jung
Import('systemc', 'SystemCSource')
SystemCSource(
'sc_clock.cpp',
'sc_event_finder.cpp',
'sc_event_queue.cpp',
'sc_export.cpp',
'sc_interface.cpp',
'sc_mutex.cpp',
'sc_port.cpp',
'sc_prim_channel.cpp',
'sc_semaphore.cpp',
'sc_signal.cpp',
'sc_signal_ports.cpp',
'sc_signal_resolved.cpp',
'sc_signal_resolved_ports.cpp',
)
# Copyright (c) 2017, TU Dresden
# Copyright (c) 2017, University of Kaiserslautern
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: Christian Menard
# Matthias Jung
Import('systemc', 'SystemCSource')
SystemCSource(
'sc_bit.cpp',
'sc_bv_base.cpp',
'sc_logic.cpp',
'sc_lv_base.cpp',
)
# Copyright (c) 2017, TU Dresden
# Copyright (c) 2017, University of Kaiserslautern
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: Christian Menard
# Matthias Jung
Import('systemc', 'SystemCSource')
SystemCSource(
'sc_fxcast_switch.cpp',
'sc_fxdefs.cpp',
'sc_fxnum.cpp',
'sc_fxnum_observer.cpp',
'sc_fxtype_params.cpp',
'sc_fxval.cpp',
'sc_fxval_observer.cpp',
'scfx_mant.cpp',
'scfx_pow10.cpp',
'scfx_rep.cpp',
'scfx_utils.cpp',
)
# Copyright (c) 2017, TU Dresden
# Copyright (c) 2017, University of Kaiserslautern
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: Christian Menard
# Matthias Jung
Import('systemc', 'SystemCSource')
SystemCSource(
'sc_int_base.cpp',
'sc_int32_mask.cpp',
'sc_int64_io.cpp',
'sc_int64_mask.cpp',
'sc_length_param.cpp',
'sc_nbdefs.cpp',
'sc_nbexterns.cpp',
'sc_nbutils.cpp',
'sc_signed.cpp',
'sc_uint_base.cpp',
'sc_unsigned.cpp',
)
# Copyright (c) 2017, TU Dresden
# Copyright (c) 2017, University of Kaiserslautern
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: Christian Menard
# Matthias Jung
Import('systemc', 'SystemCSource')
SystemCSource(
'sc_concatref.cpp',
'sc_value_base.cpp',
)
# Copyright (c) 2017, TU Dresden
# Copyright (c) 2017, University of Kaiserslautern
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: Christian Menard
# Matthias Jung
Import('systemc', 'SystemCSource')
SystemCSource(
'sc_attribute.cpp',
'sc_cthread_process.cpp',
'sc_event.cpp',
'sc_except.cpp',
'sc_join.cpp',
'sc_main.cpp',
'sc_main_main.cpp',
'sc_method_process.cpp',
'sc_module.cpp',
'sc_module_name.cpp',
'sc_module_registry.cpp',
'sc_name_gen.cpp',
'sc_object.cpp',
'sc_object_manager.cpp',
'sc_phase_callback_registry.cpp',
'sc_process.cpp',
'sc_reset.cpp',
'sc_sensitive.cpp',
'sc_simcontext.cpp',
'sc_spawn_options.cpp',
'sc_thread_process.cpp',
'sc_time.cpp',
'sc_ver.cpp',
'sc_wait.cpp',
'sc_wait_cthread.cpp',
)
coroutine_lib = systemc['COROUTINE_LIB']
if coroutine_lib == 'qt':
SystemCSource('sc_cor_qt.cpp')
elif coroutine_lib == 'pthreads':
systemc.Append(CXXFLAGS=['-pthread'])
systemc.Append(CFLAGS=['-pthread'])
SystemCSource('sc_cor_pthread.cpp')
elif coroutine_lib == 'fiber':
SystemCSource('sc_cor_fiber.cpp')
else:
print 'Unrecognized threading implementation \'%s\'' % coroutine_lib
Exit(1)
# Copyright (c) 2017, TU Dresden
# Copyright (c) 2017, University of Kaiserslautern
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: Christian Menard
# Matthias Jung
import os
Import('systemc', 'SystemCSource')
if systemc['COROUTINE_LIB'] == 'qt':
SystemCSource('qt.c')
qt_arch = systemc.get('QT_ARCH', None)
if not qt_arch:
print 'No architecture selected for the QT coroutine library.'
Exit(1)
if qt_arch in ('i386', 'iX86_64'):
SystemCSource(os.path.join('md', qt_arch + '.s'))
else:
print 'Don\'t know what to do for QT arch %s.' % qt_arch
Exit(1)
# Copyright (c) 2017, TU Dresden
# Copyright (c) 2017, University of Kaiserslautern
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: Christian Menard
# Matthias Jung
Import('systemc', 'SystemCSource')
SystemCSource(
'sc_trace.cpp',
'sc_trace_file_base.cpp',
'sc_vcd_trace.cpp',
'sc_wif_trace.cpp',
)
# Copyright (c) 2017, TU Dresden
# Copyright (c) 2017, University of Kaiserslautern
# All rights reserved.
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# Authors: Christian Menard
# Matthias Jung
Import('systemc', 'SystemCSource')
SystemCSource(
'sc_hash.cpp',
'sc_list.cpp',
'sc_mempool.cpp',
'sc_pq.cpp',
'sc_report.cpp',
'sc_report_handler.cpp',
'sc_stop_here.cpp',
'sc_string.cpp',
'sc_utils_ids.cpp',
'sc_vector.cpp',
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment