from m5.objects import *
from m5.defines import buildEnv
from m5.util import addToPath
+from Ruby import create_topology
#
-# Note: the cache latency is only used by the sequencer on fast path hits
+# Declare caches used by the protocol
#
-class Cache(RubyCache):
- latency = 3
+class L1Cache(RubyCache): pass
def define_options(parser):
return
-def create_system(options, system, piobus, dma_devices, ruby_system):
-
+def create_system(options, full_system, system, dma_ports, ruby_system):
+
if buildEnv['PROTOCOL'] != 'Network_test':
panic("This script requires the Network_test protocol to be built.")
#
# The Garnet tester protocol does not support fs nor dma
#
- if buildEnv['FULL_SYSTEM']:
- panic("This script requires system-emulation mode (*_SE).")
- assert(piobus == None)
- assert(dma_devices == [])
-
+ assert(dma_ports == [])
+
#
# The ruby network creation expects the list of nodes in the system to be
# consistent with the NetDest list. Therefore the l1 controller nodes must be
# controller constructors are called before the network constructor
#
- cntrl_count = 0
-
for i in xrange(options.num_cpus):
#
# First create the Ruby objects associated with this cpu
# Only one cache exists for this protocol, so by default use the L1D
# config parameters.
#
- cache = Cache(size = options.l1d_size,
- assoc = options.l1d_assoc)
+ cache = L1Cache(size = options.l1d_size,
+ assoc = options.l1d_assoc)
#
# Only one unified L1 cache exists. Can cache instructions and data.
#
l1_cntrl = L1Cache_Controller(version = i,
- cntrl_id = cntrl_count,
cacheMemory = cache,
ruby_system = ruby_system)
cpu_seq = RubySequencer(icache = cache,
dcache = cache,
- physMemPort = system.physmem.port,
- physmem = system.physmem,
using_network_tester = True,
ruby_system = ruby_system)
l1_cntrl.sequencer = cpu_seq
+ exec("ruby_system.l1_cntrl%d = l1_cntrl" % i)
- if piobus != None:
- cpu_seq.pio_port = piobus.port
-
- exec("system.l1_cntrl%d = l1_cntrl" % i)
- #
# Add controllers and sequencers to the appropriate lists
- #
cpu_sequencers.append(cpu_seq)
l1_cntrl_nodes.append(l1_cntrl)
- cntrl_count += 1
+ # Connect the L1 controllers and the network
+ l1_cntrl.mandatoryQueue = MessageBuffer()
+ l1_cntrl.requestFromCache = MessageBuffer()
+ l1_cntrl.responseFromCache = MessageBuffer()
+ l1_cntrl.forwardFromCache = MessageBuffer()
+
- phys_mem_size = long(system.physmem.range.second) - \
- long(system.physmem.range.first) + 1
+ phys_mem_size = sum(map(lambda r: r.size(), system.mem_ranges))
+ assert(phys_mem_size % options.num_dirs == 0)
mem_module_size = phys_mem_size / options.num_dirs
for i in xrange(options.num_dirs):
- #
- # Create the Ruby objects associated with the directory controller
- #
-
- mem_cntrl = RubyMemoryControl(version = i)
-
dir_size = MemorySize('0B')
dir_size.value = mem_module_size
dir_cntrl = Directory_Controller(version = i,
- cntrl_id = cntrl_count,
directory = \
RubyDirectoryMemory(version = i,
size = dir_size),
- memBuffer = mem_cntrl,
ruby_system = ruby_system)
- exec("system.dir_cntrl%d = dir_cntrl" % i)
+ exec("ruby_system.dir_cntrl%d = dir_cntrl" % i)
dir_cntrl_nodes.append(dir_cntrl)
- cntrl_count += 1
+ # Connect the directory controllers and the network
+ dir_cntrl.requestToDir = MessageBuffer()
+ dir_cntrl.forwardToDir = MessageBuffer()
+ dir_cntrl.responseToDir = MessageBuffer()
- all_cntrls = l1_cntrl_nodes + dir_cntrl_nodes
- return (cpu_sequencers, dir_cntrl_nodes, all_cntrls)
+ all_cntrls = l1_cntrl_nodes + dir_cntrl_nodes
+ ruby_system.network.number_of_virtual_networks = 3
+ topology = create_topology(all_cntrls, options)
+ return (cpu_sequencers, dir_cntrl_nodes, topology)