rubytest-ruby.py revision 7526:4bb5f5207617
12207SN/A# Copyright (c) 2006-2007 The Regents of The University of Michigan 25254Sksewell@umich.edu# Copyright (c) 2009 Advanced Micro Devices, Inc. 35254Sksewell@umich.edu# All rights reserved. 42207SN/A# 55254Sksewell@umich.edu# Redistribution and use in source and binary forms, with or without 65254Sksewell@umich.edu# modification, are permitted provided that the following conditions are 75254Sksewell@umich.edu# met: redistributions of source code must retain the above copyright 85254Sksewell@umich.edu# notice, this list of conditions and the following disclaimer; 95254Sksewell@umich.edu# redistributions in binary form must reproduce the above copyright 105254Sksewell@umich.edu# notice, this list of conditions and the following disclaimer in the 115254Sksewell@umich.edu# documentation and/or other materials provided with the distribution; 125254Sksewell@umich.edu# neither the name of the copyright holders nor the names of its 135254Sksewell@umich.edu# contributors may be used to endorse or promote products derived from 145254Sksewell@umich.edu# this software without specific prior written permission. 152207SN/A# 165254Sksewell@umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 175254Sksewell@umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 185254Sksewell@umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 195254Sksewell@umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 205254Sksewell@umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 215254Sksewell@umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 225254Sksewell@umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 235254Sksewell@umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 245254Sksewell@umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 255254Sksewell@umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 265254Sksewell@umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 272665Ssaidi@eecs.umich.edu# 285254Sksewell@umich.edu# Authors: Ron Dreslinski 295254Sksewell@umich.edu# Brad Beckmann 305254Sksewell@umich.edu 312207SN/Aimport m5 322207SN/Afrom m5.objects import * 332474SN/Afrom m5.defines import buildEnv 342207SN/Afrom m5.util import addToPath 358229Snate@binkert.orgimport os, optparse, sys 362454SN/A 372454SN/Aif buildEnv['FULL_SYSTEM']: 382680Sktlim@umich.edu panic("This script requires system-emulation mode (*_SE).") 398232Snate@binkert.org 406650Sksewell@umich.edu# Get paths we might need. It's expected this file is in m5/configs/example. 416650Sksewell@umich.educonfig_path = os.path.dirname(os.path.abspath(__file__)) 426650Sksewell@umich.educonfig_root = os.path.dirname(config_path) 432474SN/Am5_root = os.path.dirname(config_root) 442207SN/AaddToPath(config_root+'/configs/common') 452447SN/AaddToPath(config_root+'/configs/ruby') 462474SN/AaddToPath(config_root+'/configs/ruby/protocols') 472447SN/AaddToPath(config_root+'/configs/ruby/topologies') 485154Sgblack@eecs.umich.edu 495154Sgblack@eecs.umich.eduimport Ruby 505154Sgblack@eecs.umich.edu 512474SN/Aparser = optparse.OptionParser() 522686Sksewell@umich.edu 532686Sksewell@umich.edu# 542935Sksewell@umich.edu# Set the default cache size and associativity to be very small to encourage 552474SN/A# races between requests and writebacks. 562474SN/A# 572474SN/Aparser.add_option("--l1d_size", type="string", default="256B") 582474SN/Aparser.add_option("--l1i_size", type="string", default="256B") 592686Sksewell@umich.eduparser.add_option("--l2_size", type="string", default="512B") 602686Sksewell@umich.eduparser.add_option("--l1d_assoc", type="int", default=2) 612686Sksewell@umich.eduparser.add_option("--l1i_assoc", type="int", default=2) 622686Sksewell@umich.eduparser.add_option("--l2_assoc", type="int", default=2) 636811SMatt DeVuyst 646811SMatt DeVuystexecfile(os.path.join(config_root, "configs/common", "Options.py")) 652474SN/A 662474SN/A(options, args) = parser.parse_args() 672474SN/A 687532Ssteve.reinhardt@amd.com# 692474SN/A# create the tester and system, including ruby 707532Ssteve.reinhardt@amd.com# 716650Sksewell@umich.edutester = RubyTester(checks_to_complete = 100, wakeup_frequency = 10) 726811SMatt DeVuyst 732474SN/Asystem = System(tester = tester, physmem = PhysicalMemory()) 745958Sgblack@eecs.umich.edu 756811SMatt DeVuystsystem.ruby = Ruby.create_system(options, system.physmem) 766650Sksewell@umich.edu 776811SMatt DeVuystassert(options.num_cpus == len(system.ruby.cpu_ruby_ports)) 786650Sksewell@umich.edu 796811SMatt DeVuyst# 806811SMatt DeVuyst# The tester is most effective when randomization is turned on and 816650Sksewell@umich.edu# artifical delay is randomly inserted on messages 826650Sksewell@umich.edu# 836650Sksewell@umich.edusystem.ruby.randomization = True 846811SMatt DeVuyst 856811SMatt DeVuystfor ruby_port in system.ruby.cpu_ruby_ports: 866811SMatt DeVuyst # 876811SMatt DeVuyst # Tie the ruby tester ports to the ruby cpu ports 886811SMatt DeVuyst # 896811SMatt DeVuyst tester.cpuPort = ruby_port.port 906811SMatt DeVuyst 916811SMatt DeVuyst # 926811SMatt DeVuyst # Tell the sequencer this is the ruby tester so that it 936811SMatt DeVuyst # copies the subblock back to the checker 946811SMatt DeVuyst # 956811SMatt DeVuyst ruby_port.using_ruby_tester = True 966811SMatt DeVuyst 976811SMatt DeVuyst# ----------------------- 986811SMatt DeVuyst# run simulation 996811SMatt DeVuyst# ----------------------- 1006811SMatt DeVuyst 1016811SMatt DeVuystroot = Root( system = system ) 1026811SMatt DeVuystroot.system.mem_mode = 'timing' 1036811SMatt DeVuyst 1046811SMatt DeVuyst# Not much point in this being higher than the L1 latency 1056811SMatt DeVuystm5.ticks.setGlobalFrequency('1ns') 1066811SMatt DeVuyst