Network.py revision 6879
16876Ssteve.reinhardt@amd.com# Copyright (c) 2009 Advanced Micro Devices, Inc.
26876Ssteve.reinhardt@amd.com# All rights reserved.
36876Ssteve.reinhardt@amd.com#
46876Ssteve.reinhardt@amd.com# Redistribution and use in source and binary forms, with or without
56876Ssteve.reinhardt@amd.com# modification, are permitted provided that the following conditions are
66876Ssteve.reinhardt@amd.com# met: redistributions of source code must retain the above copyright
76876Ssteve.reinhardt@amd.com# notice, this list of conditions and the following disclaimer;
86876Ssteve.reinhardt@amd.com# redistributions in binary form must reproduce the above copyright
96876Ssteve.reinhardt@amd.com# notice, this list of conditions and the following disclaimer in the
106876Ssteve.reinhardt@amd.com# documentation and/or other materials provided with the distribution;
116876Ssteve.reinhardt@amd.com# neither the name of the copyright holders nor the names of its
126876Ssteve.reinhardt@amd.com# contributors may be used to endorse or promote products derived from
136876Ssteve.reinhardt@amd.com# this software without specific prior written permission.
146876Ssteve.reinhardt@amd.com#
156876Ssteve.reinhardt@amd.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
166876Ssteve.reinhardt@amd.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
176876Ssteve.reinhardt@amd.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
186876Ssteve.reinhardt@amd.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
196876Ssteve.reinhardt@amd.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
206876Ssteve.reinhardt@amd.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
216876Ssteve.reinhardt@amd.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
226876Ssteve.reinhardt@amd.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
236876Ssteve.reinhardt@amd.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
246876Ssteve.reinhardt@amd.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
256876Ssteve.reinhardt@amd.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
266876Ssteve.reinhardt@amd.com#
276876Ssteve.reinhardt@amd.com# Authors: Steve Reinhardt
286876Ssteve.reinhardt@amd.com#          Brad Beckmann
296876Ssteve.reinhardt@amd.com
306876Ssteve.reinhardt@amd.comfrom m5.params import *
316876Ssteve.reinhardt@amd.comfrom m5.SimObject import SimObject
326876Ssteve.reinhardt@amd.com
336879Ssteve.reinhardt@amd.comclass Link(SimObject):
346879Ssteve.reinhardt@amd.com    type = 'Link'
356879Ssteve.reinhardt@amd.com    latency = Param.Int(1, "")
366879Ssteve.reinhardt@amd.com    bw_multiplier = Param.Int("")
376879Ssteve.reinhardt@amd.com    weight = Param.Int(1, "")
386879Ssteve.reinhardt@amd.com
396879Ssteve.reinhardt@amd.comclass ExtLink(Link):
406879Ssteve.reinhardt@amd.com    type = 'ExtLink'
416879Ssteve.reinhardt@amd.com    ext_node = Param.RubyController("External node")
426879Ssteve.reinhardt@amd.com    int_node = Param.Int("ID of internal node")
436879Ssteve.reinhardt@amd.com    bw_multiplier = 64
446879Ssteve.reinhardt@amd.com
456879Ssteve.reinhardt@amd.comclass IntLink(Link):
466879Ssteve.reinhardt@amd.com    type = 'IntLink'
476879Ssteve.reinhardt@amd.com    node_a = Param.Int("ID of internal node on one end")
486879Ssteve.reinhardt@amd.com    node_b = Param.Int("ID of internal node on other end")
496879Ssteve.reinhardt@amd.com    bw_multiplier = 16
506879Ssteve.reinhardt@amd.com
516876Ssteve.reinhardt@amd.comclass Topology(SimObject):
526876Ssteve.reinhardt@amd.com    type = 'Topology'
536879Ssteve.reinhardt@amd.com    ext_links = VectorParam.ExtLink("Links to external nodes")
546879Ssteve.reinhardt@amd.com    int_links = VectorParam.IntLink("Links between internal nodes")
556879Ssteve.reinhardt@amd.com    num_int_nodes = Param.Int("Nunber of internal nodes")
566876Ssteve.reinhardt@amd.com    print_config = Param.Bool(False,
576876Ssteve.reinhardt@amd.com        "display topology config in the stats file")
586876Ssteve.reinhardt@amd.com
596879Ssteve.reinhardt@amd.comdef makeCrossbar(nodes):
606879Ssteve.reinhardt@amd.com    ext_links = [ExtLink(ext_node=n, int_node=i)
616879Ssteve.reinhardt@amd.com                 for (i, n) in enumerate(nodes)]
626879Ssteve.reinhardt@amd.com    xbar = len(nodes) # node ID for crossbar switch
636879Ssteve.reinhardt@amd.com    int_links = [IntLink(node_a=i, node_b=xbar) for i in range(len(nodes))]
646879Ssteve.reinhardt@amd.com    return Topology(ext_links=ext_links, int_links=int_links,
656879Ssteve.reinhardt@amd.com                    num_int_nodes=len(nodes)+1)
666879Ssteve.reinhardt@amd.com
676876Ssteve.reinhardt@amd.comclass RubyNetwork(SimObject):
686876Ssteve.reinhardt@amd.com    type = 'RubyNetwork'
696876Ssteve.reinhardt@amd.com    cxx_class = 'Network'
706876Ssteve.reinhardt@amd.com    abstract = True
716876Ssteve.reinhardt@amd.com    number_of_virtual_networks = Param.Int(10, "");
726876Ssteve.reinhardt@amd.com    topology = Param.Topology("");
736876Ssteve.reinhardt@amd.com    buffer_size = Param.Int(0,
746876Ssteve.reinhardt@amd.com        "default buffer size; 0 indicates infinite buffering");
756876Ssteve.reinhardt@amd.com    endpoint_bandwidth = Param.Int(10000, "");
766876Ssteve.reinhardt@amd.com    adaptive_routing = Param.Bool(True, "");
776876Ssteve.reinhardt@amd.com    link_latency = Param.Int(1,
786876Ssteve.reinhardt@amd.com        "local memory latency ?? NetworkLinkLatency");
796876Ssteve.reinhardt@amd.com    control_msg_size = Param.Int(8, "");
80