rubytest-ruby.py revision 6928
14997Sgblack@eecs.umich.edu# Copyright (c) 2006-2007 The Regents of The University of Michigan 24997Sgblack@eecs.umich.edu# Copyright (c) 2009 Advanced Micro Devices, Inc. 34997Sgblack@eecs.umich.edu# All rights reserved. 44997Sgblack@eecs.umich.edu# 54997Sgblack@eecs.umich.edu# Redistribution and use in source and binary forms, with or without 64997Sgblack@eecs.umich.edu# modification, are permitted provided that the following conditions are 74997Sgblack@eecs.umich.edu# met: redistributions of source code must retain the above copyright 84997Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer; 94997Sgblack@eecs.umich.edu# redistributions in binary form must reproduce the above copyright 104997Sgblack@eecs.umich.edu# notice, this list of conditions and the following disclaimer in the 114997Sgblack@eecs.umich.edu# documentation and/or other materials provided with the distribution; 124997Sgblack@eecs.umich.edu# neither the name of the copyright holders nor the names of its 134997Sgblack@eecs.umich.edu# contributors may be used to endorse or promote products derived from 144997Sgblack@eecs.umich.edu# this software without specific prior written permission. 154997Sgblack@eecs.umich.edu# 164997Sgblack@eecs.umich.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 174997Sgblack@eecs.umich.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 184997Sgblack@eecs.umich.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 194997Sgblack@eecs.umich.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 204997Sgblack@eecs.umich.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 214997Sgblack@eecs.umich.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 224997Sgblack@eecs.umich.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 234997Sgblack@eecs.umich.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 244997Sgblack@eecs.umich.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 254997Sgblack@eecs.umich.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 264997Sgblack@eecs.umich.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 274997Sgblack@eecs.umich.edu# 284997Sgblack@eecs.umich.edu# Authors: Ron Dreslinski 294997Sgblack@eecs.umich.edu# Brad Beckmann 304997Sgblack@eecs.umich.edu 314997Sgblack@eecs.umich.eduimport m5 324997Sgblack@eecs.umich.edufrom m5.objects import * 334997Sgblack@eecs.umich.edufrom m5.defines import buildEnv 344997Sgblack@eecs.umich.edufrom m5.util import addToPath 354997Sgblack@eecs.umich.eduimport os, optparse, sys 364997Sgblack@eecs.umich.edu 374997Sgblack@eecs.umich.eduif buildEnv['FULL_SYSTEM']: 384997Sgblack@eecs.umich.edu panic("This script requires system-emulation mode (*_SE).") 394997Sgblack@eecs.umich.edu 404997Sgblack@eecs.umich.edu# Get paths we might need. It's expected this file is in m5/configs/example. 414997Sgblack@eecs.umich.educonfig_path = os.path.dirname(os.path.abspath(__file__)) 424997Sgblack@eecs.umich.educonfig_root = os.path.dirname(config_path) 434997Sgblack@eecs.umich.edum5_root = os.path.dirname(config_root) 444997Sgblack@eecs.umich.eduaddToPath(config_root+'/configs/common') 454997Sgblack@eecs.umich.eduaddToPath(config_root+'/configs/ruby') 464997Sgblack@eecs.umich.edu 474997Sgblack@eecs.umich.eduimport Ruby 484997Sgblack@eecs.umich.edu 494997Sgblack@eecs.umich.eduparser = optparse.OptionParser() 504997Sgblack@eecs.umich.edu 514997Sgblack@eecs.umich.edu# 524997Sgblack@eecs.umich.edu# Set the default cache size and associativity to be very small to encourage 534997Sgblack@eecs.umich.edu# races between requests and writebacks. 544997Sgblack@eecs.umich.edu# 554997Sgblack@eecs.umich.eduparser.add_option("--l1d_size", type="string", default="256B") 565236Sgblack@eecs.umich.eduparser.add_option("--l1i_size", type="string", default="256B") 574997Sgblack@eecs.umich.eduparser.add_option("--l2_size", type="string", default="512B") 585236Sgblack@eecs.umich.eduparser.add_option("--l1d_assoc", type="int", default=2) 595236Sgblack@eecs.umich.eduparser.add_option("--l1i_assoc", type="int", default=2) 604997Sgblack@eecs.umich.eduparser.add_option("--l2_assoc", type="int", default=2) 614997Sgblack@eecs.umich.edu 625124Sgblack@eecs.umich.eduexecfile(os.path.join(config_root, "configs/common", "Options.py")) 635236Sgblack@eecs.umich.edu 645236Sgblack@eecs.umich.edu(options, args) = parser.parse_args() 654997Sgblack@eecs.umich.edu 664997Sgblack@eecs.umich.edu# 674997Sgblack@eecs.umich.edu# create the tester and system, including ruby 684997Sgblack@eecs.umich.edu# 694997Sgblack@eecs.umich.edutester = RubyTester(checks_to_complete = 100, wakeup_frequency = 10) 704997Sgblack@eecs.umich.edu 715124Sgblack@eecs.umich.edusystem = System(physmem = PhysicalMemory()) 724997Sgblack@eecs.umich.edu 734997Sgblack@eecs.umich.edusystem.ruby = Ruby.create_system(options, system.physmem) 744997Sgblack@eecs.umich.edu 754997Sgblack@eecs.umich.eduassert(options.num_cpus == len(system.ruby.cpu_ruby_ports)) 764997Sgblack@eecs.umich.edu 774997Sgblack@eecs.umich.edu# 785124Sgblack@eecs.umich.edu# The tester is most effective when randomization is turned on and 79# artifical delay is randomly inserted on messages 80# 81system.ruby.randomization = True 82 83for ruby_port in system.ruby.cpu_ruby_ports: 84 # 85 # Tie the ruby tester ports to the ruby cpu ports 86 # 87 tester.cpuPort = ruby_port.port 88 89 # 90 # Tell the sequencer this is the ruby tester so that it 91 # copies the subblock back to the checker 92 # 93 ruby_port.using_ruby_tester = True 94 95# ----------------------- 96# run simulation 97# ----------------------- 98 99root = Root( system = system ) 100root.system.mem_mode = 'timing' 101 102# Not much point in this being higher than the L1 latency 103m5.ticks.setGlobalFrequency('1ns') 104