gem5  v20.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
cpu.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011-2013, 2016-2019 ARM Limited
3  * Copyright (c) 2013 Advanced Micro Devices, Inc.
4  * All rights reserved
5  *
6  * The license below extends only to copyright in the software and shall
7  * not be construed as granting a license to any other intellectual
8  * property including but not limited to intellectual property relating
9  * to a hardware implementation of the functionality of the software
10  * licensed hereunder. You may use the software subject to the license
11  * terms below provided that you ensure that this notice is replicated
12  * unmodified and in its entirety in all distributions of the software,
13  * modified or unmodified, in source code or in binary form.
14  *
15  * Copyright (c) 2004-2005 The Regents of The University of Michigan
16  * Copyright (c) 2011 Regents of the University of California
17  * All rights reserved.
18  *
19  * Redistribution and use in source and binary forms, with or without
20  * modification, are permitted provided that the following conditions are
21  * met: redistributions of source code must retain the above copyright
22  * notice, this list of conditions and the following disclaimer;
23  * redistributions in binary form must reproduce the above copyright
24  * notice, this list of conditions and the following disclaimer in the
25  * documentation and/or other materials provided with the distribution;
26  * neither the name of the copyright holders nor the names of its
27  * contributors may be used to endorse or promote products derived from
28  * this software without specific prior written permission.
29  *
30  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
31  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
32  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
33  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
34  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
35  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
36  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
37  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
38  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
39  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
40  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
41  */
42 
43 #ifndef __CPU_O3_CPU_HH__
44 #define __CPU_O3_CPU_HH__
45 
46 #include <iostream>
47 #include <list>
48 #include <queue>
49 #include <set>
50 #include <vector>
51 
52 #include "arch/generic/types.hh"
53 #include "arch/types.hh"
54 #include "base/statistics.hh"
55 #include "config/the_isa.hh"
56 #include "cpu/o3/comm.hh"
57 #include "cpu/o3/cpu_policy.hh"
58 #include "cpu/o3/scoreboard.hh"
59 #include "cpu/o3/thread_state.hh"
60 #include "cpu/activity.hh"
61 #include "cpu/base.hh"
62 #include "cpu/simple_thread.hh"
63 #include "cpu/timebuf.hh"
64 //#include "cpu/o3/thread_context.hh"
65 #include "params/DerivO3CPU.hh"
66 #include "sim/process.hh"
67 
68 template <class>
69 class Checker;
70 class ThreadContext;
71 template <class>
73 
74 class Checkpoint;
75 class Process;
76 
77 struct BaseCPUParams;
78 
79 class BaseO3CPU : public BaseCPU
80 {
81  //Stuff that's pretty ISA independent will go here.
82  public:
83  BaseO3CPU(BaseCPUParams *params);
84 
85  void regStats();
86 };
87 
93 template <class Impl>
94 class FullO3CPU : public BaseO3CPU
95 {
96  public:
97  // Typedefs from the Impl here.
98  typedef typename Impl::CPUPol CPUPolicy;
99  typedef typename Impl::DynInstPtr DynInstPtr;
100  typedef typename Impl::O3CPU O3CPU;
101 
104 
106 
109 
111 
112  friend class O3ThreadContext<Impl>;
113 
114  public:
115  enum Status {
120  SwitchedOut
121  };
122 
126 
129 
130  private:
131 
134 
137 
140  {
141  if (tickEvent.squashed())
142  reschedule(tickEvent, clockEdge(delay));
143  else if (!tickEvent.scheduled())
144  schedule(tickEvent, clockEdge(delay));
145  }
146 
149  {
150  if (tickEvent.scheduled())
151  tickEvent.squash();
152  }
153 
165  bool tryDrain();
166 
176  void drainSanityCheck() const;
177 
179  bool isCpuDrained() const;
180 
181  public:
183  FullO3CPU(DerivO3CPUParams *params);
185  ~FullO3CPU();
186 
188  void regStats() override;
189 
192 
194  void regProbePoints() override;
195 
196  void demapPage(Addr vaddr, uint64_t asn)
197  {
198  this->itb->demapPage(vaddr, asn);
199  this->dtb->demapPage(vaddr, asn);
200  }
201 
202  void demapInstPage(Addr vaddr, uint64_t asn)
203  {
204  this->itb->demapPage(vaddr, asn);
205  }
206 
207  void demapDataPage(Addr vaddr, uint64_t asn)
208  {
209  this->dtb->demapPage(vaddr, asn);
210  }
211 
215  void tick();
216 
218  void init() override;
219 
220  void startup() override;
221 
224  { return activeThreads.size(); }
225 
227  void activateThread(ThreadID tid);
228 
230  void deactivateThread(ThreadID tid);
231 
233  void insertThread(ThreadID tid);
234 
236  void removeThread(ThreadID tid);
237 
239  Counter totalInsts() const override;
240 
242  Counter totalOps() const override;
243 
245  void activateContext(ThreadID tid) override;
246 
248  void suspendContext(ThreadID tid) override;
249 
253  void haltContext(ThreadID tid) override;
254 
256  void updateThreadPriority();
257 
259  bool isDraining() const { return drainState() == DrainState::Draining; }
260 
261  void serializeThread(CheckpointOut &cp, ThreadID tid) const override;
262  void unserializeThread(CheckpointIn &cp, ThreadID tid) override;
263 
265  void addThreadToExitingList(ThreadID tid);
266 
268  bool isThreadExiting(ThreadID tid) const;
269 
274  void scheduleThreadExitEvent(ThreadID tid);
275 
277  void exitThreads();
278 
279  public:
283  void syscall(ThreadID tid, Fault *fault);
284 
287  DrainState drain() override;
288 
290  void drainResume() override;
291 
299  void commitDrained(ThreadID tid);
300 
302  void switchOut() override;
303 
305  void takeOverFrom(BaseCPU *oldCPU) override;
306 
307  void verifyMemoryMode() const override;
308 
311  { return globalSeqNum++; }
312 
314  void trap(const Fault &fault, ThreadID tid, const StaticInstPtr &inst);
315 
320  void setVectorsAsReady(ThreadID tid);
321 
328  void switchRenameMode(ThreadID tid, UnifiedFreeList* freelist);
329 
331  Fault getInterrupts();
332 
334  void processInterrupts(const Fault &interrupt);
335 
337  void halt() { panic("Halt not implemented!\n"); }
338 
342  RegVal readMiscRegNoEffect(int misc_reg, ThreadID tid) const;
343 
347  RegVal readMiscReg(int misc_reg, ThreadID tid);
348 
350  void setMiscRegNoEffect(int misc_reg, RegVal val, ThreadID tid);
351 
355  void setMiscReg(int misc_reg, RegVal val, ThreadID tid);
356 
357  RegVal readIntReg(PhysRegIdPtr phys_reg);
358 
359  RegVal readFloatReg(PhysRegIdPtr phys_reg);
360 
361  const VecRegContainer& readVecReg(PhysRegIdPtr reg_idx) const;
362 
367 
369  Enums::VecRegRenameMode vecRenameMode() const { return vecMode; }
370 
372  void vecRenameMode(Enums::VecRegRenameMode vec_mode)
373  { vecMode = vec_mode; }
374 
378  template<typename VecElem, int LaneIdx>
380  readVecLane(PhysRegIdPtr phys_reg) const
381  {
382  vecRegfileReads++;
383  return regFile.readVecLane<VecElem, LaneIdx>(phys_reg);
384  }
385 
389  template<typename VecElem>
391  readVecLane(PhysRegIdPtr phys_reg) const
392  {
393  vecRegfileReads++;
394  return regFile.readVecLane<VecElem>(phys_reg);
395  }
396 
398  template<typename LD>
399  void
400  setVecLane(PhysRegIdPtr phys_reg, const LD& val)
401  {
402  vecRegfileWrites++;
403  return regFile.setVecLane(phys_reg, val);
404  }
405 
406  const VecElem& readVecElem(PhysRegIdPtr reg_idx) const;
407 
408  const VecPredRegContainer& readVecPredReg(PhysRegIdPtr reg_idx) const;
409 
411 
412  RegVal readCCReg(PhysRegIdPtr phys_reg);
413 
414  void setIntReg(PhysRegIdPtr phys_reg, RegVal val);
415 
416  void setFloatReg(PhysRegIdPtr phys_reg, RegVal val);
417 
418  void setVecReg(PhysRegIdPtr reg_idx, const VecRegContainer& val);
419 
420  void setVecElem(PhysRegIdPtr reg_idx, const VecElem& val);
421 
422  void setVecPredReg(PhysRegIdPtr reg_idx, const VecPredRegContainer& val);
423 
424  void setCCReg(PhysRegIdPtr phys_reg, RegVal val);
425 
426  RegVal readArchIntReg(int reg_idx, ThreadID tid);
427 
428  RegVal readArchFloatReg(int reg_idx, ThreadID tid);
429 
430  const VecRegContainer& readArchVecReg(int reg_idx, ThreadID tid) const;
432  VecRegContainer& getWritableArchVecReg(int reg_idx, ThreadID tid);
433 
435  template<typename VecElem>
437  readArchVecLane(int reg_idx, int lId, ThreadID tid) const
438  {
439  PhysRegIdPtr phys_reg = commitRenameMap[tid].lookup(
440  RegId(VecRegClass, reg_idx));
441  return readVecLane<VecElem>(phys_reg);
442  }
443 
444 
446  template<typename LD>
447  void
448  setArchVecLane(int reg_idx, int lId, ThreadID tid, const LD& val)
449  {
450  PhysRegIdPtr phys_reg = commitRenameMap[tid].lookup(
451  RegId(VecRegClass, reg_idx));
452  setVecLane(phys_reg, val);
453  }
454 
455  const VecElem& readArchVecElem(const RegIndex& reg_idx,
456  const ElemIndex& ldx, ThreadID tid) const;
457 
458  const VecPredRegContainer& readArchVecPredReg(int reg_idx,
459  ThreadID tid) const;
460 
461  VecPredRegContainer& getWritableArchVecPredReg(int reg_idx, ThreadID tid);
462 
463  RegVal readArchCCReg(int reg_idx, ThreadID tid);
464 
470  void setArchIntReg(int reg_idx, RegVal val, ThreadID tid);
471 
472  void setArchFloatReg(int reg_idx, RegVal val, ThreadID tid);
473 
474  void setArchVecPredReg(int reg_idx, const VecPredRegContainer& val,
475  ThreadID tid);
476 
477  void setArchVecReg(int reg_idx, const VecRegContainer& val, ThreadID tid);
478 
479  void setArchVecElem(const RegIndex& reg_idx, const ElemIndex& ldx,
480  const VecElem& val, ThreadID tid);
481 
482  void setArchCCReg(int reg_idx, RegVal val, ThreadID tid);
483 
485  void pcState(const TheISA::PCState &newPCState, ThreadID tid);
486 
489 
491  Addr instAddr(ThreadID tid);
492 
494  MicroPC microPC(ThreadID tid);
495 
498 
503  void squashFromTC(ThreadID tid);
504 
508  ListIt addInst(const DynInstPtr &inst);
509 
511  void instDone(ThreadID tid, const DynInstPtr &inst);
512 
516  void removeFrontInst(const DynInstPtr &inst);
517 
520  void removeInstsNotInROB(ThreadID tid);
521 
523  void removeInstsUntil(const InstSeqNum &seq_num, ThreadID tid);
524 
526  inline void squashInstIt(const ListIt &instIt, ThreadID tid);
527 
529  void cleanUpRemovedInsts();
530 
532  void dumpInsts();
533 
534  public:
535 #ifndef NDEBUG
536 
538 #endif
539 
542 
546  std::queue<ListIt> removeList;
547 
548 #ifdef DEBUG
549 
552  std::set<InstSeqNum> snList;
553 #endif
554 
559 
560  protected:
562  typename CPUPolicy::Fetch fetch;
563 
565  typename CPUPolicy::Decode decode;
566 
568  typename CPUPolicy::Rename rename;
569 
571  typename CPUPolicy::IEW iew;
572 
574  typename CPUPolicy::Commit commit;
575 
577  Enums::VecRegRenameMode vecMode;
578 
581 
583  typename CPUPolicy::FreeList freeList;
584 
586  typename CPUPolicy::RenameMap renameMap[Impl::MaxThreads];
587 
589  typename CPUPolicy::RenameMap commitRenameMap[Impl::MaxThreads];
590 
592  typename CPUPolicy::ROB rob;
593 
596 
602  std::unordered_map<ThreadID, bool> exitingThreads;
603 
606 
608 
609  public:
614  enum StageIdx {
620  NumStages };
621 
625  typedef typename CPUPolicy::TimeStruct TimeStruct;
626 
627  typedef typename CPUPolicy::FetchStruct FetchStruct;
628 
629  typedef typename CPUPolicy::DecodeStruct DecodeStruct;
630 
631  typedef typename CPUPolicy::RenameStruct RenameStruct;
632 
633  typedef typename CPUPolicy::IEWStruct IEWStruct;
634 
637 
640 
643 
646 
649 
650  private:
656 
657  public:
659  void activityThisCycle() { activityRec.activity(); }
660 
662  void activateStage(const StageIdx idx)
663  { activityRec.activateStage(idx); }
664 
666  void deactivateStage(const StageIdx idx)
667  { activityRec.deactivateStage(idx); }
668 
670  void wakeCPU();
671 
672  virtual void wakeup(ThreadID tid) override;
673 
675  ThreadID getFreeTid();
676 
677  public:
679  ThreadContext *
681  {
682  return thread[tid]->getTC();
683  }
684 
686  InstSeqNum globalSeqNum;//[Impl::MaxThreads];
687 
693 
696 
699 
702 
705 
708 
710  std::map<ThreadID, unsigned> threadMap;
711 
714 
716  Fault pushRequest(const DynInstPtr& inst, bool isLoad, uint8_t *data,
717  unsigned int size, Addr addr, Request::Flags flags,
718  uint64_t *res, AtomicOpFunctorPtr amo_op = nullptr,
719  const std::vector<bool>& byte_enable =
721 
722  {
723  return iew.ldstQueue.pushRequest(inst, isLoad, data, size, addr,
724  flags, res, std::move(amo_op), byte_enable);
725  }
726 
728  Fault read(LSQRequest* req, int load_idx)
729  {
730  return this->iew.ldstQueue.read(req, load_idx);
731  }
732 
734  Fault write(LSQRequest* req, uint8_t *data, int store_idx)
735  {
736  return this->iew.ldstQueue.write(req, data, store_idx);
737  }
738 
740  Port &
741  getInstPort() override
742  {
743  return this->fetch.getInstPort();
744  }
745 
747  Port &
748  getDataPort() override
749  {
750  return this->iew.ldstQueue.getDataPort();
751  }
752 
772 
773  //number of integer register file accesses
776  //number of float register file accesses
779  //number of vector register file accesses
782  //number of predicate register file accesses
785  //number of CC register file accesses
788  //number of misc
791 };
792 
793 #endif // __CPU_O3_CPU_HH__
#define panic(...)
This implements a cprintf based panic() function.
Definition: logging.hh:163
struct IsAapcs64Hfa< E[N], typename std::enable_if< std::is_floating_point< E >::value &&N<=4 >::type > :public std::true_type{};template< typename T, typename Enabled=void >struct IsAapcs64Hva :public std::false_type {};template< typename E, size_t N >struct IsAapcs64Hva< E[N], typename std::enable_if< IsAapcs64ShortVector< E >::value &&N<=4 >::type > :public std::true_type{};template< typename T, typename Enabled=void >struct IsAapcs64Hxa :public std::false_type {};template< typename T >struct IsAapcs64Hxa< T, typename std::enable_if< IsAapcs64Hfa< T >::value||IsAapcs64Hva< T >::value >::type > :public std::true_type{};struct Aapcs64ArgumentBase{ template< typename T > static T loadFromStack(ThreadContext *tc, Aapcs64::State &state) { size_t align=std::max< size_t >(8, alignof(T));size_t size=roundUp(sizeof(T), 8);state.nsaa=roundUp(state.nsaa, align);TypedBufferArg< T > val(state.nsaa);val.copyIn(tc->getVirtProxy());state.nsaa+=size;return gtoh(*val, ArmISA::byteOrder(tc));}};template< typename Float >struct Argument< Aapcs64, Float, typename std::enable_if< std::is_floating_point< Float >::value||IsAapcs64ShortVector< Float >::value >::type > :public Aapcs64ArgumentBase{ static Float get(ThreadContext *tc, Aapcs64::State &state) { if(state.nsrn<=state.MAX_SRN) { RegId id(VecRegClass, state.nsrn++);return tc->readVecReg(id).laneView< Float, 0 >();} return loadFromStack< Float >(tc, state);}};template< typename Float >struct Result< Aapcs64, Float, typename std::enable_if< std::is_floating_point< Float >::value||IsAapcs64ShortVector< Float >::value >::type >{ static void store(ThreadContext *tc, const Float &f) { RegId id(VecRegClass, 0);auto reg=tc-> readVecReg(id)
Definition: aapcs64.hh:204
RegVal readMiscReg(RegIndex misc_reg) override
Reads a misc.
virtual void unserializeThread(CheckpointIn &cp, ThreadID tid)
Unserialize one thread.
Definition: base.hh:427
std::vector< ThreadID > tids
Available thread ids in the cpu.
Definition: cpu.hh:713
Stats::Scalar timesIdled
Stat for total number of times the CPU is descheduled.
Definition: cpu.hh:754
Ports are used to interface objects to each other.
Definition: port.hh:56
void demapDataPage(Addr vaddr, uint64_t asn)
Definition: cpu.hh:207
bool removeInstsThisCycle
Records if instructions need to be removed this cycle due to being retired or squashed.
Definition: cpu.hh:558
const VecPredRegContainer & readVecPredReg(const RegId &id) const override
Fault write(LSQRequest *req, uint8_t *data, int store_idx)
CPU write function, forwards write to LSQ.
Definition: cpu.hh:734
tc setVecReg(id, reg)
Cycles is a wrapper class for representing cycle counts, i.e.
Definition: types.hh:81
VecLaneT< VecElem, true > readVecLane(PhysRegIdPtr phys_reg) const
Read physical vector register lane.
Definition: cpu.hh:391
std::unordered_map< ThreadID, bool > exitingThreads
This is a list of threads that are trying to exit.
Definition: cpu.hh:602
void setArchVecLane(int reg_idx, int lId, ThreadID tid, const LD &val)
Write a lane of the destination vector register.
Definition: cpu.hh:448
virtual void drainResume()
Resume execution after a successful drain.
Definition: drain.hh:277
void demapInstPage(Addr vaddr, uint64_t asn)
Definition: cpu.hh:202
Class that has various thread state, such as the status, the current instruction being processed...
Definition: commit.hh:56
System * system
Pointer to the system.
Definition: cpu.hh:695
void scheduleTickEvent(Cycles delay)
Schedule tick event, regardless of its current state.
Definition: cpu.hh:139
std::vector< Thread * > thread
Pointers to all of the threads in the CPU.
Definition: cpu.hh:698
Port & getInstPort() override
Used by the fetch unit to get a hold of the instruction port.
Definition: cpu.hh:741
Vector Register Abstraction This generic class is the model in a particularization of MVC...
Definition: vec_reg.hh:156
Simple physical register file class.
Definition: regfile.hh:60
Stats::Formula ipc
Stat for the IPC per thread.
Definition: cpu.hh:769
Stats::Scalar intRegfileReads
Definition: cpu.hh:774
CPUPolicy::FetchStruct FetchStruct
Definition: cpu.hh:627
void squash()
Squash the current event.
Definition: eventq.hh:466
TheISA::VecElem VecElem
Definition: cpu.hh:102
bool isDraining() const
Is the CPU draining?
Definition: cpu.hh:259
Stats::Scalar vecPredRegfileWrites
Definition: cpu.hh:784
void setIntReg(RegIndex reg_idx, RegVal val) override
Sets an integer register to a value.
ip6_addr_t addr
Definition: inet.hh:330
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Definition: amo.hh:228
Fault read(LSQRequest *req, int load_idx)
CPU read function, forwards read to LSQ.
Definition: cpu.hh:728
Stats::Vector committedInsts
Stat for the number of committed instructions per thread.
Definition: cpu.hh:761
Stats::Scalar vecRegfileReads
Definition: cpu.hh:780
Status _status
Overall CPU status.
Definition: cpu.hh:128
CPUPolicy::Decode decode
The decode stage.
Definition: cpu.hh:565
virtual void activateContext(ThreadID thread_num)
Notify the CPU that the indicated context is now active.
Definition: base.cc:487
void activity()
Records that there is activity this cycle.
Definition: activity.cc:54
BaseO3CPU(BaseCPUParams *params)
Definition: cpu.cc:72
RegVal readFloatReg(RegIndex reg_idx) const override
CPUPolicy::FreeList freeList
The free list.
Definition: cpu.hh:583
uint64_t RegVal
Definition: types.hh:166
Stats::Scalar miscRegfileReads
Definition: cpu.hh:789
EventFunctionWrapper threadExitEvent
The exit event used for terminating all ready-to-exit threads.
Definition: cpu.hh:136
Definition: system.hh:72
A vector of scalar stats.
Definition: statistics.hh:2547
ProbePointArg< std::pair< DynInstPtr, PacketPtr > > * ppDataAccessComplete
Definition: cpu.hh:191
void setVecLane(PhysRegIdPtr phys_reg, const LD &val)
Write a lane of the destination vector register.
Definition: cpu.hh:400
Stats::Vector committedOps
Stat for the number of committed ops (including micro ops) per thread.
Definition: cpu.hh:763
Definition: cprintf.cc:40
BaseTLB * itb
Definition: cpu.hh:123
void setCCReg(RegIndex reg_idx, RegVal val) override
uint32_t VecElem
Definition: registers.hh:68
ThreadContext is the external interface to all thread state for anything outside of the CPU...
Declaration of Statistics objects.
TimeBuffer< TimeStruct > timeBuffer
The main time buffer to do backwards communication.
Definition: cpu.hh:636
CPUPolicy::Fetch fetch
The fetch stage.
Definition: cpu.hh:562
This is a simple scalar statistic, like a counter.
Definition: statistics.hh:2505
CPUPolicy::ROB rob
The re-order buffer.
Definition: cpu.hh:592
DrainState
Object drain/handover states.
Definition: drain.hh:71
STL vector class.
Definition: stl.hh:37
void setVecLane(const RegId &reg, const LaneData< LaneSize::Byte > &val) override
Write a lane of the destination vector register.
Bitfield< 63 > val
Definition: misc.hh:769
Templated Checker class.
Definition: cpu.hh:618
void deactivateStage(const int idx)
Deactivates a stage.
Definition: activity.cc:107
void setMiscReg(RegIndex misc_reg, RegVal val) override
Sets a misc.
bool squashed() const
Check whether the event is squashed.
Definition: eventq.hh:473
DrainState drainState() const
Return the current drain state of an object.
Definition: drain.hh:308
std::map< ThreadID, unsigned > threadMap
Mapping for system thread id to cpu id.
Definition: cpu.hh:710
RegVal readCCReg(RegIndex reg_idx) const override
int numActiveThreads()
Returns the Number of Active Threads in the CPU.
Definition: cpu.hh:223
Impl::CPUPol CPUPolicy
Definition: cpu.hh:98
Stats::Formula totalCpi
Stat for the total CPI.
Definition: cpu.hh:767
virtual void serializeThread(CheckpointOut &cp, ThreadID tid) const
Serialize a single thread.
Definition: base.hh:419
virtual Counter totalInsts() const =0
void setFloatReg(RegIndex reg_idx, RegVal val) override
Definition: tlb.hh:50
Implements a simple scoreboard to track which registers are ready.
Definition: scoreboard.hh:48
Definition: cpu.hh:79
std::list< ThreadID > activeThreads
Active Threads List.
Definition: cpu.hh:595
uint16_t RegIndex
Definition: types.hh:40
Port & getDataPort() override
Get the dcache port (used to find block size for translations).
Definition: cpu.hh:748
CPUPolicy::RenameStruct RenameStruct
Definition: cpu.hh:631
Enums::VecRegRenameMode vecRenameMode() const
Returns current vector renaming mode.
Definition: cpu.hh:369
virtual void takeOverFrom(BaseCPU *cpu)
Load the state of a CPU from the previous CPU object, invoked on all new CPUs that are about to be sw...
Definition: base.cc:555
uint64_t Tick
Tick count type.
Definition: types.hh:61
Addr instAddr() const override
Reads this thread&#39;s PC.
VecPredReg::Container VecPredRegContainer
Definition: registers.hh:77
Stats::Scalar miscRegfileWrites
Definition: cpu.hh:790
Stats::Scalar intRegfileWrites
Definition: cpu.hh:775
typename LSQ< O3CPUImpl >::LSQRequest LSQRequest
Definition: cpu.hh:125
void activateStage(const int idx)
Marks a stage as active.
Definition: activity.cc:90
CPUPolicy::Commit commit
The commit stage.
Definition: cpu.hh:574
Cycles lastRunningCycle
The cycle that the CPU was last running, used for statistics.
Definition: cpu.hh:704
TheISA::PCState pcState() const override
Reads this thread&#39;s PC state.
void startup() override
startup() is the final initialization call before simulation.
Definition: base.cc:320
ActivityRecorder helper class that informs the CPU if it can switch over to being idle or not...
Definition: activity.hh:50
CPUPolicy::DecodeStruct DecodeStruct
Definition: cpu.hh:629
ProbePointArg< PacketPtr > * ppInstAccessComplete
Definition: cpu.hh:190
TimeBuffer< DecodeStruct > decodeQueue
The decode stage&#39;s instruction queue.
Definition: cpu.hh:642
EventFunctionWrapper tickEvent
The tick event used for scheduling CPU ticks.
Definition: cpu.hh:133
uint16_t MicroPC
Definition: types.hh:142
uint64_t InstSeqNum
Definition: inst_seq.hh:37
void schedule(Event &event, Tick when)
Definition: eventq.hh:934
TimeBuffer< FetchStruct > fetchQueue
The fetch stage&#39;s instruction queue.
Definition: cpu.hh:639
STL list class.
Definition: stl.hh:51
Tick lastActivatedCycle
The cycle that the CPU was last activated by a new thread.
Definition: cpu.hh:707
static void wakeup(ThreadID tid)
Definition: cpu_dummy.hh:48
void setMiscRegNoEffect(RegIndex misc_reg, RegVal val) override
Sets a misc.
virtual void verifyMemoryMode() const
Verify that the system is in a memory mode supported by the CPU.
Definition: base.hh:374
int instcount
Count of total number of dynamic instructions in flight.
Definition: cpu.hh:537
void unscheduleTickEvent()
Unschedule tick event, regardless of its current state.
Definition: cpu.hh:148
void activateStage(const StageIdx idx)
Changes a stage&#39;s status to active within the activity recorder.
Definition: cpu.hh:662
void reschedule(Event &event, Tick when, bool always=false)
Definition: eventq.hh:952
virtual Counter totalOps() const =0
void setVecElem(const RegId &reg, const VecElem &val) override
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
void regStats()
Callback to set stat parameters.
Definition: cpu.cc:78
Stats::Scalar fpRegfileReads
Definition: cpu.hh:777
int64_t Counter
Statistics counter type.
Definition: types.hh:56
Enums::VecRegRenameMode vecMode
The rename mode of the vector registers.
Definition: cpu.hh:577
Stats::Scalar fpRegfileWrites
Definition: cpu.hh:778
MicroPC microPC() const override
Reads this thread&#39;s next PC.
Tick clockEdge(Cycles cycles=Cycles(0)) const
Determine the tick when a cycle begins, by default the current one, but the argument also enables the...
Stats::Scalar vecRegfileWrites
Definition: cpu.hh:781
Stats::Scalar quiesceCycles
Stat for total number of cycles the CPU spends descheduled due to a quiesce operation or waiting for ...
Definition: cpu.hh:759
void halt()
Halts the CPU.
Definition: cpu.hh:337
RegVal readMiscRegNoEffect(RegIndex misc_reg) const override
Reads a miscellaneous register.
std::queue< ListIt > removeList
List of all the instructions that will be removed at the end of this cycle.
Definition: cpu.hh:546
virtual void switchOut()
Prepare for another CPU to take over execution.
Definition: base.cc:539
CPUPolicy::TimeStruct TimeStruct
Typedefs from the Impl to get the structs that each of the time buffers should use.
Definition: cpu.hh:625
Stats::Formula cpi
Stat for the CPI per thread.
Definition: cpu.hh:765
Checker< Impl > * checker
Pointer to the checker, which can dynamically verify instruction results at run time.
Definition: cpu.hh:692
A formula for statistics that is calculated when printed.
Definition: statistics.hh:3009
bool scheduled() const
Determine if the current event is scheduled.
Definition: eventq.hh:459
FreeList class that simply holds the list of free integer and floating point registers.
Definition: free_list.hh:115
Physical register ID.
Definition: reg_class.hh:223
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:225
StageIdx
Enum to give each stage a specific index, so when calling activateStage() or deactivateStage(), they can specify which stage is being activated/deactivated.
Definition: cpu.hh:614
void setVecPredReg(const RegId &reg, const VecPredRegContainer &val) override
ProbePointArg generates a point for the class of Arg.
void regProbePoints() override
Register probe points for this object.
Definition: base.cc:350
ThreadContext * tcBase(ThreadID tid)
Returns a pointer to a thread context.
Definition: cpu.hh:680
void syscall(Fault *fault) override
Executes a syscall in SE mode.
void wakeCPU(ThreadContext *tc, uint64_t cpuid)
Definition: pseudo_inst.cc:168
TimeBuffer< IEWStruct > iewQueue
The IEW stage&#39;s instruction queue.
Definition: cpu.hh:648
VecRegContainer & getWritableVecReg(const RegId &id) override
Read vector register operand for modification, hierarchical indexing.
std::ostream CheckpointOut
Definition: serialize.hh:63
VecReg::Container VecRegContainer
Definition: registers.hh:71
O3ThreadState< Impl > Thread
Definition: cpu.hh:108
uint16_t ElemIndex
Logical vector register elem index type.
Definition: types.hh:43
InstSeqNum getAndIncrementInstSeq()
Get the current instruction sequence number, and increment it.
Definition: cpu.hh:310
PhysRegFile regFile
The register file.
Definition: cpu.hh:580
XReg readVecElem(VReg src, int index, int eSize)
Read a single NEON vector element.
Definition: neon64_mem.hh:91
void vecRenameMode(Enums::VecRegRenameMode vec_mode)
Sets the current vector renaming mode.
Definition: cpu.hh:372
ActivityRecorder activityRec
The activity recorder; used to tell if the CPU has any activity remaining or if it can go to idle and...
Definition: cpu.hh:655
Stats::Scalar vecPredRegfileReads
Definition: cpu.hh:783
Stats::Scalar idleCycles
Stat for total number of cycles the CPU spends descheduled.
Definition: cpu.hh:756
Generic predicate register container.
Definition: vec_pred_reg.hh:47
void init() override
init() is called after all C++ SimObjects have been created and all ports are connected.
Definition: base.cc:277
DrainState drain() override
Provide a default implementation of the drain interface for objects that don&#39;t need draining...
Definition: sim_object.hh:214
Stats::Scalar ccRegfileReads
Definition: cpu.hh:786
Impl::O3CPU O3CPU
Definition: cpu.hh:100
InstSeqNum globalSeqNum
The global sequence number counter.
Definition: cpu.hh:686
virtual void demapPage(Addr vaddr, uint64_t asn)=0
TimeBuffer< RenameStruct > renameQueue
The rename stage&#39;s instruction queue.
Definition: cpu.hh:645
CPUPolicy::IEWStruct IEWStruct
Definition: cpu.hh:633
Scoreboard scoreboard
Integer Register Scoreboard.
Definition: cpu.hh:605
Derived ThreadContext class for use with the O3CPU.
Definition: cpu.hh:72
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:75
Memory operation metadata.
Definition: lsq.hh:230
virtual void haltContext(ThreadID thread_num)
Notify the CPU that the indicated context is now halted.
Definition: base.cc:527
CPUPolicy::IEW iew
The issue/execute/writeback stages.
Definition: cpu.hh:571
Vector Register.
Definition: reg_class.hh:56
void demapPage(Addr vaddr, uint64_t asn)
Definition: cpu.hh:196
std::list< DynInstPtr >::iterator ListIt
Definition: cpu.hh:110
std::vector< TheISA::ISA * > isa
Definition: cpu.hh:607
std::list< DynInstPtr > instList
List of all the instructions in flight.
Definition: cpu.hh:541
Fault pushRequest(const DynInstPtr &inst, bool isLoad, uint8_t *data, unsigned int size, Addr addr, Request::Flags flags, uint64_t *res, AtomicOpFunctorPtr amo_op=nullptr, const std::vector< bool > &byte_enable=std::vector< bool >())
CPU pushRequest function, forwards request to LSQ.
Definition: cpu.hh:716
Vector Lane abstraction Another view of a container.
Definition: vec_reg.hh:262
Impl::DynInstPtr DynInstPtr
Definition: cpu.hh:99
GenericISA::DelaySlotPCState< MachInst > PCState
Definition: types.hh:41
O3ThreadState< Impl > ImplState
Definition: cpu.hh:107
Running normally.
O3ThreadState< Impl > * thread
Pointer to the thread state that this TC corrseponds to.
VecLaneT< VecElem, true > readVecLane(PhysRegIdPtr phys_reg) const
Read physical vector register lane.
Definition: cpu.hh:380
const char data[]
std::shared_ptr< FaultBase > Fault
Definition: types.hh:238
const Params * params() const
Definition: base.hh:307
std::list< int > cpuWaitList
Threads Scheduled to Enter CPU.
Definition: cpu.hh:701
Addr nextInstAddr() const override
Reads this thread&#39;s next PC.
RegVal readIntReg(RegIndex reg_idx) const override
VecLaneT< VecElem, true > readArchVecLane(int reg_idx, int lId, ThreadID tid) const
Read architectural vector register lane.
Definition: cpu.hh:437
Stats::Formula totalIpc
Stat for the total IPC.
Definition: cpu.hh:771
void deactivateStage(const StageIdx idx)
Changes a stage&#39;s status to inactive within the activity recorder.
Definition: cpu.hh:666
virtual void suspendContext(ThreadID thread_num)
Notify the CPU that the indicated context is now suspended.
Definition: base.cc:501
FullO3CPU class, has each of the stages (fetch through commit) within it, as well as all of the time ...
Definition: cpu.hh:94
BaseTLB * dtb
Definition: cpu.hh:124
void activityThisCycle()
Records that there was time buffer activity this cycle.
Definition: cpu.hh:659
Stats::Scalar ccRegfileWrites
Definition: cpu.hh:787
CPUPolicy::Rename rename
The dispatch stage.
Definition: cpu.hh:568
VecPredRegContainer & getWritableVecPredReg(const RegId &id) override

Generated on Thu May 28 2020 16:11:00 for gem5 by doxygen 1.8.13