19242Sandreas.hansson@arm.com# Copyright (c) 2012 ARM Limited
29242Sandreas.hansson@arm.com# All rights reserved.
39242Sandreas.hansson@arm.com#
49242Sandreas.hansson@arm.com# The license below extends only to copyright in the software and shall
59242Sandreas.hansson@arm.com# not be construed as granting a license to any other intellectual
69242Sandreas.hansson@arm.com# property including but not limited to intellectual property relating
79242Sandreas.hansson@arm.com# to a hardware implementation of the functionality of the software
89242Sandreas.hansson@arm.com# licensed hereunder.  You may use the software subject to the license
99242Sandreas.hansson@arm.com# terms below provided that you ensure that this notice is replicated
109242Sandreas.hansson@arm.com# unmodified and in its entirety in all distributions of the software,
119242Sandreas.hansson@arm.com# modified or unmodified, in source code or in binary form.
129242Sandreas.hansson@arm.com#
139242Sandreas.hansson@arm.com# Redistribution and use in source and binary forms, with or without
149242Sandreas.hansson@arm.com# modification, are permitted provided that the following conditions are
159242Sandreas.hansson@arm.com# met: redistributions of source code must retain the above copyright
169242Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer;
179242Sandreas.hansson@arm.com# redistributions in binary form must reproduce the above copyright
189242Sandreas.hansson@arm.com# notice, this list of conditions and the following disclaimer in the
199242Sandreas.hansson@arm.com# documentation and/or other materials provided with the distribution;
209242Sandreas.hansson@arm.com# neither the name of the copyright holders nor the names of its
219242Sandreas.hansson@arm.com# contributors may be used to endorse or promote products derived from
229242Sandreas.hansson@arm.com# this software without specific prior written permission.
239242Sandreas.hansson@arm.com#
249242Sandreas.hansson@arm.com# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
259242Sandreas.hansson@arm.com# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
269242Sandreas.hansson@arm.com# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
279242Sandreas.hansson@arm.com# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
289242Sandreas.hansson@arm.com# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
299242Sandreas.hansson@arm.com# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
309242Sandreas.hansson@arm.com# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
319242Sandreas.hansson@arm.com# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
329242Sandreas.hansson@arm.com# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
339242Sandreas.hansson@arm.com# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
349242Sandreas.hansson@arm.com# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
359242Sandreas.hansson@arm.com#
369242Sandreas.hansson@arm.com# Authors: Andreas Hansson
379242Sandreas.hansson@arm.com
389242Sandreas.hansson@arm.comimport m5
399242Sandreas.hansson@arm.comfrom m5.objects import *
409242Sandreas.hansson@arm.com
419402Sandreas.hansson@arm.com# both traffic generator and communication monitor are only available
429402Sandreas.hansson@arm.com# if we have protobuf support, so potentially skip this test
439402Sandreas.hansson@arm.comrequire_sim_object("TrafficGen")
449402Sandreas.hansson@arm.comrequire_sim_object("CommMonitor")
459402Sandreas.hansson@arm.com
469242Sandreas.hansson@arm.com# even if this is only a traffic generator, call it cpu to make sure
479242Sandreas.hansson@arm.com# the scripts are happy
4811516Sandreas.sandberg@arm.comcpu = TrafficGen(
4911516Sandreas.sandberg@arm.com    config_file=srcpath("tests/quick/se/70.tgen/tgen-simple-mem.cfg"))
509242Sandreas.hansson@arm.com
519242Sandreas.hansson@arm.com# system simulated
529242Sandreas.hansson@arm.comsystem = System(cpu = cpu, physmem = SimpleMemory(),
5310720Sandreas.hansson@arm.com                membus = IOXBar(width = 16),
549827Sakash.bagdia@arm.com                clk_domain = SrcClockDomain(clock = '1GHz',
559827Sakash.bagdia@arm.com                                            voltage_domain =
569827Sakash.bagdia@arm.com                                            VoltageDomain()))
579242Sandreas.hansson@arm.com
5810616Sandreas.hansson@arm.com# add a communication monitor, and also trace all the packets and
5910616Sandreas.hansson@arm.com# calculate and verify stack distance
6010996Sandreas.sandberg@arm.comsystem.monitor = CommMonitor()
6110996Sandreas.sandberg@arm.comsystem.monitor.trace = MemTraceProbe(trace_file = "monitor.ptrc.gz")
6210995Sandreas.sandberg@arm.comsystem.monitor.stackdist = StackDistProbe(verify = True)
639242Sandreas.hansson@arm.com
649242Sandreas.hansson@arm.com# connect the traffic generator to the bus via a communication monitor
659242Sandreas.hansson@arm.comsystem.cpu.port = system.monitor.slave
669242Sandreas.hansson@arm.comsystem.monitor.master = system.membus.slave
679242Sandreas.hansson@arm.com
689242Sandreas.hansson@arm.com# connect the system port even if it is not used in this example
699242Sandreas.hansson@arm.comsystem.system_port = system.membus.slave
709242Sandreas.hansson@arm.com
719242Sandreas.hansson@arm.com# connect memory to the membus
729242Sandreas.hansson@arm.comsystem.physmem.port = system.membus.master
739242Sandreas.hansson@arm.com
749242Sandreas.hansson@arm.com# -----------------------
759242Sandreas.hansson@arm.com# run simulation
769242Sandreas.hansson@arm.com# -----------------------
779242Sandreas.hansson@arm.com
789242Sandreas.hansson@arm.comroot = Root(full_system = False, system = system)
799242Sandreas.hansson@arm.comroot.system.mem_mode = 'timing'
80