Crossbar.py revision 9100
17032SN/A# Copyright (c) 2010 Advanced Micro Devices, Inc. 27032SN/A# All rights reserved. 37032SN/A# 47032SN/A# Redistribution and use in source and binary forms, with or without 57032SN/A# modification, are permitted provided that the following conditions are 67032SN/A# met: redistributions of source code must retain the above copyright 77032SN/A# notice, this list of conditions and the following disclaimer; 87032SN/A# redistributions in binary form must reproduce the above copyright 97032SN/A# notice, this list of conditions and the following disclaimer in the 107032SN/A# documentation and/or other materials provided with the distribution; 117032SN/A# neither the name of the copyright holders nor the names of its 127032SN/A# contributors may be used to endorse or promote products derived from 137032SN/A# this software without specific prior written permission. 147032SN/A# 157032SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 167032SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 177032SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 187032SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 197032SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 207032SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 217032SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 227032SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 237032SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 247032SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 257032SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 267032SN/A# 277032SN/A# Authors: Steve Reinhardt 287032SN/A 297032SN/Afrom m5.params import * 307032SN/Afrom m5.objects import * 317032SN/A 329100SBrad.Beckmann@amd.comfrom BaseTopology import BaseTopology 339100SBrad.Beckmann@amd.com 349100SBrad.Beckmann@amd.comclass Crossbar(BaseTopology): 357540SN/A description='Crossbar' 367540SN/A 379100SBrad.Beckmann@amd.com def __init__(self, controllers): 389100SBrad.Beckmann@amd.com self.nodes = controllers 397032SN/A 409100SBrad.Beckmann@amd.com def makeTopology(self, options, IntLink, ExtLink, Router): 419100SBrad.Beckmann@amd.com # Create an individual router for each controller plus one more for the 429100SBrad.Beckmann@amd.com # centralized crossbar. The large numbers of routers are needed because 439100SBrad.Beckmann@amd.com # external links do not model outgoing bandwidth in the simple network, but 449100SBrad.Beckmann@amd.com # internal links do. 457032SN/A 469100SBrad.Beckmann@amd.com routers = [Router(router_id=i) for i in range(len(self.nodes)+1)] 479100SBrad.Beckmann@amd.com ext_links = [ExtLink(link_id=i, ext_node=n, int_node=routers[i]) 489100SBrad.Beckmann@amd.com for (i, n) in enumerate(self.nodes)] 499100SBrad.Beckmann@amd.com link_count = len(self.nodes) 509100SBrad.Beckmann@amd.com xbar = routers[len(self.nodes)] # the crossbar router is the last router created 519100SBrad.Beckmann@amd.com int_links = [IntLink(link_id=(link_count+i), 529100SBrad.Beckmann@amd.com node_a=routers[i], node_b=xbar) 539100SBrad.Beckmann@amd.com for i in range(len(self.nodes))] 549100SBrad.Beckmann@amd.com 559100SBrad.Beckmann@amd.com return routers, int_links, ext_links 569100SBrad.Beckmann@amd.com 57