gem5  v20.0.0.2
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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;
58  GarnetSyntheticTraffic(const Params *p);
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 MasterPort
78  {
80 
81  public:
82 
83  CpuPort(const std::string &_name, GarnetSyntheticTraffic *_tester)
84  : MasterPort(_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__
A MasterPort is a specialisation of a BaseMasterPort, which implements the default protocol for the t...
Definition: port.hh:71
Ports are used to interface objects to each other.
Definition: port.hh:56
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:81
const PortID InvalidPortID
Definition: types.hh:236
Bitfield< 8 > a
void completeRequest(PacketPtr pkt)
GarnetSyntheticTraffic(const Params *p)
Declaration of Statistics objects.
virtual bool recvTimingResp(PacketPtr pkt)
Receive a timing response from the peer.
void printAddr(Addr a)
Print state of address in memory system via PrintReq (for debugging).
uint64_t Tick
Tick count type.
Definition: types.hh:61
CpuPort(const std::string &_name, GarnetSyntheticTraffic *_tester)
The ClockedObject class extends the SimObject with a clock and accessor functions to relate ticks to ...
ClockedObject declaration and implementation.
Port Object Declaration.
GarnetSyntheticTrafficParams Params
std::map< std::string, TrafficType > trafficStringToEnum
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
uint16_t MasterID
Definition: request.hh:84
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:249
A virtual base opaque structure used to hold state associated with the packet (e.g., an MSHR), specific to a SimObject that sees the packet.
Definition: packet.hh:397
Port & getPort(const std::string &if_name, PortID idx=InvalidPortID) override
Get a port with a given name and index.
virtual void recvReqRetry()
Called by the peer if sendTimingReq was called on this peer (causing recvTimingReq to be called on th...
int16_t PortID
Port index/ID type, and a symbolic name for an invalid port id.
Definition: types.hh:235
Bitfield< 0 > p
const char data[]
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
EventFunctionWrapper tickEvent

Generated on Mon Jun 8 2020 15:45:09 for gem5 by doxygen 1.8.13