summaryrefslogtreecommitdiff
path: root/src/mem/ruby/network/simple/SimpleNetwork.py
diff options
context:
space:
mode:
authorJoel Hestness <jthestness@gmail.com>2015-08-14 00:19:44 -0500
committerJoel Hestness <jthestness@gmail.com>2015-08-14 00:19:44 -0500
commit581bae9ecbafd5e94c5405ca925a55cc6e5d7488 (patch)
treec4e9136882984e561b7c1c618361e4262b482869 /src/mem/ruby/network/simple/SimpleNetwork.py
parentbf06911b3f6d992dc78489d66410f4580a17db7b (diff)
downloadgem5-581bae9ecbafd5e94c5405ca925a55cc6e5d7488.tar.xz
ruby: Expose MessageBuffers as SimObjects
Expose MessageBuffers from SLICC controllers as SimObjects that can be manipulated in Python. This patch has numerous benefits: 1) First and foremost, it exposes MessageBuffers as SimObjects that can be manipulated in Python code. This allows parameters to be set and checked in Python code to avoid obfuscating parameters within protocol files. Further, now as SimObjects, MessageBuffer parameters are printed to config output files as a way to track parameters across simulations (e.g. buffer sizes) 2) Cleans up special-case code for responseFromMemory buffers, and aligns their instantiation and use with mandatoryQueue buffers. These two special buffers are the only MessageBuffers that are exposed to components outside of SLICC controllers, and they're both slave ends of these buffers. They should be exposed outside of SLICC in the same way, and this patch does it. 3) Distinguishes buffer-specific parameters from buffer-to-network parameters. Specifically, buffer size, randomization, ordering, recycle latency, and ports are all specific to a MessageBuffer, while the virtual network ID and type are intrinsics of how the buffer is connected to network ports. The former are specified in the Python object, while the latter are specified in the controller *.sm files. Unlike buffer-specific parameters, which may need to change depending on the simulated system structure, buffer-to-network parameters can be specified statically for most or all different simulated systems.
Diffstat (limited to 'src/mem/ruby/network/simple/SimpleNetwork.py')
-rw-r--r--src/mem/ruby/network/simple/SimpleNetwork.py40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/mem/ruby/network/simple/SimpleNetwork.py b/src/mem/ruby/network/simple/SimpleNetwork.py
index 8d0442b7d..f4ec440a3 100644
--- a/src/mem/ruby/network/simple/SimpleNetwork.py
+++ b/src/mem/ruby/network/simple/SimpleNetwork.py
@@ -31,6 +31,7 @@ from m5.params import *
from m5.proxy import *
from Network import RubyNetwork
from BasicRouter import BasicRouter
+from MessageBuffer import MessageBuffer
class SimpleNetwork(RubyNetwork):
type = 'SimpleNetwork'
@@ -39,9 +40,48 @@ class SimpleNetwork(RubyNetwork):
"default buffer size; 0 indicates infinite buffering");
endpoint_bandwidth = Param.Int(1000, "bandwidth adjustment factor");
adaptive_routing = Param.Bool(False, "enable adaptive routing");
+ int_link_buffers = VectorParam.MessageBuffer("Buffers for int_links")
+ # int_links do not recycle buffers, so this parameter is not used.
+ # TODO: Move recycle_latency out of MessageBuffers and into controllers
+ recycle_latency = Param.Cycles(0, "")
+
+ def setup_buffers(self):
+ # Note that all SimpleNetwork MessageBuffers are currently ordered
+ network_buffers = []
+ for link in self.int_links:
+ # The network needs number_of_virtual_networks buffers per
+ # int_link port
+ for i in xrange(self.number_of_virtual_networks):
+ network_buffers.append(MessageBuffer(ordered = True))
+ network_buffers.append(MessageBuffer(ordered = True))
+ self.int_link_buffers = network_buffers
+
+ # Also add buffers for all router-link connections
+ for router in self.routers:
+ router_buffers = []
+ # Add message buffers to routers for each internal link connection
+ for link in self.int_links:
+ if link.node_a == router:
+ for i in xrange(self.number_of_virtual_networks):
+ router_buffers.append(MessageBuffer(ordered = True))
+ if link.node_b == router:
+ for i in xrange(self.number_of_virtual_networks):
+ router_buffers.append(MessageBuffer(ordered = True))
+
+ # Add message buffers to routers for each external link connection
+ for link in self.ext_links:
+ # Routers can only be int_nodes on ext_links
+ if link.int_node in self.routers:
+ for i in xrange(self.number_of_virtual_networks):
+ router_buffers.append(MessageBuffer(ordered = True))
+ router.port_buffers = router_buffers
class Switch(BasicRouter):
type = 'Switch'
cxx_header = 'mem/ruby/network/simple/Switch.hh'
virt_nets = Param.Int(Parent.number_of_virtual_networks,
"number of virtual networks")
+ port_buffers = VectorParam.MessageBuffer("Port buffers")
+ # Ports do not recycle buffers, so this parameter is not used.
+ # TODO: Move recycle_latency out of MessageBuffers and into controllers
+ recycle_latency = Param.Cycles(0, "")