gem5  v20.1.0.0
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 
46  NEIGHBOR_ = 3,
47  SHUFFLE_ = 4,
48  TORNADO_ = 5,
52 
53 class Packet;
55 {
56  public:
57  typedef GarnetSyntheticTrafficParams Params;
59 
60  void init() override;
61 
62  // main simulation loop (one cycle)
63  void tick();
64 
65  Port &getPort(const std::string &if_name,
66  PortID idx=InvalidPortID) override;
67 
72  void printAddr(Addr a);
73 
74  protected:
76 
77  class CpuPort : public RequestPort
78  {
80 
81  public:
82 
83  CpuPort(const std::string &_name, GarnetSyntheticTraffic *_tester)
84  : RequestPort(_name, _tester), tester(_tester)
85  { }
86 
87  protected:
88 
89  virtual bool recvTimingResp(PacketPtr pkt);
90 
91  virtual void recvReqRetry();
92  };
93 
95 
97  {
98  public:
101  : data(_data)
102  { }
103 
104  // Hold onto data pointer
105  uint8_t *data;
106  };
107 
109  unsigned size;
110  int id;
111 
112  std::map<std::string, TrafficType> trafficStringToEnum;
113 
114  unsigned blockSizeBits;
115 
117 
124 
125  std::string trafficType; // string
126  TrafficType traffic; // enum from string
127  double injRate;
128  int injVnet;
130 
132 
134 
135  void completeRequest(PacketPtr pkt);
136 
137  void generatePkt();
138  void sendPkt(PacketPtr pkt);
139  void initTrafficType();
140 
141  void doRetry();
142 
143  friend class MemCompleteEvent;
144 };
145 
146 #endif // __CPU_GARNET_SYNTHETIC_TRAFFIC_HH__
TrafficType
TrafficType
Definition: GarnetSyntheticTraffic.hh:43
GarnetSyntheticTraffic::Params
GarnetSyntheticTrafficParams Params
Definition: GarnetSyntheticTraffic.hh:57
GarnetSyntheticTraffic::trafficStringToEnum
std::map< std::string, TrafficType > trafficStringToEnum
Definition: GarnetSyntheticTraffic.hh:112
GarnetSyntheticTraffic::generatePkt
void generatePkt()
Definition: GarnetSyntheticTraffic.cc:183
GarnetSyntheticTraffic::printAddr
void printAddr(Addr a)
Print state of address in memory system via PrintReq (for debugging).
Definition: GarnetSyntheticTraffic.cc:347
GarnetSyntheticTraffic::numPacketsSent
int numPacketsSent
Definition: GarnetSyntheticTraffic.hh:121
GarnetSyntheticTraffic::getPort
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
Definition: GarnetSyntheticTraffic.cc:111
InvalidPortID
const PortID InvalidPortID
Definition: types.hh:238
GarnetSyntheticTraffic::CpuPort::tester
GarnetSyntheticTraffic * tester
Definition: GarnetSyntheticTraffic.hh:79
GarnetSyntheticTraffic::trafficType
std::string trafficType
Definition: GarnetSyntheticTraffic.hh:125
NUM_TRAFFIC_PATTERNS_
@ NUM_TRAFFIC_PATTERNS_
Definition: GarnetSyntheticTraffic.hh:51
GarnetSyntheticTraffic::injVnet
int injVnet
Definition: GarnetSyntheticTraffic.hh:128
Tick
uint64_t Tick
Tick count type.
Definition: types.hh:63
PortID
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:237
GarnetSyntheticTraffic::MemCompleteEvent
friend class MemCompleteEvent
Definition: GarnetSyntheticTraffic.hh:143
SHUFFLE_
@ SHUFFLE_
Definition: GarnetSyntheticTraffic.hh:47
GarnetSyntheticTraffic::blockSizeBits
unsigned blockSizeBits
Definition: GarnetSyntheticTraffic.hh:114
sim_exit.hh
GarnetSyntheticTraffic::init
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: GarnetSyntheticTraffic.cc:120
GarnetSyntheticTraffic::singleSender
int singleSender
Definition: GarnetSyntheticTraffic.hh:122
ClockedObject
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
Definition: clocked_object.hh:231
GarnetSyntheticTraffic::requestorId
RequestorID requestorId
Definition: GarnetSyntheticTraffic.hh:133
EventFunctionWrapper
Definition: eventq.hh:1101
GarnetSyntheticTraffic::singleDest
int singleDest
Definition: GarnetSyntheticTraffic.hh:123
GarnetSyntheticTraffic::GarnetSyntheticTrafficSenderState::GarnetSyntheticTrafficSenderState
GarnetSyntheticTrafficSenderState(uint8_t *_data)
Constructor.
Definition: GarnetSyntheticTraffic.hh:100
GarnetSyntheticTraffic::CpuPort::CpuPort
CpuPort(const std::string &_name, GarnetSyntheticTraffic *_tester)
Definition: GarnetSyntheticTraffic.hh:83
BIT_REVERSE_
@ BIT_REVERSE_
Definition: GarnetSyntheticTraffic.hh:44
GarnetSyntheticTraffic::cachePort
CpuPort cachePort
Definition: GarnetSyntheticTraffic.hh:94
stats.hh
RequestorID
uint16_t RequestorID
Definition: request.hh:85
GarnetSyntheticTraffic::responseLimit
const Cycles responseLimit
Definition: GarnetSyntheticTraffic.hh:131
ArmISA::a
Bitfield< 8 > a
Definition: miscregs_types.hh:62
Packet::SenderState
A virtual base opaque structure used to hold state associated with the packet (e.g....
Definition: packet.hh:431
NEIGHBOR_
@ NEIGHBOR_
Definition: GarnetSyntheticTraffic.hh:46
GarnetSyntheticTraffic::id
int id
Definition: GarnetSyntheticTraffic.hh:110
sim_object.hh
GarnetSyntheticTraffic::numPacketsMax
int numPacketsMax
Definition: GarnetSyntheticTraffic.hh:120
statistics.hh
GarnetSyntheticTraffic::GarnetSyntheticTrafficSenderState::data
uint8_t * data
Definition: GarnetSyntheticTraffic.hh:105
Port
Ports are used to interface objects to each other.
Definition: port.hh:56
port.hh
GarnetSyntheticTraffic::CpuPort
Definition: GarnetSyntheticTraffic.hh:77
GarnetSyntheticTraffic::initTrafficType
void initTrafficType()
Definition: GarnetSyntheticTraffic.cc:326
GarnetSyntheticTraffic::noResponseCycles
Tick noResponseCycles
Definition: GarnetSyntheticTraffic.hh:116
GarnetSyntheticTraffic::GarnetSyntheticTraffic
GarnetSyntheticTraffic(const Params *p)
Definition: GarnetSyntheticTraffic.cc:74
RequestPort
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:74
GarnetSyntheticTraffic::retryPkt
PacketPtr retryPkt
Definition: GarnetSyntheticTraffic.hh:108
Addr
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
GarnetSyntheticTraffic::tickEvent
EventFunctionWrapper tickEvent
Definition: GarnetSyntheticTraffic.hh:75
GarnetSyntheticTraffic::size
unsigned size
Definition: GarnetSyntheticTraffic.hh:109
GarnetSyntheticTraffic
Definition: GarnetSyntheticTraffic.hh:54
GarnetSyntheticTraffic::doRetry
void doRetry()
Definition: GarnetSyntheticTraffic.cc:339
TRANSPOSE_
@ TRANSPOSE_
Definition: GarnetSyntheticTraffic.hh:49
GarnetSyntheticTraffic::CpuPort::recvReqRetry
virtual void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
Definition: GarnetSyntheticTraffic.cc:60
GarnetSyntheticTraffic::tick
void tick()
Definition: GarnetSyntheticTraffic.cc:141
clocked_object.hh
Packet
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Definition: packet.hh:257
UNIFORM_RANDOM_
@ UNIFORM_RANDOM_
Definition: GarnetSyntheticTraffic.hh:50
GarnetSyntheticTraffic::sendPkt
void sendPkt(PacketPtr pkt)
Definition: GarnetSyntheticTraffic.cc:66
GarnetSyntheticTraffic::traffic
TrafficType traffic
Definition: GarnetSyntheticTraffic.hh:126
GarnetSyntheticTraffic::numDestinations
int numDestinations
Definition: GarnetSyntheticTraffic.hh:118
Cycles
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:83
GarnetSyntheticTraffic::injRate
double injRate
Definition: GarnetSyntheticTraffic.hh:127
GarnetSyntheticTraffic::simCycles
Tick simCycles
Definition: GarnetSyntheticTraffic.hh:119
GarnetSyntheticTraffic::completeRequest
void completeRequest(PacketPtr pkt)
Definition: GarnetSyntheticTraffic.cc:127
BIT_ROTATION_
@ BIT_ROTATION_
Definition: GarnetSyntheticTraffic.hh:45
MipsISA::p
Bitfield< 0 > p
Definition: pra_constants.hh:323
GarnetSyntheticTraffic::precision
int precision
Definition: GarnetSyntheticTraffic.hh:129
TORNADO_
@ TORNADO_
Definition: GarnetSyntheticTraffic.hh:48
GarnetSyntheticTraffic::CpuPort::recvTimingResp
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
Definition: GarnetSyntheticTraffic.cc:53
GarnetSyntheticTraffic::GarnetSyntheticTrafficSenderState
Definition: GarnetSyntheticTraffic.hh:96
BIT_COMPLEMENT_
@ BIT_COMPLEMENT_
Definition: GarnetSyntheticTraffic.hh:43
eventq.hh

Generated on Wed Sep 30 2020 14:02:09 for gem5 by doxygen 1.8.17