111661Stushar@ece.gatech.edu# Copyright (c) 2016 Georgia Institute of Technology
211661Stushar@ece.gatech.edu# All rights reserved.
311661Stushar@ece.gatech.edu#
411661Stushar@ece.gatech.edu# Redistribution and use in source and binary forms, with or without
511661Stushar@ece.gatech.edu# modification, are permitted provided that the following conditions are
611661Stushar@ece.gatech.edu# met: redistributions of source code must retain the above copyright
711661Stushar@ece.gatech.edu# notice, this list of conditions and the following disclaimer;
811661Stushar@ece.gatech.edu# redistributions in binary form must reproduce the above copyright
911661Stushar@ece.gatech.edu# notice, this list of conditions and the following disclaimer in the
1011661Stushar@ece.gatech.edu# documentation and/or other materials provided with the distribution;
1111661Stushar@ece.gatech.edu# neither the name of the copyright holders nor the names of its
1211661Stushar@ece.gatech.edu# contributors may be used to endorse or promote products derived from
1311661Stushar@ece.gatech.edu# this software without specific prior written permission.
1411661Stushar@ece.gatech.edu#
1511661Stushar@ece.gatech.edu# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
1611661Stushar@ece.gatech.edu# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
1711661Stushar@ece.gatech.edu# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
1811661Stushar@ece.gatech.edu# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
1911661Stushar@ece.gatech.edu# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2011661Stushar@ece.gatech.edu# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
2111661Stushar@ece.gatech.edu# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2211661Stushar@ece.gatech.edu# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2311661Stushar@ece.gatech.edu# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2411661Stushar@ece.gatech.edu# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2511661Stushar@ece.gatech.edu# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2611661Stushar@ece.gatech.edu#
2711661Stushar@ece.gatech.edu# Authors: Tushar Krishna
2811661Stushar@ece.gatech.edu
2913892Sgabeblack@google.comfrom m5.objects.ClockedObject import ClockedObject
3011661Stushar@ece.gatech.edufrom m5.params import *
3111661Stushar@ece.gatech.edufrom m5.proxy import *
3211661Stushar@ece.gatech.edu
3313892Sgabeblack@google.comclass GarnetSyntheticTraffic(ClockedObject):
3411661Stushar@ece.gatech.edu    type = 'GarnetSyntheticTraffic'
3511661Stushar@ece.gatech.edu    cxx_header = \
3611661Stushar@ece.gatech.edu        "cpu/testers/garnet_synthetic_traffic/GarnetSyntheticTraffic.hh"
3711661Stushar@ece.gatech.edu    block_offset = Param.Int(6, "block offset in bits")
3811661Stushar@ece.gatech.edu    num_dest = Param.Int(1, "Number of Destinations")
3911661Stushar@ece.gatech.edu    memory_size = Param.Int(65536, "memory size")
4011661Stushar@ece.gatech.edu    sim_cycles = Param.Int(1000, "Number of simulation cycles")
4111661Stushar@ece.gatech.edu    num_packets_max = Param.Int(-1, "Max number of packets to send. \
4211661Stushar@ece.gatech.edu                        Default is to keep sending till simulation ends")
4311661Stushar@ece.gatech.edu    single_sender = Param.Int(-1, "Send only from this node. \
4411661Stushar@ece.gatech.edu                                   By default every node sends")
4511661Stushar@ece.gatech.edu    single_dest = Param.Int(-1, "Send only to this dest. \
4611661Stushar@ece.gatech.edu                                 Default depends on traffic_type")
4711661Stushar@ece.gatech.edu    traffic_type = Param.String("uniform_random", "Traffic type")
4811661Stushar@ece.gatech.edu    inj_rate = Param.Float(0.1, "Packet injection rate")
4911661Stushar@ece.gatech.edu    inj_vnet = Param.Int(-1, "Vnet to inject in. \
5011661Stushar@ece.gatech.edu                              0 and 1 are 1-flit, 2 is 5-flit. \
5111661Stushar@ece.gatech.edu                                Default is to inject in all three vnets")
5211661Stushar@ece.gatech.edu    precision = Param.Int(3, "Number of digits of precision \
5311661Stushar@ece.gatech.edu                              after decimal point")
5411661Stushar@ece.gatech.edu    response_limit = Param.Cycles(5000000, "Cycles before exiting \
5511661Stushar@ece.gatech.edu                                            due to lack of progress")
5611661Stushar@ece.gatech.edu    test = MasterPort("Port to the memory system to test")
5711661Stushar@ece.gatech.edu    system = Param.System(Parent.any, "System we belong to")
58