diff options
author | Andreas Sandberg <andreas.sandberg@arm.com> | 2018-04-27 12:07:53 +0100 |
---|---|---|
committer | Andreas Sandberg <andreas.sandberg@arm.com> | 2018-07-13 09:26:23 +0000 |
commit | 102027ee2ed50dcadf93b31ef2e7e485b61cc504 (patch) | |
tree | a729fc29c3e642df1cc0849b24ecf5dc2d5bd4b3 /src/cpu/testers/traffic_gen/random_gen.hh | |
parent | 0793a1bbdc190a7bd41b7ed81ef8291ceaeb722e (diff) | |
download | gem5-102027ee2ed50dcadf93b31ef2e7e485b61cc504.tar.xz |
cpu: Unify error handling for address generators
Unify error handling and create factory methods for address
generators.
Change-Id: Ic3ab705e1bb58affd498a7db176536ebc721b904
Signed-off-by: Andreas Sandberg <andreas.sandberg@arm.com>
Reviewed-by: Nikos Nikoleris <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/11516
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Diffstat (limited to 'src/cpu/testers/traffic_gen/random_gen.hh')
-rw-r--r-- | src/cpu/testers/traffic_gen/random_gen.hh | 39 |
1 files changed, 7 insertions, 32 deletions
diff --git a/src/cpu/testers/traffic_gen/random_gen.hh b/src/cpu/testers/traffic_gen/random_gen.hh index ec60b35bc..590094d4b 100644 --- a/src/cpu/testers/traffic_gen/random_gen.hh +++ b/src/cpu/testers/traffic_gen/random_gen.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2013, 2017 ARM Limited + * Copyright (c) 2012-2013, 2017-2018 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -59,7 +59,7 @@ * not generate sequential addresses. Instead it randomly * picks an address in the range, aligned to the block size. */ -class RandomGen : public BaseGen +class RandomGen : public StochasticGen { public: @@ -69,8 +69,7 @@ class RandomGen : public BaseGen * min_period == max_period for a fixed inter-transaction * time. * - * @param _name Name to use for status and debug - * @param master_id MasterID set on each request + * @param gen Traffic generator owning this sequence generator * @param _duration duration of this state before transitioning * @param start_addr Start address * @param end_addr End address @@ -80,15 +79,13 @@ class RandomGen : public BaseGen * @param read_percent Percent of transactions that are reads * @param data_limit Upper limit on how much data to read/write */ - RandomGen(const std::string& _name, MasterID master_id, Tick _duration, + RandomGen(BaseTrafficGen &gen, Tick _duration, Addr start_addr, Addr end_addr, Addr _blocksize, Tick min_period, Tick max_period, uint8_t read_percent, Addr data_limit) - : BaseGen(_name, master_id, _duration), - startAddr(start_addr), endAddr(end_addr), - blocksize(_blocksize), minPeriod(min_period), - maxPeriod(max_period), readPercent(read_percent), - dataLimit(data_limit), dataManipulated(0) + : StochasticGen(gen, _duration, start_addr, end_addr, _blocksize, + min_period, max_period, read_percent, data_limit), + dataManipulated(0) { } void enter(); @@ -98,28 +95,6 @@ class RandomGen : public BaseGen Tick nextPacketTick(bool elastic, Tick delay) const; protected: - - /** Start of address range */ - const Addr startAddr; - - /** End of address range */ - const Addr endAddr; - - /** Block size */ - const Addr blocksize; - - /** Request generation period */ - const Tick minPeriod; - const Tick maxPeriod; - - /** - * Percent of generated transactions that should be reads - */ - const uint8_t readPercent; - - /** Maximum amount of data to manipulate */ - const Addr dataLimit; - /** * Counter to determine the amount of data * manipulated. Used to determine if we should continue |