cpu: Add a Python-enabled traffic generator
authorAndreas Sandberg <andreas.sandberg@arm.com>
Fri, 27 Apr 2018 17:57:01 +0000 (18:57 +0100)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Fri, 13 Jul 2018 09:26:23 +0000 (09:26 +0000)
commita4be6388b1f25a1aa11a9d24488270f052c4d9dd
tree8a5a76456035ac1a19f5ca65c9a36fd34fe8b75f
parent672953ef43f8559bd1ac1f8cb5dba9b997ca0ec9
cpu: Add a Python-enabled traffic generator

The current traffic generator relies on a configuration file that
describes a small machine to generate stimuli. This configuration file
is usually generated by the gem5 Python configuration. This creates an
unnecessary and fragile step.

This changeset introduces a Python-based trace module. When
instantiated, the module exposes a start method that takes an iterable
object as a parameter (e.g., a generator). The iterable object is
expected to represent a list of generators that will be run one after
the other. For example:

    system.tgen = PyTrafficGen()
    m5.instantiate()

    def trace():
        yield system.tgen.createIdle(1000)
        yield system.tgen.createExit(0)

    system.tgen.start(trace())

Change-Id: I58e60ca517e86c197859f4daaa67750066abdc1c
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/11518
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
src/cpu/testers/traffic_gen/PyTrafficGen.py [new file with mode: 0644]
src/cpu/testers/traffic_gen/SConscript
src/cpu/testers/traffic_gen/pygen.cc [new file with mode: 0644]
src/cpu/testers/traffic_gen/pygen.hh [new file with mode: 0644]