gem5 v24.1.0.1
Loading...
Searching...
No Matches
GarnetSyntheticTraffic.hh
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 Georgia Institute of Technology
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;
9 * redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution;
12 * neither the name of the copyright holders nor the names of its
13 * contributors may be used to endorse or promote products derived from
14 * this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef __CPU_GARNET_SYNTHETIC_TRAFFIC_HH__
30#define __CPU_GARNET_SYNTHETIC_TRAFFIC_HH__
31
32#include <set>
33
34#include "base/random.hh"
35#include "base/statistics.hh"
36#include "mem/port.hh"
37#include "params/GarnetSyntheticTraffic.hh"
38#include "sim/clocked_object.hh"
39#include "sim/eventq.hh"
40#include "sim/sim_exit.hh"
41#include "sim/sim_object.hh"
42#include "sim/stats.hh"
43
44namespace gem5
45{
46
56
57class Packet;
59{
60 public:
61 typedef GarnetSyntheticTrafficParams Params;
63
64 void init() override;
65
66 // main simulation loop (one cycle)
67 void tick();
68
69 Port &getPort(const std::string &if_name,
70 PortID idx=InvalidPortID) override;
71
76 void printAddr(Addr a);
77
78 protected:
80
81 class CpuPort : public RequestPort
82 {
84
85 public:
86
87 CpuPort(const std::string &_name, GarnetSyntheticTraffic *_tester)
88 : RequestPort(_name), tester(_tester)
89 { }
90
91 protected:
92
93 virtual bool recvTimingResp(PacketPtr pkt);
94
95 virtual void recvReqRetry();
96 };
97
99
101 {
102 public:
105 : data(_data)
106 { }
107
108 // Hold onto data pointer
109 uint8_t *data;
110 };
111
113 unsigned size;
114 int id;
115
116 std::map<std::string, TrafficType> trafficStringToEnum;
117
119
121
128
129 std::string trafficType; // string
130 TrafficType traffic; // enum from string
131 double injRate;
134
136
138
140
141 void completeRequest(PacketPtr pkt);
142
143 void generatePkt();
144 void sendPkt(PacketPtr pkt);
145 void initTrafficType();
146
147 void doRetry();
148
149 friend class MemCompleteEvent;
150};
151
152} // namespace gem5
153
154#endif // __CPU_GARNET_SYNTHETIC_TRAFFIC_HH__
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Cycles is a wrapper class for representing cycle counts, i.e.
Definition types.hh:79
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
virtual void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
CpuPort(const std::string &_name, GarnetSyntheticTraffic *_tester)
GarnetSyntheticTrafficParams Params
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
std::map< std::string, TrafficType > trafficStringToEnum
void printAddr(Addr a)
Print state of address in memory system via PrintReq (for debugging).
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
const std::string _name
Definition named.hh:41
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition packet.hh:295
Ports are used to interface objects to each other.
Definition port.hh:62
std::shared_ptr< Random > RandomPtr
Definition random.hh:65
static RandomPtr genRandom()
Definition random.hh:68
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition port.hh:136
ClockedObject declaration and implementation.
Port Object Declaration.
Bitfield< 8 > a
Definition misc_types.hh:66
Bitfield< 0 > p
Copyright (c) 2024 Arm Limited All rights reserved.
Definition binary32.hh:36
const PortID InvalidPortID
Definition types.hh:246
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition types.hh:147
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition types.hh:245
uint64_t Tick
Tick count type.
Definition types.hh:58
uint16_t RequestorID
Definition request.hh:95
Declaration of Statistics objects.
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition packet.hh:469

Generated on Mon Jan 13 2025 04:28:32 for gem5 by doxygen 1.9.8