SConscript revision 10130
12929Sktlim@umich.edu# -*- mode:python -*- 22929Sktlim@umich.edu 32932Sktlim@umich.edu# Copyright (c) 2013 ARM Limited 42929Sktlim@umich.edu# All rights reserved. 52929Sktlim@umich.edu# 62929Sktlim@umich.edu# The license below extends only to copyright in the software and shall 72929Sktlim@umich.edu# not be construed as granting a license to any other intellectual 82929Sktlim@umich.edu# property including but not limited to intellectual property relating 92929Sktlim@umich.edu# to a hardware implementation of the functionality of the software 102929Sktlim@umich.edu# licensed hereunder. You may use the software subject to the license 112929Sktlim@umich.edu# terms below provided that you ensure that this notice is replicated 122929Sktlim@umich.edu# unmodified and in its entirety in all distributions of the software, 132929Sktlim@umich.edu# modified or unmodified, in source code or in binary form. 142929Sktlim@umich.edu# 152929Sktlim@umich.edu# Redistribution and use in source and binary forms, with or without 162929Sktlim@umich.edu# modification, are permitted provided that the following conditions are 172929Sktlim@umich.edu# met: redistributions of source code must retain the above copyright 182929Sktlim@umich.edu# notice, this list of conditions and the following disclaimer; 192929Sktlim@umich.edu# redistributions in binary form must reproduce the above copyright 202929Sktlim@umich.edu# notice, this list of conditions and the following disclaimer in the 212929Sktlim@umich.edu# documentation and/or other materials provided with the distribution; 222929Sktlim@umich.edu# neither the name of the copyright holders nor the names of its 232929Sktlim@umich.edu# contributors may be used to endorse or promote products derived from 242929Sktlim@umich.edu# this software without specific prior written permission. 252929Sktlim@umich.edu# 262929Sktlim@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 272929Sktlim@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 282932Sktlim@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 292932Sktlim@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 302932Sktlim@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 312929Sktlim@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 326007Ssteve.reinhardt@amd.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 337735SAli.Saidi@ARM.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 342929Sktlim@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 352929Sktlim@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 362929Sktlim@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 372929Sktlim@umich.edu# 382929Sktlim@umich.edu# Authors: Andreas Hansson 392929Sktlim@umich.edu 402929Sktlim@umich.eduimport os 412929Sktlim@umich.edu 422929Sktlim@umich.eduImport('main') 432929Sktlim@umich.edu 442929Sktlim@umich.edu# See if we got a cloned DRAMSim2 repo as a subdirectory and set the 452929Sktlim@umich.edu# HAVE_DRAMSIM flag accordingly 462929Sktlim@umich.eduif not os.path.exists(Dir('.').srcnode().abspath + '/DRAMSim2'): 476007Ssteve.reinhardt@amd.com main['HAVE_DRAMSIM'] = False 486007Ssteve.reinhardt@amd.com Return() 496007Ssteve.reinhardt@amd.com 506007Ssteve.reinhardt@amd.com# We have got the folder, so add the library and build the wrappers 516007Ssteve.reinhardt@amd.commain['HAVE_DRAMSIM'] = True 526007Ssteve.reinhardt@amd.com 536007Ssteve.reinhardt@amd.com# Add the appropriate files. We leave out the trace driven simulator 546007Ssteve.reinhardt@amd.comdram_files = [] 556007Ssteve.reinhardt@amd.com 566007Ssteve.reinhardt@amd.comdef DRAMFile(filename): 576007Ssteve.reinhardt@amd.com dram_files.append(File('DRAMSim2/' + filename)) 586007Ssteve.reinhardt@amd.com 596007Ssteve.reinhardt@amd.comDRAMFile('AddressMapping.cpp') 606007Ssteve.reinhardt@amd.comDRAMFile('Bank.cpp') 616007Ssteve.reinhardt@amd.comDRAMFile('BankState.cpp') 626007Ssteve.reinhardt@amd.comDRAMFile('BusPacket.cpp') 636007Ssteve.reinhardt@amd.comDRAMFile('ClockDomain.cpp') 646007Ssteve.reinhardt@amd.comDRAMFile('CommandQueue.cpp') 656007Ssteve.reinhardt@amd.comDRAMFile('IniReader.cpp') 666007Ssteve.reinhardt@amd.comDRAMFile('MemoryController.cpp') 676007Ssteve.reinhardt@amd.comDRAMFile('MemorySystem.cpp') 686007Ssteve.reinhardt@amd.comDRAMFile('MultiChannelMemorySystem.cpp') 696007Ssteve.reinhardt@amd.comDRAMFile('Rank.cpp') 706007Ssteve.reinhardt@amd.comDRAMFile('SimulatorObject.cpp') 716007Ssteve.reinhardt@amd.comDRAMFile('Transaction.cpp') 726007Ssteve.reinhardt@amd.com 736007Ssteve.reinhardt@amd.com# DRAMSim2 violates some of the warning flags used by gem5, so 746007Ssteve.reinhardt@amd.com# we explicitly disable them here 756007Ssteve.reinhardt@amd.comdramenv = main.Clone() 762929Sktlim@umich.edudramenv.Append(CCFLAGS=['-Wno-unused-value']) 772929Sktlim@umich.edu 782929Sktlim@umich.edu# If we are using clang, there are more flags to disable 796007Ssteve.reinhardt@amd.comif main['CLANG']: 806007Ssteve.reinhardt@amd.com dramenv.Append(CCFLAGS=['-Wno-unused-private-field']) 816007Ssteve.reinhardt@amd.com 826007Ssteve.reinhardt@amd.com# Tell DRAMSim2 to not store any data as this is already covered by 836007Ssteve.reinhardt@amd.com# the wrapper 846007Ssteve.reinhardt@amd.comdramenv.Append(CCFLAGS=['-DNO_STORAGE']) 852929Sktlim@umich.edu 862929Sktlim@umich.edudramenv.Library('dramsim2', [dramenv.SharedObject(f) for f in dram_files]) 872929Sktlim@umich.edu 882929Sktlim@umich.edumain.Prepend(CPPPATH=Dir('.')) 892929Sktlim@umich.edumain.Append(LIBS=['dramsim2']) 906011Ssteve.reinhardt@amd.commain.Prepend(LIBPATH=[Dir('.')]) 916007Ssteve.reinhardt@amd.com