MOESI_CMP_directory.py (11266:452e10b868ea) MOESI_CMP_directory.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))

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

153 l2_cntrl.GlobalRequestToL2Cache = MessageBuffer()
154 l2_cntrl.GlobalRequestToL2Cache.slave = ruby_system.network.master
155 l2_cntrl.L1RequestToL2Cache = MessageBuffer()
156 l2_cntrl.L1RequestToL2Cache.slave = ruby_system.network.master
157 l2_cntrl.responseToL2Cache = MessageBuffer()
158 l2_cntrl.responseToL2Cache.slave = ruby_system.network.master
159 l2_cntrl.triggerQueue = MessageBuffer(ordered = True)
160
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))

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

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

--- 61 unchanged lines hidden ---
171 # Connect the directory controllers and the network
172 dir_cntrl.requestToDir = MessageBuffer()
173 dir_cntrl.requestToDir.slave = ruby_system.network.master
174 dir_cntrl.responseToDir = MessageBuffer()
175 dir_cntrl.responseToDir.slave = ruby_system.network.master
176 dir_cntrl.responseFromDir = MessageBuffer()
177 dir_cntrl.responseFromDir.master = ruby_system.network.slave
178 dir_cntrl.forwardFromDir = MessageBuffer()

--- 61 unchanged lines hidden ---