111663Stushar@ece.gatech.edu# Copyright (c) 2016 Georgia Institute of Technology
211663Stushar@ece.gatech.edu# All rights reserved.
311663Stushar@ece.gatech.edu#
411663Stushar@ece.gatech.edu# Redistribution and use in source and binary forms, with or without
511663Stushar@ece.gatech.edu# modification, are permitted provided that the following conditions are
611663Stushar@ece.gatech.edu# met: redistributions of source code must retain the above copyright
711663Stushar@ece.gatech.edu# notice, this list of conditions and the following disclaimer;
811663Stushar@ece.gatech.edu# redistributions in binary form must reproduce the above copyright
911663Stushar@ece.gatech.edu# notice, this list of conditions and the following disclaimer in the
1011663Stushar@ece.gatech.edu# documentation and/or other materials provided with the distribution;
1111663Stushar@ece.gatech.edu# neither the name of the copyright holders nor the names of its
1211663Stushar@ece.gatech.edu# contributors may be used to endorse or promote products derived from
1311663Stushar@ece.gatech.edu# this software without specific prior written permission.
1411663Stushar@ece.gatech.edu#
1511663Stushar@ece.gatech.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1611663Stushar@ece.gatech.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1711663Stushar@ece.gatech.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1811663Stushar@ece.gatech.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1911663Stushar@ece.gatech.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2011663Stushar@ece.gatech.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2111663Stushar@ece.gatech.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2211663Stushar@ece.gatech.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2311663Stushar@ece.gatech.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2411663Stushar@ece.gatech.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2511663Stushar@ece.gatech.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2611663Stushar@ece.gatech.edu#
2711663Stushar@ece.gatech.edu# Authors: Tushar Krishna
2811663Stushar@ece.gatech.edu
2913774Sandreas.sandberg@arm.comfrom __future__ import print_function
3013774Sandreas.sandberg@arm.comfrom __future__ import absolute_import
3113774Sandreas.sandberg@arm.com
3211663Stushar@ece.gatech.edufrom m5.params import *
3311663Stushar@ece.gatech.edufrom m5.objects import *
3411663Stushar@ece.gatech.edu
3513774Sandreas.sandberg@arm.comfrom .BaseTopology import SimpleTopology
3611663Stushar@ece.gatech.edu
3711663Stushar@ece.gatech.educlass CrossbarGarnet(SimpleTopology):
3811663Stushar@ece.gatech.edu    description='CrossbarGarnet'
3911663Stushar@ece.gatech.edu
4011663Stushar@ece.gatech.edu    def makeTopology(self, options, network, IntLink, ExtLink, Router):
4111663Stushar@ece.gatech.edu        # Create one router in Garnet. Internally models a crossbar and
4211663Stushar@ece.gatech.edu        # the associated allocator.
4311663Stushar@ece.gatech.edu        # For simple network, use Crossbar.py
4411663Stushar@ece.gatech.edu
4511663Stushar@ece.gatech.edu        xbar = Router(router_id=0)
4611663Stushar@ece.gatech.edu        network.routers = xbar
4711663Stushar@ece.gatech.edu
4811663Stushar@ece.gatech.edu        ext_links = [ExtLink(link_id=i, ext_node=n, int_node=xbar)
4911663Stushar@ece.gatech.edu                        for (i, n) in enumerate(self.nodes)]
5011663Stushar@ece.gatech.edu        network.ext_links = ext_links
5111663Stushar@ece.gatech.edu
5211663Stushar@ece.gatech.edu        int_links = []
5311663Stushar@ece.gatech.edu        network.int_links = int_links
54