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# Author: Tushar Krishna
2911666Stushar@ece.gatech.edu#
3011666Stushar@ece.gatech.edu
3111666Stushar@ece.gatech.edufrom m5.params import *
3211666Stushar@ece.gatech.edufrom m5.proxy import *
3313665Sandreas.sandberg@arm.comfrom m5.objects.Network import RubyNetwork
3413665Sandreas.sandberg@arm.comfrom m5.objects.BasicRouter import BasicRouter
3513665Sandreas.sandberg@arm.comfrom m5.objects.ClockedObject import ClockedObject
3611666Stushar@ece.gatech.edu
3711666Stushar@ece.gatech.educlass GarnetNetwork(RubyNetwork):
3811666Stushar@ece.gatech.edu    type = 'GarnetNetwork'
3911666Stushar@ece.gatech.edu    cxx_header = "mem/ruby/network/garnet2.0/GarnetNetwork.hh"
4011666Stushar@ece.gatech.edu    num_rows = Param.Int(0, "number of rows if 2D (mesh/torus/..) topology");
4111666Stushar@ece.gatech.edu    ni_flit_size = Param.UInt32(16, "network interface flit size in bytes")
4211666Stushar@ece.gatech.edu    vcs_per_vnet = Param.UInt32(4, "virtual channels per virtual network");
4311666Stushar@ece.gatech.edu    buffers_per_data_vc = Param.UInt32(4, "buffers per data virtual channel");
4411666Stushar@ece.gatech.edu    buffers_per_ctrl_vc = Param.UInt32(1, "buffers per ctrl virtual channel");
4511666Stushar@ece.gatech.edu    routing_algorithm = Param.Int(0,
4611666Stushar@ece.gatech.edu        "0: Weight-based Table, 1: XY, 2: Custom");
4711666Stushar@ece.gatech.edu    enable_fault_model = Param.Bool(False, "enable network fault model");
4811666Stushar@ece.gatech.edu    fault_model = Param.FaultModel(NULL, "network fault model");
4911762Sjieming.yin@amd.com    garnet_deadlock_threshold = Param.UInt32(50000,
5011762Sjieming.yin@amd.com                              "network-level deadlock threshold")
5111666Stushar@ece.gatech.edu
5211666Stushar@ece.gatech.educlass GarnetNetworkInterface(ClockedObject):
5311666Stushar@ece.gatech.edu    type = 'GarnetNetworkInterface'
5411666Stushar@ece.gatech.edu    cxx_class = 'NetworkInterface'
5511666Stushar@ece.gatech.edu    cxx_header = "mem/ruby/network/garnet2.0/NetworkInterface.hh"
5611666Stushar@ece.gatech.edu
5711666Stushar@ece.gatech.edu    id = Param.UInt32("ID in relation to other network interfaces")
5811666Stushar@ece.gatech.edu    vcs_per_vnet = Param.UInt32(Parent.vcs_per_vnet,
5911666Stushar@ece.gatech.edu                             "virtual channels per virtual network")
6011666Stushar@ece.gatech.edu    virt_nets = Param.UInt32(Parent.number_of_virtual_networks,
6111666Stushar@ece.gatech.edu                          "number of virtual networks")
6211762Sjieming.yin@amd.com    garnet_deadlock_threshold = Param.UInt32(Parent.garnet_deadlock_threshold,
6311762Sjieming.yin@amd.com                                      "network-level deadlock threshold")
6411666Stushar@ece.gatech.edu
6511666Stushar@ece.gatech.educlass GarnetRouter(BasicRouter):
6611666Stushar@ece.gatech.edu    type = 'GarnetRouter'
6711666Stushar@ece.gatech.edu    cxx_class = 'Router'
6811666Stushar@ece.gatech.edu    cxx_header = "mem/ruby/network/garnet2.0/Router.hh"
6911666Stushar@ece.gatech.edu    vcs_per_vnet = Param.UInt32(Parent.vcs_per_vnet,
7011666Stushar@ece.gatech.edu                              "virtual channels per virtual network")
7111666Stushar@ece.gatech.edu    virt_nets = Param.UInt32(Parent.number_of_virtual_networks,
7211666Stushar@ece.gatech.edu                          "number of virtual networks")
73