BaseTrafficGen.py revision 12810
112810Sandreas.sandberg@arm.com# Copyright (c) 2012, 2016, 2018 ARM Limited
212810Sandreas.sandberg@arm.com# All rights reserved.
312810Sandreas.sandberg@arm.com#
412810Sandreas.sandberg@arm.com# The license below extends only to copyright in the software and shall
512810Sandreas.sandberg@arm.com# not be construed as granting a license to any other intellectual
612810Sandreas.sandberg@arm.com# property including but not limited to intellectual property relating
712810Sandreas.sandberg@arm.com# to a hardware implementation of the functionality of the software
812810Sandreas.sandberg@arm.com# licensed hereunder.  You may use the software subject to the license
912810Sandreas.sandberg@arm.com# terms below provided that you ensure that this notice is replicated
1012810Sandreas.sandberg@arm.com# unmodified and in its entirety in all distributions of the software,
1112810Sandreas.sandberg@arm.com# modified or unmodified, in source code or in binary form.
1212810Sandreas.sandberg@arm.com#
1312810Sandreas.sandberg@arm.com# Redistribution and use in source and binary forms, with or without
1412810Sandreas.sandberg@arm.com# modification, are permitted provided that the following conditions are
1512810Sandreas.sandberg@arm.com# met: redistributions of source code must retain the above copyright
1612810Sandreas.sandberg@arm.com# notice, this list of conditions and the following disclaimer;
1712810Sandreas.sandberg@arm.com# redistributions in binary form must reproduce the above copyright
1812810Sandreas.sandberg@arm.com# notice, this list of conditions and the following disclaimer in the
1912810Sandreas.sandberg@arm.com# documentation and/or other materials provided with the distribution;
2012810Sandreas.sandberg@arm.com# neither the name of the copyright holders nor the names of its
2112810Sandreas.sandberg@arm.com# contributors may be used to endorse or promote products derived from
2212810Sandreas.sandberg@arm.com# this software without specific prior written permission.
2312810Sandreas.sandberg@arm.com#
2412810Sandreas.sandberg@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
2512810Sandreas.sandberg@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
2612810Sandreas.sandberg@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
2712810Sandreas.sandberg@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
2812810Sandreas.sandberg@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2912810Sandreas.sandberg@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
3012810Sandreas.sandberg@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
3112810Sandreas.sandberg@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
3212810Sandreas.sandberg@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
3312810Sandreas.sandberg@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
3412810Sandreas.sandberg@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3512810Sandreas.sandberg@arm.com#
3612810Sandreas.sandberg@arm.com# Authors: Thomas Grass
3712810Sandreas.sandberg@arm.com#          Andreas Hansson
3812810Sandreas.sandberg@arm.com#          Sascha Bischoff
3912810Sandreas.sandberg@arm.com
4012810Sandreas.sandberg@arm.comfrom m5.params import *
4112810Sandreas.sandberg@arm.comfrom m5.proxy import *
4212810Sandreas.sandberg@arm.comfrom MemObject import MemObject
4312810Sandreas.sandberg@arm.com
4412810Sandreas.sandberg@arm.com# The traffic generator is a master module that generates stimuli for
4512810Sandreas.sandberg@arm.com# the memory system, based on a collection of simple behaviours that
4612810Sandreas.sandberg@arm.com# are either probabilistic or based on traces. It can be used stand
4712810Sandreas.sandberg@arm.com# alone for creating test cases for interconnect and memory
4812810Sandreas.sandberg@arm.com# controllers, or function as a black-box replacement for system
4912810Sandreas.sandberg@arm.com# components that are not yet modelled in detail, e.g. a video engine
5012810Sandreas.sandberg@arm.com# or baseband subsystem in an SoC.
5112810Sandreas.sandberg@arm.comclass BaseTrafficGen(MemObject):
5212810Sandreas.sandberg@arm.com    type = 'BaseTrafficGen'
5312810Sandreas.sandberg@arm.com    abstract = True
5412810Sandreas.sandberg@arm.com    cxx_header = "cpu/testers/traffic_gen/traffic_gen.hh"
5512810Sandreas.sandberg@arm.com
5612810Sandreas.sandberg@arm.com    # Port used for sending requests and receiving responses
5712810Sandreas.sandberg@arm.com    port = MasterPort("Master port")
5812810Sandreas.sandberg@arm.com
5912810Sandreas.sandberg@arm.com    # System used to determine the mode of the memory system
6012810Sandreas.sandberg@arm.com    system = Param.System(Parent.any, "System this generator is part of")
6112810Sandreas.sandberg@arm.com
6212810Sandreas.sandberg@arm.com    # Should requests respond to back-pressure or not, if true, the
6312810Sandreas.sandberg@arm.com    # rate of the traffic generator will be slowed down if requests
6412810Sandreas.sandberg@arm.com    # are not immediately accepted
6512810Sandreas.sandberg@arm.com    elastic_req = Param.Bool(False,
6612810Sandreas.sandberg@arm.com                             "Slow down requests in case of backpressure")
6712810Sandreas.sandberg@arm.com
6812810Sandreas.sandberg@arm.com    # Let the user know if we have waited for a retry and not made any
6912810Sandreas.sandberg@arm.com    # progress for a long period of time. The default value is
7012810Sandreas.sandberg@arm.com    # somewhat arbitrary and may well have to be tuned.
7112810Sandreas.sandberg@arm.com    progress_check = Param.Latency('1ms', "Time before exiting " \
7212810Sandreas.sandberg@arm.com                                   "due to lack of progress")
73