MESI_Two_Level.py (11266:452e10b868ea) MESI_Two_Level.py (12065:e3e51756dfef)
1# Copyright (c) 2006-2007 The Regents of The University of Michigan
2# Copyright (c) 2009 Advanced Micro Devices, Inc.
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 17 unchanged lines hidden (view full) ---

26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28# Authors: Brad Beckmann
29
30import math
31import m5
32from m5.objects import *
33from m5.defines import buildEnv
1# Copyright (c) 2006-2007 The Regents of The University of Michigan
2# Copyright (c) 2009 Advanced Micro Devices, Inc.
3# All rights reserved.
4#
5# Redistribution and use in source and binary forms, with or without
6# modification, are permitted provided that the following conditions are
7# met: redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer;

--- 17 unchanged lines hidden (view full) ---

26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27#
28# Authors: Brad Beckmann
29
30import math
31import m5
32from m5.objects import *
33from m5.defines import buildEnv
34from Ruby import create_topology
34from Ruby import create_topology, create_directories
35from Ruby import send_evicts
36
37#
38# Declare caches used by the protocol
39#
40class L1Cache(RubyCache): pass
41class L2Cache(RubyCache): pass
42

--- 9 unchanged lines hidden (view full) ---

52
53 #
54 # The ruby network creation expects the list of nodes in the system to be
55 # consistent with the NetDest list. Therefore the l1 controller nodes must be
56 # listed before the directory nodes and directory nodes before dma nodes, etc.
57 #
58 l1_cntrl_nodes = []
59 l2_cntrl_nodes = []
35from Ruby import send_evicts
36
37#
38# Declare caches used by the protocol
39#
40class L1Cache(RubyCache): pass
41class L2Cache(RubyCache): pass
42

--- 9 unchanged lines hidden (view full) ---

52
53 #
54 # The ruby network creation expects the list of nodes in the system to be
55 # consistent with the NetDest list. Therefore the l1 controller nodes must be
56 # listed before the directory nodes and directory nodes before dma nodes, etc.
57 #
58 l1_cntrl_nodes = []
59 l2_cntrl_nodes = []
60 dir_cntrl_nodes = []
61 dma_cntrl_nodes = []
62
63 #
64 # Must create the individual controllers before the network to ensure the
65 # controller constructors are called before the network constructor
66 #
67 l2_bits = int(math.log(options.num_l2caches, 2))
68 block_size_bits = int(math.log(options.cacheline_size, 2))

--- 93 unchanged lines hidden (view full) ---

162 l2_cntrl.unblockToL2Cache = MessageBuffer()
163 l2_cntrl.unblockToL2Cache.slave = ruby_system.network.master
164 l2_cntrl.L1RequestToL2Cache = MessageBuffer()
165 l2_cntrl.L1RequestToL2Cache.slave = ruby_system.network.master
166 l2_cntrl.responseToL2Cache = MessageBuffer()
167 l2_cntrl.responseToL2Cache.slave = ruby_system.network.master
168
169
60 dma_cntrl_nodes = []
61
62 #
63 # Must create the individual controllers before the network to ensure the
64 # controller constructors are called before the network constructor
65 #
66 l2_bits = int(math.log(options.num_l2caches, 2))
67 block_size_bits = int(math.log(options.cacheline_size, 2))

--- 93 unchanged lines hidden (view full) ---

161 l2_cntrl.unblockToL2Cache = MessageBuffer()
162 l2_cntrl.unblockToL2Cache.slave = ruby_system.network.master
163 l2_cntrl.L1RequestToL2Cache = MessageBuffer()
164 l2_cntrl.L1RequestToL2Cache.slave = ruby_system.network.master
165 l2_cntrl.responseToL2Cache = MessageBuffer()
166 l2_cntrl.responseToL2Cache.slave = ruby_system.network.master
167
168
170 phys_mem_size = sum(map(lambda r: r.size(), system.mem_ranges))
171 assert(phys_mem_size % options.num_dirs == 0)
172 mem_module_size = phys_mem_size / options.num_dirs
173
174
175 # Run each of the ruby memory controllers at a ratio of the frequency of
176 # the ruby system
177 # clk_divider value is a fix to pass regression.
178 ruby_system.memctrl_clk_domain = DerivedClockDomain(
179 clk_domain = ruby_system.clk_domain,
180 clk_divider = 3)
181
169 # Run each of the ruby memory controllers at a ratio of the frequency of
170 # the ruby system
171 # clk_divider value is a fix to pass regression.
172 ruby_system.memctrl_clk_domain = DerivedClockDomain(
173 clk_domain = ruby_system.clk_domain,
174 clk_divider = 3)
175
182 for i in xrange(options.num_dirs):
183 dir_size = MemorySize('0B')
184 dir_size.value = mem_module_size
185
186 dir_cntrl = Directory_Controller(version = i,
187 directory = RubyDirectoryMemory(version = i, size = dir_size),
188 transitions_per_cycle = options.ports,
189 ruby_system = ruby_system)
190
191 exec("ruby_system.dir_cntrl%d = dir_cntrl" % i)
192 dir_cntrl_nodes.append(dir_cntrl)
193
176 dir_cntrl_nodes = create_directories(options, system.mem_ranges,
177 ruby_system)
178 for dir_cntrl in dir_cntrl_nodes:
194 # Connect the directory controllers and the network
195 dir_cntrl.requestToDir = MessageBuffer()
196 dir_cntrl.requestToDir.slave = ruby_system.network.master
197 dir_cntrl.responseToDir = MessageBuffer()
198 dir_cntrl.responseToDir.slave = ruby_system.network.master
199 dir_cntrl.responseFromDir = MessageBuffer()
200 dir_cntrl.responseFromDir.master = ruby_system.network.slave
201 dir_cntrl.responseFromMemory = MessageBuffer()

--- 48 unchanged lines hidden ---
179 # Connect the directory controllers and the network
180 dir_cntrl.requestToDir = MessageBuffer()
181 dir_cntrl.requestToDir.slave = ruby_system.network.master
182 dir_cntrl.responseToDir = MessageBuffer()
183 dir_cntrl.responseToDir.slave = ruby_system.network.master
184 dir_cntrl.responseFromDir = MessageBuffer()
185 dir_cntrl.responseFromDir.master = ruby_system.network.slave
186 dir_cntrl.responseFromMemory = MessageBuffer()

--- 48 unchanged lines hidden ---