Pt2Pt.py revision 11666
18292SN/A# Copyright (c) 2011 Advanced Micro Devices, Inc. 28292SN/A# 2011 Massachusetts Institute of Technology 38292SN/A# All rights reserved. 48292SN/A# 58292SN/A# Redistribution and use in source and binary forms, with or without 68292SN/A# modification, are permitted provided that the following conditions are 78292SN/A# met: redistributions of source code must retain the above copyright 88292SN/A# notice, this list of conditions and the following disclaimer; 98292SN/A# redistributions in binary form must reproduce the above copyright 108292SN/A# notice, this list of conditions and the following disclaimer in the 118292SN/A# documentation and/or other materials provided with the distribution; 128292SN/A# neither the name of the copyright holders nor the names of its 138292SN/A# contributors may be used to endorse or promote products derived from 148292SN/A# this software without specific prior written permission. 158292SN/A# 168292SN/A# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 178292SN/A# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 188292SN/A# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 198292SN/A# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 208292SN/A# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 218292SN/A# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 228292SN/A# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 238292SN/A# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 248292SN/A# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 258292SN/A# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 268292SN/A# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 278292SN/A# 288292SN/A# Authors: Brad Beckmann 298292SN/A# Tushar Krishna 308292SN/A 318292SN/Afrom m5.params import * 328292SN/Afrom m5.objects import * 338292SN/A 349148Spowerjg@cs.wisc.edufrom BaseTopology import SimpleTopology 359100SBrad.Beckmann@amd.com 369148Spowerjg@cs.wisc.educlass Pt2Pt(SimpleTopology): 378292SN/A description='Pt2Pt' 388292SN/A 399100SBrad.Beckmann@amd.com def __init__(self, controllers): 409100SBrad.Beckmann@amd.com self.nodes = controllers 418292SN/A 429862Snilay@cs.wisc.edu def makeTopology(self, options, network, IntLink, ExtLink, Router): 439100SBrad.Beckmann@amd.com nodes = self.nodes 449862Snilay@cs.wisc.edu 4511666Stushar@ece.gatech.edu # default values for link latency and router latency. 4611666Stushar@ece.gatech.edu # Can be over-ridden on a per link/router basis 4711666Stushar@ece.gatech.edu link_latency = options.link_latency # used by simple and garnet 4811666Stushar@ece.gatech.edu router_latency = options.router_latency # only used by garnet 4911666Stushar@ece.gatech.edu 5011666Stushar@ece.gatech.edu # Create an individual router for each controller, 5111666Stushar@ece.gatech.edu # and connect all to all. 5211666Stushar@ece.gatech.edu # Since this is a high-radix router, router_latency should 5311666Stushar@ece.gatech.edu # accordingly be set to a higher value than the default 5411666Stushar@ece.gatech.edu # (which is 1 for mesh routers) 5511666Stushar@ece.gatech.edu routers = [Router(router_id=i, latency = router_latency) \ 5611666Stushar@ece.gatech.edu for i in range(len(nodes))] 579862Snilay@cs.wisc.edu network.routers = routers 588292SN/A 5911666Stushar@ece.gatech.edu ext_links = [ExtLink(link_id=i, ext_node=n, int_node=routers[i], 6011666Stushar@ece.gatech.edu latency = link_latency) 619100SBrad.Beckmann@amd.com for (i, n) in enumerate(nodes)] 629862Snilay@cs.wisc.edu network.ext_links = ext_links 639862Snilay@cs.wisc.edu 649100SBrad.Beckmann@amd.com link_count = len(nodes) 659100SBrad.Beckmann@amd.com int_links = [] 669100SBrad.Beckmann@amd.com for i in xrange(len(nodes)): 679100SBrad.Beckmann@amd.com for j in xrange(len(nodes)): 689100SBrad.Beckmann@amd.com if (i != j): 699100SBrad.Beckmann@amd.com link_count += 1 709100SBrad.Beckmann@amd.com int_links.append(IntLink(link_id=link_count, 7111663Stushar@ece.gatech.edu src_node=routers[i], 7211666Stushar@ece.gatech.edu dst_node=routers[j], 7311666Stushar@ece.gatech.edu latency = link_latency)) 749100SBrad.Beckmann@amd.com 759862Snilay@cs.wisc.edu network.int_links = int_links 76