111666Stushar@ece.gatech.edu# Copyright (c) 2008 Princeton University
211666Stushar@ece.gatech.edu# Copyright (c) 2009 Advanced Micro Devices, Inc.
311666Stushar@ece.gatech.edu# All rights reserved.
411666Stushar@ece.gatech.edu#
511666Stushar@ece.gatech.edu# Redistribution and use in source and binary forms, with or without
611666Stushar@ece.gatech.edu# modification, are permitted provided that the following conditions are
711666Stushar@ece.gatech.edu# met: redistributions of source code must retain the above copyright
811666Stushar@ece.gatech.edu# notice, this list of conditions and the following disclaimer;
911666Stushar@ece.gatech.edu# redistributions in binary form must reproduce the above copyright
1011666Stushar@ece.gatech.edu# notice, this list of conditions and the following disclaimer in the
1111666Stushar@ece.gatech.edu# documentation and/or other materials provided with the distribution;
1211666Stushar@ece.gatech.edu# neither the name of the copyright holders nor the names of its
1311666Stushar@ece.gatech.edu# contributors may be used to endorse or promote products derived from
1411666Stushar@ece.gatech.edu# this software without specific prior written permission.
1511666Stushar@ece.gatech.edu#
1611666Stushar@ece.gatech.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1711666Stushar@ece.gatech.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1811666Stushar@ece.gatech.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1911666Stushar@ece.gatech.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2011666Stushar@ece.gatech.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2111666Stushar@ece.gatech.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2211666Stushar@ece.gatech.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2311666Stushar@ece.gatech.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2411666Stushar@ece.gatech.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2511666Stushar@ece.gatech.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2611666Stushar@ece.gatech.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2711666Stushar@ece.gatech.edu#
2811666Stushar@ece.gatech.edu# Authors: Steve Reinhardt
2911666Stushar@ece.gatech.edu#          Brad Beckmann
3011666Stushar@ece.gatech.edu
3111666Stushar@ece.gatech.edufrom m5.params import *
3211666Stushar@ece.gatech.edufrom m5.proxy import *
3313665Sandreas.sandberg@arm.comfrom m5.objects.ClockedObject import ClockedObject
3413665Sandreas.sandberg@arm.comfrom m5.objects.BasicLink import BasicIntLink, BasicExtLink
3511666Stushar@ece.gatech.edu
3611666Stushar@ece.gatech.educlass NetworkLink(ClockedObject):
3711666Stushar@ece.gatech.edu    type = 'NetworkLink'
3811666Stushar@ece.gatech.edu    cxx_header = "mem/ruby/network/garnet2.0/NetworkLink.hh"
3911666Stushar@ece.gatech.edu    link_id = Param.Int(Parent.link_id, "link id")
4011666Stushar@ece.gatech.edu    link_latency = Param.Cycles(Parent.latency, "link latency")
4111666Stushar@ece.gatech.edu    vcs_per_vnet = Param.Int(Parent.vcs_per_vnet,
4211666Stushar@ece.gatech.edu                              "virtual channels per virtual network")
4311666Stushar@ece.gatech.edu    virt_nets = Param.Int(Parent.number_of_virtual_networks,
4411666Stushar@ece.gatech.edu                          "number of virtual networks")
4511666Stushar@ece.gatech.edu
4611666Stushar@ece.gatech.educlass CreditLink(NetworkLink):
4711666Stushar@ece.gatech.edu    type = 'CreditLink'
4811666Stushar@ece.gatech.edu    cxx_header = "mem/ruby/network/garnet2.0/CreditLink.hh"
4911666Stushar@ece.gatech.edu
5011666Stushar@ece.gatech.edu# Interior fixed pipeline links between routers
5111666Stushar@ece.gatech.educlass GarnetIntLink(BasicIntLink):
5211666Stushar@ece.gatech.edu    type = 'GarnetIntLink'
5311666Stushar@ece.gatech.edu    cxx_header = "mem/ruby/network/garnet2.0/GarnetLink.hh"
5411666Stushar@ece.gatech.edu    # The internal link includes one forward link (for flit)
5511666Stushar@ece.gatech.edu    # and one backward flow-control link (for credit)
5611666Stushar@ece.gatech.edu    network_link = Param.NetworkLink(NetworkLink(), "forward link")
5711666Stushar@ece.gatech.edu    credit_link  = Param.CreditLink(CreditLink(), "backward flow-control link")
5811666Stushar@ece.gatech.edu
5911666Stushar@ece.gatech.edu# Exterior fixed pipeline links between a router and a controller
6011666Stushar@ece.gatech.educlass GarnetExtLink(BasicExtLink):
6111666Stushar@ece.gatech.edu    type = 'GarnetExtLink'
6211666Stushar@ece.gatech.edu    cxx_header = "mem/ruby/network/garnet2.0/GarnetLink.hh"
6311666Stushar@ece.gatech.edu    # The external link is bi-directional.
6411666Stushar@ece.gatech.edu    # It includes two forward links (for flits)
6511666Stushar@ece.gatech.edu    # and two backward flow-control links (for credits),
6611666Stushar@ece.gatech.edu    # one per direction
6711666Stushar@ece.gatech.edu    _nls = []
6811666Stushar@ece.gatech.edu    # In uni-directional link
6911666Stushar@ece.gatech.edu    _nls.append(NetworkLink());
7011666Stushar@ece.gatech.edu    # Out uni-directional link
7111666Stushar@ece.gatech.edu    _nls.append(NetworkLink());
7211666Stushar@ece.gatech.edu    network_links = VectorParam.NetworkLink(_nls, "forward links")
7311666Stushar@ece.gatech.edu
7411666Stushar@ece.gatech.edu    _cls = []
7511666Stushar@ece.gatech.edu    # In uni-directional link
7611666Stushar@ece.gatech.edu    _cls.append(CreditLink());
7711666Stushar@ece.gatech.edu    # Out uni-directional link
7811666Stushar@ece.gatech.edu    _cls.append(CreditLink());
7911666Stushar@ece.gatech.edu    credit_links = VectorParam.CreditLink(_cls, "backward flow-control links")
80