gem5  v22.1.0.0
trace_cpu.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 - 2016 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 hereunder. You may use the software subject to the license
10  * terms below provided that you ensure that this notice is replicated
11  * unmodified and in its entirety in all distributions of the software,
12  * modified or unmodified, in source code or in binary form.
13  *
14  * Redistribution and use in source and binary forms, with or without
15  * modification, are permitted provided that the following conditions are
16  * met: redistributions of source code must retain the above copyright
17  * notice, this list of conditions and the following disclaimer;
18  * redistributions in binary form must reproduce the above copyright
19  * notice, this list of conditions and the following disclaimer in the
20  * documentation and/or other materials provided with the distribution;
21  * neither the name of the copyright holders nor the names of its
22  * contributors may be used to endorse or promote products derived from
23  * this software without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
28  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
29  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
31  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36  */
37 
38 #ifndef __CPU_TRACE_TRACE_CPU_HH__
39 #define __CPU_TRACE_TRACE_CPU_HH__
40 
41 #include <cstdint>
42 #include <list>
43 #include <queue>
44 #include <set>
45 #include <unordered_map>
46 
47 #include "base/statistics.hh"
48 #include "cpu/base.hh"
49 #include "debug/TraceCPUData.hh"
50 #include "debug/TraceCPUInst.hh"
51 #include "params/TraceCPU.hh"
52 #include "proto/inst_dep_record.pb.h"
53 #include "proto/packet.pb.h"
54 #include "proto/protoio.hh"
55 #include "sim/sim_events.hh"
56 
57 namespace gem5
58 {
59 
142 class TraceCPU : public BaseCPU
143 {
144 
145  public:
146  TraceCPU(const TraceCPUParams &params);
147 
148  void init();
149 
157  Counter totalInsts() const { return 0; }
158 
165  Counter totalOps() const { return traceStats.numOps.value(); }
166 
167  /*
168  * Set the no. of ops when elastic data generator completes executing a
169  * node.
170  */
171  void updateNumOps(uint64_t rob_num);
172 
173  /* Pure virtual function in BaseCPU. Do nothing. */
174  void wakeup(ThreadID tid=0) { return; }
175 
176  /*
177  * When resuming from checkpoint in FS mode, the TraceCPU takes over from
178  * the old cpu. This function overrides the takeOverFrom() function in the
179  * BaseCPU. It unbinds the ports of the old CPU and binds the ports of the
180  * TraceCPU.
181  */
182  void takeOverFrom(BaseCPU *oldCPU);
183 
188  void icacheRetryRecvd();
189 
194  void dcacheRetryRecvd();
195 
203 
209  void schedDcacheNextEvent(Tick when);
210 
211  protected:
212 
216  class IcachePort : public RequestPort
217  {
218  public:
221  RequestPort(_cpu->name() + ".icache_port", _cpu), owner(_cpu)
222  {}
223 
224  public:
233  bool recvTimingResp(PacketPtr pkt);
234 
241 
246  void recvReqRetry();
247 
248  private:
250  };
251 
255  class DcachePort : public RequestPort
256  {
257 
258  public:
261  RequestPort(_cpu->name() + ".dcache_port", _cpu), owner(_cpu)
262  {}
263 
264  public:
265 
273  bool recvTimingResp(PacketPtr pkt);
274 
281 
288 
293  void recvReqRetry();
294 
300  bool isSnooping() const { return true; }
301 
302  private:
304  };
305 
308 
311 
314 
317 
320 
328  {
329 
330  private:
331 
336  {
337 
340 
343 
346 
349 
352 
355 
361  bool isValid() const { return cmd != MemCmd::InvalidCmd; }
362 
367  };
368 
375  {
376  private:
377  // Input file stream for the protobuf trace
379 
380  public:
386  InputStream(const std::string& filename);
387 
392  void reset();
393 
402  bool read(TraceElement* element);
403  };
404 
405  public:
406  /* Constructor */
407  FixedRetryGen(TraceCPU& _owner, const std::string& _name,
408  RequestPort& _port, RequestorID requestor_id,
409  const std::string& trace_file) :
410  owner(_owner),
411  port(_port),
412  requestorId(requestor_id),
413  trace(trace_file),
414  genName(owner.name() + ".fixedretry." + _name),
415  retryPkt(nullptr),
416  delta(0),
417  traceComplete(false), fixedStats(&_owner, _name)
418  {
419  }
420 
427  Tick init();
428 
435  bool tryNext();
436 
438  const std::string& name() const { return genName; }
439 
453  bool send(Addr addr, unsigned size, const MemCmd& cmd,
455 
457  void exit();
458 
466  bool nextExecute();
467 
474  bool isTraceComplete() { return traceComplete; }
475 
476  int64_t tickDelta() { return delta; }
477 
478  private:
481 
484 
487 
490 
492  std::string genName;
493 
496 
502  int64_t delta;
503 
508 
511  protected:
513  {
516  const std::string& _name);
525 
526  };
527 
540  {
541  private:
543  typedef uint64_t NodeSeqNum;
544 
546  typedef uint64_t NodeRobNum;
547 
548  typedef ProtoMessage::InstDepRecord::RecordType RecordType;
549  typedef ProtoMessage::InstDepRecord Record;
550 
557  class GraphNode
558  {
559  public:
562 
565 
568 
571 
577 
580 
583 
585  uint32_t size;
586 
589 
592 
595 
597  uint64_t compDelay;
598 
604 
611 
613  bool isLoad() const { return (type == Record::LOAD); }
614 
616  bool isStore() const { return (type == Record::STORE); }
617 
619  bool isComp() const { return (type == Record::COMP); }
620 
622  bool removeRegDep(NodeSeqNum reg_dep);
623 
625  bool removeRobDep(NodeSeqNum rob_dep);
626 
628  bool removeDepOnInst(NodeSeqNum done_seq_num);
629 
631  bool
633  {
635  }
640  void writeElementAsTrace() const;
641 
643  std::string typeToStr() const;
644  };
645 
647  struct ReadyNode
648  {
651 
654  };
655 
662  {
663  public:
671  HardwareResource(uint16_t max_rob, uint16_t max_stores,
672  uint16_t max_loads);
673 
679  void occupy(const GraphNode* new_node);
680 
686  void release(const GraphNode* done_node);
687 
689  void releaseStoreBuffer();
690 
697  bool isAvailable(const GraphNode* new_node) const;
698 
706  bool awaitingResponse() const;
707 
709  void printOccupancy();
710 
711  private:
716  const uint16_t sizeROB;
717 
722  const uint16_t sizeStoreBuffer;
723 
728  const uint16_t sizeLoadBuffer;
729 
740  std::map<NodeSeqNum, NodeRobNum> inFlightNodes;
741 
744 
749 
754  };
755 
762  {
763  private:
766 
773  const double timeMultiplier;
774 
776  uint64_t microOpCount;
777 
782  uint32_t windowSize;
783 
784  public:
791  InputStream(const std::string& filename,
792  const double time_multiplier);
793 
798  void reset();
799 
809  bool read(GraphNode* element);
810 
812  uint32_t getWindowSize() const { return windowSize; }
813 
815  uint64_t getMicroOpCount() const { return microOpCount; }
816  };
817 
818  public:
819  /* Constructor */
820  ElasticDataGen(TraceCPU& _owner, const std::string& _name,
821  RequestPort& _port, RequestorID requestor_id,
822  const std::string& trace_file,
823  const TraceCPUParams &params) :
824  owner(_owner),
825  port(_port),
826  requestorId(requestor_id),
827  trace(trace_file, 1.0 / params.freqMultiplier),
828  genName(owner.name() + ".elastic." + _name),
829  retryPkt(nullptr),
830  traceComplete(false),
831  nextRead(false),
832  execComplete(false),
833  windowSize(trace.getWindowSize()),
834  hwResource(params.sizeROB, params.sizeStoreBuffer,
835  params.sizeLoadBuffer), elasticStats(&_owner, _name)
836  {
837  DPRINTF(TraceCPUData, "Window size in the trace is %d.\n",
838  windowSize);
839  }
840 
847  Tick init();
848 
856 
858  const std::string& name() const { return genName; }
859 
861  void exit();
862 
870  bool readNextWindow();
871 
880  template<typename T>
881  void addDepsOnParent(GraphNode *new_node, T& dep_list);
882 
892  void execute();
893 
904  PacketPtr executeMemReq(GraphNode* node_ptr);
905 
913  void addToSortedReadyList(NodeSeqNum seq_num, Tick exec_tick);
914 
916  void printReadyList();
917 
923  void completeMemAccess(PacketPtr pkt);
924 
931  bool isExecComplete() const { return execComplete; }
932 
943  bool checkAndIssue(const GraphNode* node_ptr, bool first=true);
944 
946  uint64_t getMicroOpCount() const { return trace.getMicroOpCount(); }
947 
948  private:
951 
954 
957 
960 
962  std::string genName;
963 
966 
969 
971  bool nextRead;
972 
975 
985  const uint32_t windowSize;
986 
992 
994  std::unordered_map<NodeSeqNum, GraphNode*> depGraph;
995 
1003  std::queue<const GraphNode*> depFreeQueue;
1004 
1007 
1008  protected:
1009  // Defining the a stat group
1011  {
1014  const std::string& _name);
1028  };
1029 
1032 
1035 
1042  void schedIcacheNext();
1043 
1049  void schedDcacheNext();
1050 
1053 
1056 
1061  void checkAndSchedExitEvent();
1062 
1065 
1073 
1080  static int numTraceCPUs;
1081 
1088 
1093  const bool enableEarlyExit;
1094 
1099  const uint64_t progressMsgInterval;
1100 
1101  /*
1102  * The progress msg threshold is kept updated to the next multiple of the
1103  * progress msg interval. As soon as the threshold is reached, an info
1104  * message is printed.
1105  */
1108  {
1109  TraceStats(TraceCPU *trace);
1112 
1119 
1120  public:
1121 
1123  Port &getInstPort() { return icachePort; }
1124 
1126  Port &getDataPort() { return dcachePort; }
1127 
1128 };
1129 
1130 } // namespace gem5
1131 
1132 #endif // __CPU_TRACE_TRACE_CPU_HH__
#define DPRINTF(x,...)
Definition: trace.hh:186
A ProtoInputStream wraps a coded stream, potentially with decompression, based on looking at the file...
Definition: protoio.hh:141
@ InvalidCmd
Definition: packet.hh:85
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:294
Ports are used to interface objects to each other.
Definition: port.hh:62
const std::string name() const
Return port name (for DPRINTF).
Definition: port.hh:111
A RequestPort is a specialisation of a Port, which implements the default protocol for the three diff...
Definition: port.hh:79
uint64_t FlagsType
Definition: request.hh:100
@ STRICT_ORDER
The request is required to be strictly ordered by CPU models and is non-speculative.
Definition: request.hh:135
DcachePort class that interfaces with L1 Data Cache.
Definition: trace_cpu.hh:256
bool isSnooping() const
Required functionally.
Definition: trace_cpu.hh:300
void recvFunctionalSnoop(PacketPtr pkt)
Required functionally but do nothing.
Definition: trace_cpu.hh:287
DcachePort(TraceCPU *_cpu)
Default constructor.
Definition: trace_cpu.hh:260
bool recvTimingResp(PacketPtr pkt)
Receive the timing reponse and call dcacheRecvTimingResp() method of the dcacheGen to handle completi...
Definition: trace_cpu.cc:1179
void recvTimingSnoopReq(PacketPtr pkt)
Required functionally but do nothing.
Definition: trace_cpu.hh:280
void recvReqRetry()
Handle a retry signalled by the cache if data access failed in the first attempt.
Definition: trace_cpu.cc:1192
The struct GraphNode stores an instruction in the trace file.
Definition: trace_cpu.hh:558
bool isLoad() const
Is the node a load.
Definition: trace_cpu.hh:613
bool isComp() const
Is the node a compute (non load/store) node.
Definition: trace_cpu.hh:619
RecordType type
Type of the node corresponding to the instruction modeled by it.
Definition: trace_cpu.hh:576
bool isStrictlyOrdered() const
Return true if node has a request which is strictly ordered.
Definition: trace_cpu.hh:632
bool removeDepOnInst(NodeSeqNum done_seq_num)
Check for all dependencies on completed inst.
Definition: trace_cpu.cc:1330
std::vector< GraphNode * > dependents
A vector of nodes dependent (outgoing) on this node.
Definition: trace_cpu.hh:610
std::list< NodeSeqNum > RobDepList
Typedef for the list containing the ROB dependencies.
Definition: trace_cpu.hh:561
bool removeRobDep(NodeSeqNum rob_dep)
Remove completed instruction from order dependency array.
Definition: trace_cpu.cc:1314
std::list< NodeSeqNum > RegDepList
Typedef for the list containing the register dependencies.
Definition: trace_cpu.hh:564
Request::Flags flags
Request flags if any.
Definition: trace_cpu.hh:588
RegDepList regDep
List of register dependencies (incoming) if any.
Definition: trace_cpu.hh:603
uint32_t size
Size of request if any.
Definition: trace_cpu.hh:585
NodeRobNum robNum
ROB occupancy number.
Definition: trace_cpu.hh:570
std::string typeToStr() const
Return string specifying the type of the node.
Definition: trace_cpu.cc:1376
void writeElementAsTrace() const
Write out element in trace-compatible format using debug flag TraceCPUData.
Definition: trace_cpu.cc:1345
RobDepList robDep
List of order dependencies.
Definition: trace_cpu.hh:594
Addr physAddr
The address for the request if any.
Definition: trace_cpu.hh:579
Addr virtAddr
The virtual address for the request if any.
Definition: trace_cpu.hh:582
bool isStore() const
Is the node a store.
Definition: trace_cpu.hh:616
uint64_t compDelay
Computational delay.
Definition: trace_cpu.hh:597
NodeSeqNum seqNum
Instruction sequence number.
Definition: trace_cpu.hh:567
bool removeRegDep(NodeSeqNum reg_dep)
Remove completed instruction from register dependency array.
Definition: trace_cpu.cc:1296
The HardwareResource class models structures that hold the in-flight nodes.
Definition: trace_cpu.hh:662
uint16_t numInFlightStores
Number of ready stores for which request may or may not be sent.
Definition: trace_cpu.hh:753
const uint16_t sizeStoreBuffer
The size of store buffer.
Definition: trace_cpu.hh:722
void occupy(const GraphNode *new_node)
Occupy appropriate structures for an issued node.
Definition: trace_cpu.cc:842
void release(const GraphNode *done_node)
Release appropriate structures for a completed node.
Definition: trace_cpu.cc:861
uint16_t numInFlightLoads
Number of ready loads for which request may or may not be sent.
Definition: trace_cpu.hh:748
bool awaitingResponse() const
Check if there are any outstanding requests, i.e.
Definition: trace_cpu.cc:955
NodeRobNum oldestInFlightRobNum
The ROB number of the oldest in-flight node.
Definition: trace_cpu.hh:743
std::map< NodeSeqNum, NodeRobNum > inFlightNodes
A map from the sequence number to the ROB number of the in- flight nodes.
Definition: trace_cpu.hh:740
void printOccupancy()
Print resource occupancy for debugging.
Definition: trace_cpu.cc:962
const uint16_t sizeROB
The size of the ROB used to throttle the max.
Definition: trace_cpu.hh:716
HardwareResource(uint16_t max_rob, uint16_t max_stores, uint16_t max_loads)
Constructor that initializes the sizes of the structures.
Definition: trace_cpu.cc:831
const uint16_t sizeLoadBuffer
The size of load buffer.
Definition: trace_cpu.hh:728
void releaseStoreBuffer()
Release store buffer entry for a completed store.
Definition: trace_cpu.cc:904
bool isAvailable(const GraphNode *new_node) const
Check if structures required to issue a node are free.
Definition: trace_cpu.cc:911
The InputStream encapsulates a trace file and the internal buffers and populates GraphNodes based on ...
Definition: trace_cpu.hh:762
const double timeMultiplier
A multiplier for the compute delays in the trace to modulate the Trace CPU frequency either up or dow...
Definition: trace_cpu.hh:773
ProtoInputStream trace
Input file stream for the protobuf trace.
Definition: trace_cpu.hh:765
InputStream(const std::string &filename, const double time_multiplier)
Create a trace input stream for a given file name.
Definition: trace_cpu.cc:1197
bool read(GraphNode *element)
Attempt to read a trace element from the stream, and also notify the caller if the end of the file wa...
Definition: trace_cpu.cc:1226
uint32_t getWindowSize() const
Get window size from trace.
Definition: trace_cpu.hh:812
uint32_t windowSize
The window size that is read from the header of the protobuf trace and used to process the dependency...
Definition: trace_cpu.hh:782
void reset()
Reset the stream such that it can be played once again.
Definition: trace_cpu.cc:1220
uint64_t microOpCount
Count of committed ops read from trace plus the filtered ops.
Definition: trace_cpu.hh:776
uint64_t getMicroOpCount() const
Get number of micro-ops modelled in the TraceCPU replay.
Definition: trace_cpu.hh:815
The elastic data memory request generator to read protobuf trace containing execution trace annotated...
Definition: trace_cpu.hh:540
const uint32_t windowSize
Window size within which to check for dependencies.
Definition: trace_cpu.hh:985
uint64_t NodeRobNum
Node ROB number type.
Definition: trace_cpu.hh:546
bool readNextWindow()
Reads a line of the trace file.
Definition: trace_cpu.cc:297
PacketPtr executeMemReq(GraphNode *node_ptr)
Creates a new request for a load or store assigning the request parameters.
Definition: trace_cpu.cc:571
ProtoMessage::InstDepRecord::RecordType RecordType
Definition: trace_cpu.hh:548
void printReadyList()
Print readyList for debugging using debug flag TraceCPUData.
Definition: trace_cpu.cc:814
bool isExecComplete() const
Returns the execComplete variable which is set when the last node is executed.
Definition: trace_cpu.hh:931
TraceCPU & owner
Reference of the TraceCPU.
Definition: trace_cpu.hh:950
const RequestorID requestorId
RequestorID used for the requests being sent.
Definition: trace_cpu.hh:956
Tick init()
Called from TraceCPU init().
Definition: trace_cpu.cc:252
const std::string & name() const
Returns name of the ElasticDataGen instance.
Definition: trace_cpu.hh:858
ProtoMessage::InstDepRecord Record
Definition: trace_cpu.hh:549
uint64_t NodeSeqNum
Node sequence number type.
Definition: trace_cpu.hh:543
void adjustInitTraceOffset(Tick &offset)
Adjust traceOffset based on what TraceCPU init() determines on comparing the offsets in the fetch req...
Definition: trace_cpu.cc:283
bool checkAndIssue(const GraphNode *node_ptr, bool first=true)
Attempts to issue a node once the node's source dependencies are complete.
Definition: trace_cpu.cc:647
std::list< ReadyNode > readyList
List of nodes that are ready to execute.
Definition: trace_cpu.hh:1006
PacketPtr retryPkt
PacketPtr used to store the packet to retry.
Definition: trace_cpu.hh:965
bool traceComplete
Set to true when end of trace is reached.
Definition: trace_cpu.hh:968
void exit()
Exit the ElasticDataGen.
Definition: trace_cpu.cc:291
ElasticDataGen(TraceCPU &_owner, const std::string &_name, RequestPort &_port, RequestorID requestor_id, const std::string &trace_file, const TraceCPUParams &params)
Definition: trace_cpu.hh:820
bool nextRead
Set to true when the next window of instructions need to be read.
Definition: trace_cpu.hh:971
std::queue< const GraphNode * > depFreeQueue
Queue of dependency-free nodes that are pending issue because resources are not available.
Definition: trace_cpu.hh:1003
gem5::TraceCPU::ElasticDataGen::ElasticDataGenStatGroup elasticStats
std::unordered_map< NodeSeqNum, GraphNode * > depGraph
Store the depGraph of GraphNodes.
Definition: trace_cpu.hh:994
uint64_t getMicroOpCount() const
Get number of micro-ops modelled in the TraceCPU replay.
Definition: trace_cpu.hh:946
std::string genName
String to store the name of the FixedRetryGen.
Definition: trace_cpu.hh:962
void addDepsOnParent(GraphNode *new_node, T &dep_list)
Iterate over the dependencies of a new node and add the new node to the list of dependents of the par...
Definition: trace_cpu.cc:350
bool execComplete
Set true when execution of trace is complete.
Definition: trace_cpu.hh:974
RequestPort & port
Reference of the port to be used to issue memory requests.
Definition: trace_cpu.hh:953
HardwareResource hwResource
Hardware resources required to contain in-flight nodes and to throttle issuing of new nodes when reso...
Definition: trace_cpu.hh:991
void addToSortedReadyList(NodeSeqNum seq_num, Tick exec_tick)
Add a ready node to the readyList.
Definition: trace_cpu.cc:754
InputStream trace
Input stream used for reading the input trace file.
Definition: trace_cpu.hh:959
void execute()
This is the main execute function which consumes nodes from the sorted readyList.
Definition: trace_cpu.cc:375
void completeMemAccess(PacketPtr pkt)
When a load writeback is received, that is when the load completes, release the dependents on it.
Definition: trace_cpu.cc:687
The InputStream encapsulates a trace file and the internal buffers and populates TraceElements based ...
Definition: trace_cpu.hh:375
InputStream(const std::string &filename)
Create a trace input stream for a given file name.
Definition: trace_cpu.cc:1381
bool read(TraceElement *element)
Attempt to read a trace element from the stream, and also notify the caller if the end of the file wa...
Definition: trace_cpu.cc:1403
void reset()
Reset the stream such that it can be played once again.
Definition: trace_cpu.cc:1397
Generator to read protobuf trace containing memory requests at fixed timestamps, perform flow control...
Definition: trace_cpu.hh:328
TraceCPU & owner
Reference of the TraceCPU.
Definition: trace_cpu.hh:480
int64_t delta
Stores the difference in the send ticks of the current and last packets.
Definition: trace_cpu.hh:502
Tick init()
Called from TraceCPU init().
Definition: trace_cpu.cc:989
const RequestorID requestorId
RequestorID used for the requests being sent.
Definition: trace_cpu.hh:486
FixedRetryGen(TraceCPU &_owner, const std::string &_name, RequestPort &_port, RequestorID requestor_id, const std::string &trace_file)
Definition: trace_cpu.hh:407
gem5::TraceCPU::FixedRetryGen::FixedRetryGenStatGroup fixedStats
TraceElement currElement
Store an element read from the trace to send as the next packet.
Definition: trace_cpu.hh:510
bool nextExecute()
Reads a line of the trace file.
Definition: trace_cpu.cc:1057
bool traceComplete
Set to true when end of trace is reached.
Definition: trace_cpu.hh:507
PacketPtr retryPkt
PacketPtr used to store the packet to retry.
Definition: trace_cpu.hh:495
bool isTraceComplete()
Returns the traceComplete variable which is set when end of the input trace file is reached.
Definition: trace_cpu.hh:474
std::string genName
String to store the name of the FixedRetryGen.
Definition: trace_cpu.hh:492
void exit()
Exit the FixedRetryGen.
Definition: trace_cpu.cc:1051
RequestPort & port
Reference of the port to be used to issue memory requests.
Definition: trace_cpu.hh:483
InputStream trace
Input stream used for reading the input trace file.
Definition: trace_cpu.hh:489
const std::string & name() const
Returns name of the FixedRetryGen instance.
Definition: trace_cpu.hh:438
bool send(Addr addr, unsigned size, const MemCmd &cmd, Request::FlagsType flags, Addr pc)
Creates a new request assigning the request parameters passed by the arguments.
Definition: trace_cpu.cc:1088
bool tryNext()
This tries to send current or retry packet and returns true if successfull.
Definition: trace_cpu.cc:1004
IcachePort class that interfaces with L1 Instruction Cache.
Definition: trace_cpu.hh:217
void recvTimingSnoopReq(PacketPtr pkt)
Required functionally but do nothing.
Definition: trace_cpu.hh:240
IcachePort(TraceCPU *_cpu)
Default constructor.
Definition: trace_cpu.hh:220
void recvReqRetry()
Handle a retry signalled by the cache if instruction read failed in the first attempt.
Definition: trace_cpu.cc:1166
bool recvTimingResp(PacketPtr pkt)
Receive the timing reponse and simply delete the packet since instruction fetch requests are issued a...
Definition: trace_cpu.cc:1156
The trace cpu replays traces generated using the elastic trace probe attached to the O3 CPU model.
Definition: trace_cpu.hh:143
const uint64_t progressMsgInterval
Interval of committed instructions specified by the user at which a progress info message is printed.
Definition: trace_cpu.hh:1099
Port & getInstPort()
Used to get a reference to the icache port.
Definition: trace_cpu.hh:1123
DcachePort dcachePort
Port to connect to L1 data cache.
Definition: trace_cpu.hh:310
const bool enableEarlyExit
Exit when any one Trace CPU completes its execution.
Definition: trace_cpu.hh:1093
IcachePort icachePort
Port to connect to L1 instruction cache.
Definition: trace_cpu.hh:307
Counter totalInsts() const
This is a pure virtual function in BaseCPU.
Definition: trace_cpu.hh:157
const RequestorID instRequestorID
Requestor id for instruction read requests.
Definition: trace_cpu.hh:313
Port & getDataPort()
Used to get a reference to the dcache port.
Definition: trace_cpu.hh:1126
bool oneTraceComplete
Set to true when one of the generators finishes replaying its trace.
Definition: trace_cpu.hh:1064
void dcacheRetryRecvd()
When data cache port receives a retry, schedule event dcacheNextEvent.
Definition: trace_cpu.cc:1130
Tick traceOffset
This stores the time offset in the trace, which is taken away from the ready times of requests.
Definition: trace_cpu.hh:1072
gem5::TraceCPU::TraceStats traceStats
ElasticDataGen dcacheGen
Instance of ElasticDataGen to replay data read and write requests.
Definition: trace_cpu.hh:1034
std::string instTraceFile
File names for input instruction and data traces.
Definition: trace_cpu.hh:319
const RequestorID dataRequestorID
Requestor id for data read and write requests.
Definition: trace_cpu.hh:316
Counter totalOps() const
Return totalOps as the number of committed micro-ops plus the speculatively issued loads that are mod...
Definition: trace_cpu.hh:165
FixedRetryGen icacheGen
Instance of FixedRetryGen to replay instruction read requests.
Definition: trace_cpu.hh:1031
TraceCPU(const TraceCPUParams &params)
Definition: trace_cpu.cc:49
void updateNumOps(uint64_t rob_num)
Definition: trace_cpu.cc:86
void wakeup(ThreadID tid=0)
Definition: trace_cpu.hh:174
std::string dataTraceFile
Definition: trace_cpu.hh:319
uint64_t progressMsgThreshold
Definition: trace_cpu.hh:1106
void dcacheRecvTimingResp(PacketPtr pkt)
When data cache port receives a response, this calls the dcache generator method handle to complete t...
Definition: trace_cpu.cc:1172
void init()
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: trace_cpu.cc:105
void icacheRetryRecvd()
When instruction cache port receives a retry, schedule event icacheNextEvent.
Definition: trace_cpu.cc:1120
EventFunctionWrapper dcacheNextEvent
Event for the control flow method schedDcacheNext()
Definition: trace_cpu.hh:1055
static int numTraceCPUs
Number of Trace CPUs in the system used as a shared variable and passed to the CountedExitEvent event...
Definition: trace_cpu.hh:1080
void takeOverFrom(BaseCPU *oldCPU)
Load the state of a CPU from the previous CPU object, invoked on all new CPUs that are about to be sw...
Definition: trace_cpu.cc:97
EventFunctionWrapper icacheNextEvent
Event for the control flow method schedIcacheNext()
Definition: trace_cpu.hh:1052
void schedDcacheNextEvent(Tick when)
Schedule event dcacheNextEvent at the given tick.
Definition: trace_cpu.cc:1140
CountedExitEvent * execCompleteEvent
A CountedExitEvent which when serviced decrements the counter.
Definition: trace_cpu.hh:1087
void checkAndSchedExitEvent()
This is called when either generator finishes executing from the trace.
Definition: trace_cpu.cc:188
void schedDcacheNext()
This is the control flow that uses the functionality of the dcacheGen to replay the trace.
Definition: trace_cpu.cc:174
void schedIcacheNext()
This is the control flow that uses the functionality of the icacheGen to replay the trace.
Definition: trace_cpu.cc:148
A formula for statistics that is calculated when printed.
Definition: statistics.hh:2540
Statistics container.
Definition: group.hh:94
Counter value() const
Return the current value of this stat as its base type.
Definition: statistics.hh:622
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:1931
STL vector class.
Definition: stl.hh:37
bool isSet(Type mask) const
Verifies whether any bit matching the given mask is set.
Definition: flags.hh:83
const Params & params() const
Definition: sim_object.hh:176
uint8_t flags
Definition: helpers.cc:66
Bitfield< 23, 0 > offset
Definition: types.hh:144
Bitfield< 4 > pc
Bitfield< 3 > addr
Definition: types.hh:84
double Counter
All counters are of 64-bit values.
Definition: types.hh:47
Reference material can be found at the JEDEC website: UFS standard http://www.jedec....
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:235
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:147
uint64_t Tick
Tick count type.
Definition: types.hh:58
uint16_t RequestorID
Definition: request.hh:95
Declaration of a wrapper for protobuf output streams and input streams.
Declaration of Statistics objects.
statistics::Scalar maxDependents
Stats for data memory accesses replayed.
Definition: trace_cpu.hh:1016
statistics::Scalar dataLastTick
Tick when ElasticDataGen completes execution.
Definition: trace_cpu.hh:1026
ElasticDataGenStatGroup(statistics::Group *parent, const std::string &_name)
name is the extension to the name for these stats
Definition: trace_cpu.cc:225
Struct to store a ready-to-execute node and its execution tick.
Definition: trace_cpu.hh:648
Tick execTick
The tick at which the ready node must be executed.
Definition: trace_cpu.hh:653
NodeSeqNum seqNum
The sequence number of the ready node.
Definition: trace_cpu.hh:650
statistics::Scalar numSendAttempted
Stats for instruction accesses replayed.
Definition: trace_cpu.hh:518
FixedRetryGenStatGroup(statistics::Group *parent, const std::string &_name)
name is the extension to the name for these stats
Definition: trace_cpu.cc:971
statistics::Scalar instLastTick
Last simulated tick by the FixedRetryGen.
Definition: trace_cpu.hh:523
This struct stores a line in the trace file.
Definition: trace_cpu.hh:336
void clear()
Make this element invalid.
Definition: trace_cpu.hh:366
MemCmd cmd
Specifies if the request is to be a read or a write.
Definition: trace_cpu.hh:339
Addr addr
The address for the request.
Definition: trace_cpu.hh:342
Addr blocksize
The size of the access for the request.
Definition: trace_cpu.hh:345
Request::FlagsType flags
Potential request flags to use.
Definition: trace_cpu.hh:351
Tick tick
The time at which the request should be sent.
Definition: trace_cpu.hh:348
bool isValid() const
Check validity of this element.
Definition: trace_cpu.hh:361
statistics::Scalar numSchedDcacheEvent
Definition: trace_cpu.hh:1110
statistics::Scalar numSchedIcacheEvent
Definition: trace_cpu.hh:1111
statistics::Formula cpi
Stat for the CPI.
Definition: trace_cpu.hh:1117
TraceStats(TraceCPU *trace)
Definition: trace_cpu.cc:207
statistics::Scalar numOps
Stat for number of simulated micro-ops.
Definition: trace_cpu.hh:1114

Generated on Wed Dec 21 2022 10:22:32 for gem5 by doxygen 1.9.1