base_gen.hh (12804:f47e75dce5c6) base_gen.hh (12811:269967d5b4e4)
1/*
1/*
2 * Copyright (c) 2012-2013, 2017 ARM Limited
2 * Copyright (c) 2012-2013, 2017-2018 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed here under. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 36 unchanged lines hidden (view full) ---

47
48#ifndef __CPU_TRAFFIC_GEN_BASE_GEN_HH__
49#define __CPU_TRAFFIC_GEN_BASE_GEN_HH__
50
51#include "base/bitfield.hh"
52#include "base/intmath.hh"
53#include "mem/packet.hh"
54
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software
9 * licensed here under. You may use the software subject to the license
10 * terms below provided that you ensure that this notice is replicated

--- 36 unchanged lines hidden (view full) ---

47
48#ifndef __CPU_TRAFFIC_GEN_BASE_GEN_HH__
49#define __CPU_TRAFFIC_GEN_BASE_GEN_HH__
50
51#include "base/bitfield.hh"
52#include "base/intmath.hh"
53#include "mem/packet.hh"
54
55class BaseTrafficGen;
56
55/**
56 * Base class for all generators, with the shared functionality and
57 * virtual functions for entering, executing and leaving the
58 * generator.
59 */
60class BaseGen
61{
62
63 protected:
64
65 /** Name to use for status and debug printing */
66 const std::string _name;
67
68 /** The MasterID used for generating requests */
69 const MasterID masterID;
70
57/**
58 * Base class for all generators, with the shared functionality and
59 * virtual functions for entering, executing and leaving the
60 * generator.
61 */
62class BaseGen
63{
64
65 protected:
66
67 /** Name to use for status and debug printing */
68 const std::string _name;
69
70 /** The MasterID used for generating requests */
71 const MasterID masterID;
72
73 /** Cache line size in the simulated system */
74 const Addr cacheLineSize;
75
71 /**
72 * Generate a new request and associated packet
73 *
74 * @param addr Physical address to use
75 * @param size Size of the request
76 * @param cmd Memory command to send
77 * @param flags Optional request flags
78 */

--- 7 unchanged lines hidden (view full) ---

86
87 /**
88 * Create a base generator.
89 *
90 * @param _name Name to use for status and debug
91 * @param master_id MasterID set on each request
92 * @param _duration duration of this state before transitioning
93 */
76 /**
77 * Generate a new request and associated packet
78 *
79 * @param addr Physical address to use
80 * @param size Size of the request
81 * @param cmd Memory command to send
82 * @param flags Optional request flags
83 */

--- 7 unchanged lines hidden (view full) ---

91
92 /**
93 * Create a base generator.
94 *
95 * @param _name Name to use for status and debug
96 * @param master_id MasterID set on each request
97 * @param _duration duration of this state before transitioning
98 */
94 BaseGen(const std::string& _name, MasterID master_id, Tick _duration);
99 BaseGen(BaseTrafficGen &gen, Tick _duration);
95
96 virtual ~BaseGen() { }
97
98 /**
99 * Get the name, useful for DPRINTFs.
100 *
101 * @return the given name
102 */

--- 24 unchanged lines hidden (view full) ---

127 * @param elastic should the injection respond to flow control or not
128 * @param delay time the previous packet spent waiting
129 * @return next tick when a packet is available
130 */
131 virtual Tick nextPacketTick(bool elastic, Tick delay) const = 0;
132
133};
134
100
101 virtual ~BaseGen() { }
102
103 /**
104 * Get the name, useful for DPRINTFs.
105 *
106 * @return the given name
107 */

--- 24 unchanged lines hidden (view full) ---

132 * @param elastic should the injection respond to flow control or not
133 * @param delay time the previous packet spent waiting
134 * @return next tick when a packet is available
135 */
136 virtual Tick nextPacketTick(bool elastic, Tick delay) const = 0;
137
138};
139
140class StochasticGen : public BaseGen
141{
142 public:
143 StochasticGen(BaseTrafficGen &gen, Tick _duration,
144 Addr start_addr, Addr end_addr, Addr _blocksize,
145 Tick min_period, Tick max_period,
146 uint8_t read_percent, Addr data_limit);
147
148 protected:
149 /** Start of address range */
150 const Addr startAddr;
151
152 /** End of address range */
153 const Addr endAddr;
154
155 /** Blocksize and address increment */
156 const Addr blocksize;
157
158 /** Request generation period */
159 const Tick minPeriod;
160 const Tick maxPeriod;
161
162 /**
163 * Percent of generated transactions that should be reads
164 */
165 const uint8_t readPercent;
166
167 /** Maximum amount of data to manipulate */
168 const Addr dataLimit;
169};
170
135#endif
171#endif