1 # Copyright (c) 2006-2007 The Regents of The University of Michigan
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
6 # met: redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer;
8 # redistributions in binary form must reproduce the above copyright
9 # notice, this list of conditions and the following disclaimer in the
10 # documentation and/or other materials provided with the distribution;
11 # neither the name of the copyright holders nor the names of its
12 # contributors may be used to endorse or promote products derived from
13 # this software without specific prior written permission.
15 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
19 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
21 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 # Authors: Ron Dreslinski
30 from m5
.objects
import *
31 import os
, optparse
, sys
32 m5
.AddToPath('../common')
34 parser
= optparse
.OptionParser()
36 parser
.add_option("--caches", action
="store_true")
37 parser
.add_option("-t", "--timing", action
="store_true")
38 parser
.add_option("-m", "--maxtick", type="int")
39 parser
.add_option("-l", "--maxloads", default
= "1000000000000", type="int")
40 parser
.add_option("-n", "--numtesters", default
= "8", type="int")
41 parser
.add_option("-p", "--protocol",
43 help="The coherence protocol to use for the L1'a (i.e. MOESI, MOSI)")
45 (options
, args
) = parser
.parse_args()
48 print "Error: script doesn't take any positional arguments"
51 # --------------------
53 # ====================
60 protocol
= CoherenceProtocol(protocol
=options
.protocol
)
62 # ----------------------
64 # ----------------------
73 #MAX CORES IS 8 with the false sharing method
74 if options
.numtesters
> 8:
75 print "Error: NUmber of testers limited to 8 because of false sharing"
78 cpus
= [ MemTest(atomic
=not options
.timing
, max_loads
=options
.maxloads
,
79 percent_functional
=50, percent_uncacheable
=10,
80 progress_interval
=1000)
81 for i
in xrange(options
.numtesters
) ]
84 system
= System(cpu
= cpus
, funcmem
= PhysicalMemory(),
85 physmem
= PhysicalMemory(latency
= "50ps"),
86 membus
= Bus(clock
="500MHz", width
=16))
90 system
.toL2Bus
= Bus(clock
="500MHz", width
=16)
91 system
.l2c
= L2(size
='64kB', assoc
=8)
92 system
.l2c
.cpu_side
= system
.toL2Bus
.port
94 # connect l2c to membus
95 system
.l2c
.mem_side
= system
.membus
.port
100 cpu
.l1c
= L1(size
= '32kB', assoc
= 4)
101 cpu
.test
= cpu
.l1c
.cpu_side
102 cpu
.l1c
.mem_side
= system
.toL2Bus
.port
104 cpu
.test
= system
.membus
.port
105 system
.funcmem
.port
= cpu
.functional
107 # connect memory to membus
108 system
.physmem
.port
= system
.membus
.port
111 # -----------------------
113 # -----------------------
115 root
= Root( system
= system
)
117 root
.system
.mem_mode
= 'timing'
119 root
.system
.mem_mode
= 'atomic'
121 # Not much point in this being higher than the L1 latency
122 m5
.ticks
.setGlobalFrequency('1ns')
124 # instantiate configuration
127 # simulate until program terminates
129 exit_event
= m5
.simulate(options
.maxtick
)
131 exit_event
= m5
.simulate(10000000000000)
133 print 'Exiting @ tick', m5
.curTick(), 'because', exit_event
.getCause()