kvm: Adding details to kvm page fault in x86
[gem5.git] / configs / ruby / Network_test.py
index fe1559f53ab46141f66f729cb0fbd69875e4384a..df3985cc1525e3757b395f56ff4709aa8b8de6a9 100644 (file)
@@ -31,18 +31,18 @@ import m5
 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):
-    
+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.")
 
@@ -51,11 +51,8 @@ def create_system(options, system, piobus, dma_devices):
     #
     # 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
@@ -75,43 +72,40 @@ def create_system(options, system, piobus, dma_devices):
         # 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,
+                                      cacheMemory = cache,
+                                      ruby_system = ruby_system)
+
         cpu_seq = RubySequencer(icache = cache,
                                 dcache = cache,
-                                physMemPort = system.physmem.port,
-                                physmem = system.physmem,
-                                using_network_tester = True)
+                                using_network_tester = True,
+                                ruby_system = ruby_system)
 
-        if piobus != None:
-            cpu_seq.pio_port = piobus.port
+        l1_cntrl.sequencer = cpu_seq
+        exec("ruby_system.l1_cntrl%d = l1_cntrl" % i)
 
-        l1_cntrl = L1Cache_Controller(version = i,
-                                      sequencer = cpu_seq,
-                                      cacheMemory = cache)
-
-        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)
 
-    phys_mem_size = long(system.physmem.range.second) - \
-                      long(system.physmem.range.first) + 1
-    mem_module_size = phys_mem_size / options.num_dirs
+        # Connect the L1 controllers and the network
+        l1_cntrl.mandatoryQueue = MessageBuffer()
+        l1_cntrl.requestFromCache = MessageBuffer()
+        l1_cntrl.responseFromCache = MessageBuffer()
+        l1_cntrl.forwardFromCache = MessageBuffer()
 
-    for i in xrange(options.num_dirs):
-        #
-        # Create the Ruby objects associated with the directory controller
-        #
 
-        mem_cntrl = RubyMemoryControl(version = i)
+    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):
         dir_size = MemorySize('0B')
         dir_size.value = mem_module_size
 
@@ -119,11 +113,18 @@ def create_system(options, system, piobus, dma_devices):
                                          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)
 
-    all_cntrls = l1_cntrl_nodes + dir_cntrl_nodes
+        # Connect the directory controllers and the network
+        dir_cntrl.requestToDir = MessageBuffer()
+        dir_cntrl.forwardToDir = MessageBuffer()
+        dir_cntrl.responseToDir = MessageBuffer()
 
-    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)