gem5 v24.0.0.0
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/statistics.hh"
35#include "mem/port.hh"
36#include "params/GarnetSyntheticTraffic.hh"
37#include "sim/clocked_object.hh"
38#include "sim/eventq.hh"
39#include "sim/sim_exit.hh"
40#include "sim/sim_object.hh"
41#include "sim/stats.hh"
42
43namespace gem5
44{
45
55
56class Packet;
58{
59 public:
60 typedef GarnetSyntheticTrafficParams Params;
62
63 void init() override;
64
65 // main simulation loop (one cycle)
66 void tick();
67
68 Port &getPort(const std::string &if_name,
69 PortID idx=InvalidPortID) override;
70
75 void printAddr(Addr a);
76
77 protected:
79
80 class CpuPort : public RequestPort
81 {
83
84 public:
85
86 CpuPort(const std::string &_name, GarnetSyntheticTraffic *_tester)
87 : RequestPort(_name), tester(_tester)
88 { }
89
90 protected:
91
92 virtual bool recvTimingResp(PacketPtr pkt);
93
94 virtual void recvReqRetry();
95 };
96
98
100 {
101 public:
104 : data(_data)
105 { }
106
107 // Hold onto data pointer
108 uint8_t *data;
109 };
110
112 unsigned size;
113 int id;
114
115 std::map<std::string, TrafficType> trafficStringToEnum;
116
118
120
127
128 std::string trafficType; // string
129 TrafficType traffic; // enum from string
130 double injRate;
133
135
137
138 void completeRequest(PacketPtr pkt);
139
140 void generatePkt();
141 void sendPkt(PacketPtr pkt);
142 void initTrafficType();
143
144 void doRetry();
145
146 friend class MemCompleteEvent;
147};
148
149} // namespace gem5
150
151#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
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 - Pranith Kumar Copyright (c) 2020 Inria 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 Tue Jun 18 2024 16:24:02 for gem5 by doxygen 1.11.0