gem5  v20.0.0.0
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
base_dyn_inst.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2011, 2013, 2016-2020 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-2006 The Regents of The University of Michigan
16  * Copyright (c) 2009 The University of Edinburgh
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_BASE_DYN_INST_HH__
44 #define __CPU_BASE_DYN_INST_HH__
45 
46 #include <array>
47 #include <bitset>
48 #include <deque>
49 #include <list>
50 #include <string>
51 
52 #include "arch/generic/tlb.hh"
53 #include "arch/utility.hh"
54 #include "base/trace.hh"
55 #include "config/the_isa.hh"
56 #include "cpu/checker/cpu.hh"
57 #include "cpu/exec_context.hh"
58 #include "cpu/exetrace.hh"
59 #include "cpu/inst_res.hh"
60 #include "cpu/inst_seq.hh"
61 #include "cpu/op_class.hh"
62 #include "cpu/static_inst.hh"
63 #include "cpu/translation.hh"
64 #include "mem/packet.hh"
65 #include "mem/request.hh"
66 #include "sim/byteswap.hh"
67 #include "sim/system.hh"
68 
74 template <class Impl>
75 class BaseDynInst : public ExecContext, public RefCounted
76 {
77  public:
78  // Typedef for the CPU.
79  typedef typename Impl::CPUType ImplCPU;
80  typedef typename ImplCPU::ImplState ImplState;
82 
83  using LSQRequestPtr = typename Impl::CPUPol::LSQ::LSQRequest*;
84  using LQIterator = typename Impl::CPUPol::LSQUnit::LQIterator;
85  using SQIterator = typename Impl::CPUPol::LSQUnit::SQIterator;
86 
87  // The DynInstPtr type.
88  typedef typename Impl::DynInstPtr DynInstPtr;
90 
91  // The list of instructions iterator type.
93 
94  enum {
96  MaxInstDestRegs = TheISA::MaxInstDestRegs
97  };
98 
99  protected:
100  enum Status {
127  };
128 
129  enum Flags {
144  };
145 
146  public:
149 
152 
154  ImplCPU *cpu;
155 
156  BaseCPU *getCpuPtr() { return cpu; }
157 
159  ImplState *thread;
160 
163 
166 
167  protected:
171  std::queue<InstResult> instResult;
172 
175 
176  private:
177  /* An amalgamation of a lot of boolean values into one */
178  std::bitset<MaxFlags> instFlags;
179 
181  std::bitset<NumStatus> status;
182 
183  protected:
187  std::bitset<MaxInstSrcRegs> _readySrcRegIdx;
188 
189  public:
192 
194  ListIt instListIt;
195 
197 
199 
202 
204  uint8_t readyRegs;
205 
206  public:
208 
210 
213 
215  unsigned memReqFlags;
216 
218  unsigned effSize;
219 
221  uint8_t *memData;
222 
224  int16_t lqIdx;
226 
228  int16_t sqIdx;
230 
231 
233 
238 
240  // Need a copy of main request pointer to verify on writes.
242 
243  protected:
247  std::array<RegId, TheISA::MaxInstDestRegs> _flatDestRegIdx;
248 
252  std::array<PhysRegIdPtr, TheISA::MaxInstDestRegs> _destRegIdx;
253 
257  std::array<PhysRegIdPtr, TheISA::MaxInstSrcRegs> _srcRegIdx;
258 
262  std::array<PhysRegIdPtr, TheISA::MaxInstDestRegs> _prevDestRegIdx;
263 
264 
265  public:
267  void recordResult(bool f) { instFlags[RecordResult] = f; }
268 
270  bool effAddrValid() const { return instFlags[EffAddrValid]; }
271  void effAddrValid(bool b) { instFlags[EffAddrValid] = b; }
272 
274  bool memOpDone() const { return instFlags[MemOpDone]; }
275  void memOpDone(bool f) { instFlags[MemOpDone] = f; }
276 
277  bool notAnInst() const { return instFlags[NotAnInst]; }
278  void setNotAnInst() { instFlags[NotAnInst] = true; }
279 
280 
282  //
283  // INSTRUCTION EXECUTION
284  //
286 
287  void demapPage(Addr vaddr, uint64_t asn)
288  {
289  cpu->demapPage(vaddr, asn);
290  }
291  void demapInstPage(Addr vaddr, uint64_t asn)
292  {
293  cpu->demapPage(vaddr, asn);
294  }
295  void demapDataPage(Addr vaddr, uint64_t asn)
296  {
297  cpu->demapPage(vaddr, asn);
298  }
299 
300  Fault initiateMemRead(Addr addr, unsigned size, Request::Flags flags,
301  const std::vector<bool>& byte_enable = std::vector<bool>());
302 
303  Fault writeMem(uint8_t *data, unsigned size, Addr addr,
304  Request::Flags flags, uint64_t *res,
305  const std::vector<bool>& byte_enable = std::vector<bool>());
306 
307  Fault initiateMemAMO(Addr addr, unsigned size, Request::Flags flags,
308  AtomicOpFunctorPtr amo_op);
309 
311  bool translationStarted() const { return instFlags[TranslationStarted]; }
312  void translationStarted(bool f) { instFlags[TranslationStarted] = f; }
313 
315  bool translationCompleted() const { return instFlags[TranslationCompleted]; }
316  void translationCompleted(bool f) { instFlags[TranslationCompleted] = f; }
317 
323  bool possibleLoadViolation() const { return instFlags[PossibleLoadViolation]; }
324  void possibleLoadViolation(bool f) { instFlags[PossibleLoadViolation] = f; }
325 
330  bool hitExternalSnoop() const { return instFlags[HitExternalSnoop]; }
331  void hitExternalSnoop(bool f) { instFlags[HitExternalSnoop] = f; }
332 
337  bool isTranslationDelayed() const
338  {
339  return (translationStarted() && !translationCompleted());
340  }
341 
342  public:
343 #ifdef DEBUG
344  void dumpSNList();
345 #endif
346 
351  {
352  return _destRegIdx[idx];
353  }
354 
357  {
358  assert(TheISA::MaxInstSrcRegs > idx);
359  return _srcRegIdx[idx];
360  }
361 
365  const RegId& flattenedDestRegIdx(int idx) const
366  {
367  return _flatDestRegIdx[idx];
368  }
369 
374  {
375  return _prevDestRegIdx[idx];
376  }
377 
381  void renameDestReg(int idx,
382  PhysRegIdPtr renamed_dest,
383  PhysRegIdPtr previous_rename)
384  {
385  _destRegIdx[idx] = renamed_dest;
386  _prevDestRegIdx[idx] = previous_rename;
387  if (renamed_dest->isPinned())
389  }
390 
395  void renameSrcReg(int idx, PhysRegIdPtr renamed_src)
396  {
397  _srcRegIdx[idx] = renamed_src;
398  }
399 
403  void flattenDestReg(int idx, const RegId& flattened_dest)
404  {
405  _flatDestRegIdx[idx] = flattened_dest;
406  }
414  BaseDynInst(const StaticInstPtr &staticInst, const StaticInstPtr &macroop,
415  TheISA::PCState pc, TheISA::PCState predPC,
416  InstSeqNum seq_num, ImplCPU *cpu);
417 
421  BaseDynInst(const StaticInstPtr &staticInst, const StaticInstPtr &macroop);
422 
424  ~BaseDynInst();
425 
426  private:
428  void initVars();
429 
430  public:
432  void dump();
433 
435  void dump(std::string &outstring);
436 
438  int cpuId() const { return cpu->cpuId(); }
439 
441  uint32_t socketId() const { return cpu->socketId(); }
442 
444  MasterID masterId() const { return cpu->dataMasterId(); }
445 
447  ContextID contextId() const { return thread->contextId(); }
448 
450  Fault getFault() const { return fault; }
453  Fault& getFault() { return fault; }
454 
460  bool doneTargCalc() { return false; }
461 
463  void setPredTarg(const TheISA::PCState &_predPC)
464  {
465  predPC = _predPC;
466  }
467 
468  const TheISA::PCState &readPredTarg() { return predPC; }
469 
471  Addr predInstAddr() { return predPC.instAddr(); }
472 
474  Addr predNextInstAddr() { return predPC.nextInstAddr(); }
475 
477  Addr predMicroPC() { return predPC.microPC(); }
478 
481  {
482  return instFlags[PredTaken];
483  }
484 
485  void setPredTaken(bool predicted_taken)
486  {
487  instFlags[PredTaken] = predicted_taken;
488  }
489 
492  {
493  TheISA::PCState tempPC = pc;
494  TheISA::advancePC(tempPC, staticInst);
495  return !(tempPC == predPC);
496  }
497 
498  //
499  // Instruction types. Forward checks to StaticInst object.
500  //
501  bool isNop() const { return staticInst->isNop(); }
502  bool isMemRef() const { return staticInst->isMemRef(); }
503  bool isLoad() const { return staticInst->isLoad(); }
504  bool isStore() const { return staticInst->isStore(); }
505  bool isAtomic() const { return staticInst->isAtomic(); }
506  bool isStoreConditional() const
507  { return staticInst->isStoreConditional(); }
508  bool isInstPrefetch() const { return staticInst->isInstPrefetch(); }
509  bool isDataPrefetch() const { return staticInst->isDataPrefetch(); }
510  bool isInteger() const { return staticInst->isInteger(); }
511  bool isFloating() const { return staticInst->isFloating(); }
512  bool isVector() const { return staticInst->isVector(); }
513  bool isControl() const { return staticInst->isControl(); }
514  bool isCall() const { return staticInst->isCall(); }
515  bool isReturn() const { return staticInst->isReturn(); }
516  bool isDirectCtrl() const { return staticInst->isDirectCtrl(); }
517  bool isIndirectCtrl() const { return staticInst->isIndirectCtrl(); }
518  bool isCondCtrl() const { return staticInst->isCondCtrl(); }
519  bool isUncondCtrl() const { return staticInst->isUncondCtrl(); }
520  bool isCondDelaySlot() const { return staticInst->isCondDelaySlot(); }
521  bool isThreadSync() const { return staticInst->isThreadSync(); }
522  bool isSerializing() const { return staticInst->isSerializing(); }
523  bool isSerializeBefore() const
524  { return staticInst->isSerializeBefore() || status[SerializeBefore]; }
525  bool isSerializeAfter() const
526  { return staticInst->isSerializeAfter() || status[SerializeAfter]; }
527  bool isSquashAfter() const { return staticInst->isSquashAfter(); }
528  bool isMemBarrier() const { return staticInst->isMemBarrier(); }
529  bool isWriteBarrier() const { return staticInst->isWriteBarrier(); }
530  bool isNonSpeculative() const { return staticInst->isNonSpeculative(); }
531  bool isQuiesce() const { return staticInst->isQuiesce(); }
532  bool isIprAccess() const { return staticInst->isIprAccess(); }
533  bool isUnverifiable() const { return staticInst->isUnverifiable(); }
534  bool isSyscall() const { return staticInst->isSyscall(); }
535  bool isMacroop() const { return staticInst->isMacroop(); }
536  bool isMicroop() const { return staticInst->isMicroop(); }
537  bool isDelayedCommit() const { return staticInst->isDelayedCommit(); }
538  bool isLastMicroop() const { return staticInst->isLastMicroop(); }
539  bool isFirstMicroop() const { return staticInst->isFirstMicroop(); }
540  bool isMicroBranch() const { return staticInst->isMicroBranch(); }
541 
543  void setSerializeBefore() { status.set(SerializeBefore); }
544 
546  void clearSerializeBefore() { status.reset(SerializeBefore); }
547 
549  bool isTempSerializeBefore() { return status[SerializeBefore]; }
550 
552  void setSerializeAfter() { status.set(SerializeAfter); }
553 
555  void clearSerializeAfter() { status.reset(SerializeAfter); }
556 
558  bool isTempSerializeAfter() { return status[SerializeAfter]; }
559 
561  void setSerializeHandled() { status.set(SerializeHandled); }
562 
568  bool isSerializeHandled() { return status[SerializeHandled]; }
569 
571  OpClass opClass() const { return staticInst->opClass(); }
572 
575  { return staticInst->branchTarget(pc); }
576 
578  int8_t numSrcRegs() const { return staticInst->numSrcRegs(); }
579 
581  int8_t numDestRegs() const { return staticInst->numDestRegs(); }
582 
583  // the following are used to track physical register usage
584  // for machines with separate int & FP reg files
585  int8_t numFPDestRegs() const { return staticInst->numFPDestRegs(); }
586  int8_t numIntDestRegs() const { return staticInst->numIntDestRegs(); }
587  int8_t numCCDestRegs() const { return staticInst->numCCDestRegs(); }
588  int8_t numVecDestRegs() const { return staticInst->numVecDestRegs(); }
589  int8_t numVecElemDestRegs() const
590  {
591  return staticInst->numVecElemDestRegs();
592  }
593  int8_t
595  {
596  return staticInst->numVecPredDestRegs();
597  }
598 
600  const RegId& destRegIdx(int i) const { return staticInst->destRegIdx(i); }
601 
603  const RegId& srcRegIdx(int i) const { return staticInst->srcRegIdx(i); }
604 
606  uint8_t resultSize() { return instResult.size(); }
607 
612  {
613  if (!instResult.empty()) {
614  InstResult t = instResult.front();
615  instResult.pop();
616  return t;
617  }
618  return dflt;
619  }
620 
624  template<typename T>
625  void setScalarResult(T&& t)
626  {
627  if (instFlags[RecordResult]) {
628  instResult.push(InstResult(std::forward<T>(t),
630  }
631  }
632 
634  template<typename T>
635  void setVecResult(T&& t)
636  {
637  if (instFlags[RecordResult]) {
638  instResult.push(InstResult(std::forward<T>(t),
640  }
641  }
642 
644  template<typename T>
645  void setVecElemResult(T&& t)
646  {
647  if (instFlags[RecordResult]) {
648  instResult.push(InstResult(std::forward<T>(t),
650  }
651  }
652 
654  template<typename T>
655  void setVecPredResult(T&& t)
656  {
657  if (instFlags[RecordResult]) {
658  instResult.push(InstResult(std::forward<T>(t),
660  }
661  }
665  void setIntRegOperand(const StaticInst *si, int idx, RegVal val)
666  {
667  setScalarResult(val);
668  }
669 
671  void setCCRegOperand(const StaticInst *si, int idx, RegVal val)
672  {
673  setScalarResult(val);
674  }
675 
677  void setVecRegOperand(const StaticInst *si, int idx,
678  const VecRegContainer& val)
679  {
680  setVecResult(val);
681  }
682 
684  void
686  {
687  setScalarResult(val);
688  }
689 
691  void setVecElemOperand(const StaticInst *si, int idx, const VecElem val)
692  {
693  setVecElemResult(val);
694  }
695 
697  void setVecPredRegOperand(const StaticInst *si, int idx,
698  const VecPredRegContainer& val)
699  {
700  setVecPredResult(val);
701  }
702 
704  void markSrcRegReady();
705 
707  void markSrcRegReady(RegIndex src_idx);
708 
710  bool isReadySrcRegIdx(int idx) const
711  {
712  return this->_readySrcRegIdx[idx];
713  }
714 
716  void setCompleted() { status.set(Completed); }
717 
719  bool isCompleted() const { return status[Completed]; }
720 
722  void setResultReady() { status.set(ResultReady); }
723 
725  bool isResultReady() const { return status[ResultReady]; }
726 
728  void setCanIssue() { status.set(CanIssue); }
729 
731  bool readyToIssue() const { return status[CanIssue]; }
732 
734  void clearCanIssue() { status.reset(CanIssue); }
735 
737  void setIssued() { status.set(Issued); }
738 
740  bool isIssued() const { return status[Issued]; }
741 
743  void clearIssued() { status.reset(Issued); }
744 
746  void setExecuted() { status.set(Executed); }
747 
749  bool isExecuted() const { return status[Executed]; }
750 
752  void setCanCommit() { status.set(CanCommit); }
753 
755  void clearCanCommit() { status.reset(CanCommit); }
756 
758  bool readyToCommit() const { return status[CanCommit]; }
759 
760  void setAtCommit() { status.set(AtCommit); }
761 
762  bool isAtCommit() { return status[AtCommit]; }
763 
765  void setCommitted() { status.set(Committed); }
766 
768  bool isCommitted() const { return status[Committed]; }
769 
771  void setSquashed();
772 
774  bool isSquashed() const { return status[Squashed]; }
775 
776  //Instruction Queue Entry
777  //-----------------------
779  void setInIQ() { status.set(IqEntry); }
780 
782  void clearInIQ() { status.reset(IqEntry); }
783 
785  bool isInIQ() const { return status[IqEntry]; }
786 
788  void setSquashedInIQ() { status.set(SquashedInIQ); status.set(Squashed);}
789 
791  bool isSquashedInIQ() const { return status[SquashedInIQ]; }
792 
793 
794  //Load / Store Queue Functions
795  //-----------------------
797  void setInLSQ() { status.set(LsqEntry); }
798 
800  void removeInLSQ() { status.reset(LsqEntry); }
801 
803  bool isInLSQ() const { return status[LsqEntry]; }
804 
806  void setSquashedInLSQ() { status.set(SquashedInLSQ); status.set(Squashed);}
807 
809  bool isSquashedInLSQ() const { return status[SquashedInLSQ]; }
810 
811 
812  //Reorder Buffer Functions
813  //-----------------------
815  void setInROB() { status.set(RobEntry); }
816 
818  void clearInROB() { status.reset(RobEntry); }
819 
821  bool isInROB() const { return status[RobEntry]; }
822 
824  void setSquashedInROB() { status.set(SquashedInROB); }
825 
827  bool isSquashedInROB() const { return status[SquashedInROB]; }
828 
830  bool isPinnedRegsRenamed() const { return status[PinnedRegsRenamed]; }
831 
833  void
835  {
836  assert(!status[PinnedRegsSquashDone]);
837  assert(!status[PinnedRegsWritten]);
838  status.set(PinnedRegsRenamed);
839  }
840 
842  bool isPinnedRegsWritten() const { return status[PinnedRegsWritten]; }
843 
845  void
847  {
848  assert(!status[PinnedRegsSquashDone]);
849  assert(status[PinnedRegsRenamed]);
850  status.set(PinnedRegsWritten);
851  }
852 
854  bool
855  isPinnedRegsSquashDone() const { return status[PinnedRegsSquashDone]; }
856 
858  void
860  assert(!status[PinnedRegsSquashDone]);
861  status.set(PinnedRegsSquashDone);
862  }
863 
865  TheISA::PCState pcState() const { return pc; }
866 
868  void pcState(const TheISA::PCState &val) { pc = val; }
869 
871  Addr instAddr() const { return pc.instAddr(); }
872 
874  Addr nextInstAddr() const { return pc.nextInstAddr(); }
875 
877  Addr microPC() const { return pc.microPC(); }
878 
879  bool readPredicate() const
880  {
881  return instFlags[Predicate];
882  }
883 
884  void setPredicate(bool val)
885  {
886  instFlags[Predicate] = val;
887 
888  if (traceData) {
889  traceData->setPredicate(val);
890  }
891  }
892 
893  bool
895  {
896  return instFlags[MemAccPredicate];
897  }
898 
899  void
901  {
902  instFlags[MemAccPredicate] = val;
903  }
904 
906  void setTid(ThreadID tid) { threadNumber = tid; }
907 
909  void setThreadState(ImplState *state) { thread = state; }
910 
912  ThreadContext *tcBase() const { return thread->getTC(); }
913 
914  public:
916  bool eaSrcsReady() const;
917 
919  bool strictlyOrdered() const { return instFlags[IsStrictlyOrdered]; }
920  void strictlyOrdered(bool so) { instFlags[IsStrictlyOrdered] = so; }
921 
923  bool hasRequest() const { return instFlags[ReqMade]; }
925  void setRequest() { instFlags[ReqMade] = true; }
926 
928  ListIt &getInstListIt() { return instListIt; }
929 
931  void setInstListIt(ListIt _instListIt) { instListIt = _instListIt; }
932 
933  public:
935  unsigned int readStCondFailures() const
936  { return thread->storeCondFailures; }
937 
939  void setStCondFailures(unsigned int sc_failures)
940  { thread->storeCondFailures = sc_failures; }
941 
942  public:
943  // monitor/mwait funtions
944  void armMonitor(Addr address) { cpu->armMonitor(threadNumber, address); }
945  bool mwait(PacketPtr pkt) { return cpu->mwait(threadNumber, pkt); }
947  { return cpu->mwaitAtomic(threadNumber, tc, cpu->dtb); }
949  { return cpu->getCpuAddrMonitor(threadNumber); }
950 };
951 
952 template<class Impl>
953 Fault
955  Request::Flags flags,
956  const std::vector<bool>& byte_enable)
957 {
958  assert(byte_enable.empty() || byte_enable.size() == size);
959  return cpu->pushRequest(
960  dynamic_cast<typename DynInstPtr::PtrType>(this),
961  /* ld */ true, nullptr, size, addr, flags, nullptr, nullptr,
962  byte_enable);
963 }
964 
965 template<class Impl>
966 Fault
967 BaseDynInst<Impl>::writeMem(uint8_t *data, unsigned size, Addr addr,
968  Request::Flags flags, uint64_t *res,
969  const std::vector<bool>& byte_enable)
970 {
971  assert(byte_enable.empty() || byte_enable.size() == size);
972  return cpu->pushRequest(
973  dynamic_cast<typename DynInstPtr::PtrType>(this),
974  /* st */ false, data, size, addr, flags, res, nullptr,
975  byte_enable);
976 }
977 
978 template<class Impl>
979 Fault
981  Request::Flags flags,
982  AtomicOpFunctorPtr amo_op)
983 {
984  // atomic memory instructions do not have data to be written to memory yet
985  // since the atomic operations will be executed directly in cache/memory.
986  // Therefore, its `data` field is nullptr.
987  // Atomic memory requests need to carry their `amo_op` fields to cache/
988  // memory
989  return cpu->pushRequest(
990  dynamic_cast<typename DynInstPtr::PtrType>(this),
991  /* atomic */ false, nullptr, size, addr, flags, nullptr,
992  std::move(amo_op));
993 }
994 
995 #endif // __CPU_BASE_DYN_INST_HH__
bool isIprAccess() const
bool isInLSQ() const
Returns whether or not this instruction is in the LSQ.
const TheISA::PCState & readPredTarg()
Instruction has reached commit.
bool isCondDelaySlot() const
Definition: static_inst.hh:182
Is a blocking instruction.
void setFloatRegOperandBits(const StaticInst *si, int idx, RegVal val)
Records an fp register being set to an integer value.
bool isStore() const
Definition: static_inst.hh:162
void setSquashed()
Sets this instruction as squashed.
bool isSquashedInROB() const
Returns whether or not this instruction is squashed in the ROB.
void renameSrcReg(int idx, PhysRegIdPtr renamed_src)
Renames a source logical register to the physical register which has/will produce that logical regist...
int8_t numSrcRegs() const
Number of source registers.
Definition: static_inst.hh:135
uint32_t socketId() const
Read this CPU&#39;s Socket ID.
bool mwait(PacketPtr pkt)
~BaseDynInst()
BaseDynInst destructor.
void demapDataPage(Addr vaddr, uint64_t asn)
void clearCanIssue()
Clears this instruction being able to issue.
void setExecuted()
Sets this instruction as executed.
Fault initiateMemRead(Addr addr, unsigned size, Request::Flags flags, const std::vector< bool > &byte_enable=std::vector< bool >())
bool isDelayedCommit() const
Definition: static_inst.hh:200
Bitfield< 7 > i
std::bitset< NumStatus > status
The status of this BaseDynInst.
RequestPtr reqToVerify
bool isMicroop() const
InstSeqNum seqNum
The sequence number of the instruction.
Serialization has been handled.
Instruction has its result.
int8_t numCCDestRegs() const
unsigned memReqFlags
The memory request flags (from translation).
Instruction is in the LSQ.
Vector Register Abstraction This generic class is the model in a particularization of MVC...
Definition: vec_reg.hh:156
bool isInIQ() const
Returns whether or not this instruction has issued.
bool isUnverifiable() const
bool isInstPrefetch() const
uint8_t readyRegs
How many source registers are ready.
MasterID masterId() const
Read this CPU&#39;s data requestor ID.
bool hitExternalSnoop() const
True if the address hit a external snoop while sitting in the LSQ.
int16_t lqIdx
Load queue index.
void setAtCommit()
bool isMacroop() const
Definition: static_inst.hh:198
Needs to serialize instructions behind it.
Declaration of a request, the overall memory request consisting of the parts of the request that are ...
bool isLoad() const
Definition: static_inst.hh:161
bool isSerializeAfter() const
void clearSerializeAfter()
Clears the serializeAfter part of this instruction.
std::shared_ptr< Request > RequestPtr
Definition: request.hh:81
bool isCondCtrl() const
int8_t numVecElemDestRegs() const
Number of vector element destination regs.
Definition: static_inst.hh:145
int8_t numVecPredDestRegs() const
Number of predicate destination regs.
Definition: static_inst.hh:147
ip6_addr_t addr
Definition: inet.hh:330
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Definition: amo.hh:228
Fault fault
The kind of fault this instruction has generated.
void setCommitted()
Sets this instruction as committed.
void setVecPredRegOperand(const StaticInst *si, int idx, const VecPredRegContainer &val)
Record a vector register being set to a value.
bool readMemAccPredicate() const
uint8_t * memData
Pointer to the data for the memory access.
int8_t numDestRegs() const
Number of destination registers.
Definition: static_inst.hh:137
bool isFloating() const
Definition: static_inst.hh:171
int8_t numIntDestRegs() const
bool isUnverifiable() const
Definition: static_inst.hh:196
bool isQuiesce() const
LSQRequestPtr savedReq
Saved memory request (needed when the DTB address translation is delayed due to a hw page table walk)...
Addr nextInstAddr() const
Read the PC of the next instruction.
Is a thread synchronization instruction.
void setInIQ()
Sets this instruction as a entry the IQ.
bool isAtomic() const
Definition: static_inst.hh:163
void setVecPredResult(T &&t)
Predicate result.
std::array< PhysRegIdPtr, TheISA::MaxInstDestRegs > _destRegIdx
Physical register index of the destination registers of this instruction.
void hitExternalSnoop(bool f)
uint64_t RegVal
Definition: types.hh:166
Trace::InstRecord * traceData
InstRecord that tracks this instructions.
bool isDataPrefetch() const
Definition: static_inst.hh:166
bool isIndirectCtrl() const
Definition: static_inst.hh:179
void markSrcRegReady()
Records that one of the source registers is ready.
const RegId & srcRegIdx(int i) const
Return logical index (architectural reg num) of i&#39;th source reg.
Definition: static_inst.hh:222
bool isSerializeBefore() const
Definition: static_inst.hh:188
Impl::CPUType ImplCPU
bool isSquashed() const
Returns whether or not this instruction is squashed.
void mwaitAtomic(ThreadContext *tc)
bool isSerializeBefore() const
bool readPredTaken()
Returns whether the instruction was predicted taken or not.
bool isStore() const
std::list< DynInstPtr >::iterator ListIt
bool isVector() const
BaseCPU * getCpuPtr()
bool isSyscall() const
Definition: static_inst.hh:197
Fault & getFault()
TODO: This I added for the LSQRequest side to be able to modify the fault.
bool isTempSerializeAfter()
Checks if this serializeAfter is only temporarily set.
void clearSerializeBefore()
Clears the serializeBefore part of this instruction.
void setThreadState(ImplState *state)
Sets the pointer to the thread state.
int8_t numFPDestRegs() const
Number of floating-point destination regs.
Definition: static_inst.hh:139
void clearIssued()
Clears this instruction as being issued.
bool isLoad() const
bool isReturn() const
Definition: static_inst.hh:177
const int MaxInstSrcRegs
Definition: registers.hh:57
void setStCondFailures(unsigned int sc_failures)
Sets the number of consecutive store conditional failures.
void setPinnedRegsWritten()
Sets destination registers as written.
void setVecResult(T &&t)
Full vector result.
If you want a reference counting pointer to a mutable object, create it like this: ...
Definition: refcnt.hh:118
ThreadContext is the external interface to all thread state for anything outside of the CPU...
bool isIndirectCtrl() const
void setPinnedRegsRenamed()
Sets the destination registers as renamed.
bool isFloating() const
bool isMicroBranch() const
Definition: static_inst.hh:204
Bitfield< 28 > so
Definition: miscregs.hh:49
bool isDirectCtrl() const
Definition: static_inst.hh:178
bool isUncondCtrl() const
Definition: static_inst.hh:181
bool isAtCommit()
void setScalarResult(T &&t)
Pushes a result onto the instResult queue.
bool isMemBarrier() const
Definition: static_inst.hh:191
PhysRegIdPtr renamedDestRegIdx(int idx) const
Returns the physical register index of the i&#39;th destination register.
Bitfield< 63 > val
Definition: misc.hh:769
void setVecElemOperand(const StaticInst *si, int idx, const VecElem val)
Record a vector register being set to a value.
Regs pinning status updated after squash.
Bitfield< 15, 0 > si
Definition: types.hh:53
void armMonitor(Addr address)
uint8_t resultSize()
Return the size of the instResult queue.
bool isInteger() const
Bitfield< 6 > f
void setPredTarg(const TheISA::PCState &_predPC)
Set the predicted target of this current instruction.
void setVecElemResult(T &&t)
Vector element result.
bool translationStarted() const
True if the DTB address translation has started.
bool isMemRef() const
Definition: static_inst.hh:160
bool isNop() const
Definition: static_inst.hh:158
bool hasRequest() const
Has this instruction generated a memory request.
int8_t numSrcRegs() const
Returns the number of source registers.
ContextID contextId() const
Read this context&#39;s system-wide ID.
bool possibleLoadViolation() const
True if this address was found to match a previous load and they issued out of order.
void setTid(ThreadID tid)
Sets the thread id.
bool isPinned() const
Definition: reg_class.hh:330
Bitfield< 7 > b
PhysRegIdPtr renamedSrcRegIdx(int idx) const
Returns the physical register index of the i&#39;th source register.
const RegId & destRegIdx(int i) const
Returns the logical register index of the i&#39;th destination register.
bool isFirstMicroop() const
int8_t numVecDestRegs() const
Number of vector destination regs.
Definition: static_inst.hh:143
ListIt instListIt
Iterator pointing to this BaseDynInst in the list of all insts.
bool isSquashedInIQ() const
Returns whether or not this instruction is squashed in the IQ.
bool isSyscall() const
bool isSerializing() const
Definition: static_inst.hh:185
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:70
Instruction is in the IQ.
bool isUncondCtrl() const
bool isDataPrefetch() const
std::queue< InstResult > instResult
The result of the instruction; assumes an instruction can have many destination registers.
bool isWriteBarrier() const
Definition: static_inst.hh:192
void setSerializeBefore()
Temporarily sets this instruction as a serialize before instruction.
uint16_t RegIndex
Definition: types.hh:40
void strictlyOrdered(bool so)
bool isPinnedRegsRenamed() const
Returns whether pinned registers are renamed.
Addr predMicroPC()
Returns the predicted micro PC after the branch.
Definition: flags.hh:33
bool doneTargCalc()
Checks whether or not this instruction has had its branch target calculated yet.
bool isPinnedRegsWritten() const
Returns whether destination registers are written.
bool isResultReady() const
Returns whether or not the result is ready.
bool translationCompleted() const
True if the DTB address translation has completed.
bool isStoreConditional() const
std::array< PhysRegIdPtr, TheISA::MaxInstSrcRegs > _srcRegIdx
Physical register index of the source registers of this instruction.
void pcState(const TheISA::PCState &val)
Set the PC state of this instruction.
bool isCondCtrl() const
Definition: static_inst.hh:180
unsigned effSize
The size of the request.
void demapInstPage(Addr vaddr, uint64_t asn)
ImplCPU::ImplState ImplState
bool isIprAccess() const
Definition: static_inst.hh:195
bool isCall() const
bool readyToIssue() const
Returns whether or not this instruction is ready to issue.
bool isSquashedInLSQ() const
Returns whether or not this instruction is squashed in the LSQ.
std::bitset< MaxFlags > instFlags
bool isQuiesce() const
Definition: static_inst.hh:194
AddressMonitor * getAddrMonitor()
bool isDelayedCommit() const
void setPredicate(bool val)
Definition: insttracer.hh:219
Instruction is squashed in the LSQ.
bool isThreadSync() const
bool mispredicted()
Returns whether the instruction mispredicted.
uint64_t InstSeqNum
Definition: inst_seq.hh:37
bool isCall() const
Definition: static_inst.hh:176
void setInstListIt(ListIt _instListIt)
Sets iterator for this instruction in the list of all insts.
void setPredicate(bool val)
const RegId & flattenedDestRegIdx(int idx) const
Returns the flattened register index of the i&#39;th destination register.
Derive from RefCounted if you want to enable reference counting of this class.
Definition: refcnt.hh:57
void setMemAccPredicate(bool val)
void clearInROB()
Sets this instruction as a entry the ROB.
void advancePC(PCState &pc, const StaticInstPtr &inst)
Definition: utility.hh:393
STL list class.
Definition: stl.hh:51
Instruction has issued.
bool isNonSpeculative() const
const StaticInstPtr staticInst
The StaticInst used by this BaseDynInst.
int cpuId() const
Read this CPU&#39;s ID.
Addr predNextInstAddr()
Returns the predicted PC two instructions after the branch.
void setPinnedRegsSquashDone()
Sets dest registers&#39; status updated after squash.
void setInLSQ()
Sets this instruction as a entry the LSQ.
Instruction is squashed in the ROB.
bool isCondDelaySlot() const
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:140
TheISA::PCState pc
PC state for this instruction.
TheISA::PCState branchTarget() const
Returns the branch target address.
uint16_t MasterID
Definition: request.hh:84
SQIterator sqIt
std::bitset< MaxInstSrcRegs > _readySrcRegIdx
Whether or not the source register is ready.
Pinned registers are renamed.
void demapPage(Addr vaddr, uint64_t asn)
Invalidate a page in the DTLB and ITLB.
A Packet is used to encapsulate a transfer between two objects in the memory system (e...
Definition: packet.hh:249
bool isInteger() const
Definition: static_inst.hh:170
Instruction can issue and execute.
bool eaSrcsReady() const
Returns whether or not the eff.
std::array< PhysRegIdPtr, TheISA::MaxInstDestRegs > _prevDestRegIdx
Physical register index of the previous producers of the architected destinations.
OpClass opClass() const
Operation class. Used to select appropriate function unit in issue.
Definition: static_inst.hh:213
bool isStoreConditional() const
Definition: static_inst.hh:164
int8_t numFPDestRegs() const
bool isFirstMicroop() const
Definition: static_inst.hh:202
void effAddrValid(bool b)
void setNotAnInst()
bool isDirectCtrl() const
ListIt & getInstListIt()
Returns iterator to this instruction in the list of all insts.
void setIntRegOperand(const StaticInst *si, int idx, RegVal val)
Records an integer register being set to a value.
int16_t sqIdx
Store queue index.
bool isReturn() const
bool isVector() const
Definition: static_inst.hh:172
void clearInIQ()
Sets this instruction as a entry the IQ.
Addr predInstAddr()
Returns the predicted PC immediately after the branch.
PhysRegIdPtr prevDestRegIdx(int idx) const
Returns the physical register index of the previous physical register that remapped to the same logic...
Physical register ID.
Definition: reg_class.hh:223
void clearCanCommit()
Clears this instruction as being ready to commit.
void setCanCommit()
Sets this instruction as ready to commit.
void memOpDone(bool f)
int16_t ThreadID
Thread index/ID type.
Definition: types.hh:225
bool memOpDone() const
Whether or not the memory operation is done.
virtual TheISA::PCState branchTarget(const TheISA::PCState &pc) const
Return the target address for a PC-relative branch.
Definition: static_inst.cc:105
bool isLastMicroop() const
void setCompleted()
Sets this instruction as completed.
Addr microPC() const
Read the micro PC of this instruction.
void setSquashedInLSQ()
Sets this instruction as squashed in the LSQ.
bool strictlyOrdered() const
Is this instruction&#39;s memory access strictly ordered?
BaseDynInst(const StaticInstPtr &staticInst, const StaticInstPtr &macroop, TheISA::PCState pc, TheISA::PCState predPC, InstSeqNum seq_num, ImplCPU *cpu)
BaseDynInst constructor given a binary instruction.
InstResult popResult(InstResult dflt=InstResult())
Pops a result off the instResult queue.
int8_t numVecPredDestRegs() const
Declaration of the Packet class.
ImplCPU * cpu
Pointer to the Impl&#39;s CPU object.
bool isControl() const
Definition: static_inst.hh:175
VecReg::Container VecRegContainer
Definition: registers.hh:71
bool effAddrValid() const
Is the effective virtual address valid.
void setPredTaken(bool predicted_taken)
bool isExecuted() const
Returns whether or not this instruction has executed.
bool isMacroop() const
Addr instAddr() const
Read the PC of this instruction.
bool isTranslationDelayed() const
Returns true if the DTB address translation is being delayed due to a hw page table walk...
void setResultReady()
Marks the result as ready.
const RegId & srcRegIdx(int i) const
Returns the logical register index of the i&#39;th source register.
void setSquashedInROB()
Sets this instruction as squashed in the ROB.
bool isSerializing() const
Generic predicate register container.
Definition: vec_pred_reg.hh:47
int8_t numDestRegs() const
Returns the number of destination registers.
void setSerializeAfter()
Temporarily sets this instruction as a serialize after instruction.
Fault getFault() const
Returns the fault type.
typename Impl::CPUPol::LSQ::LSQRequest * LSQRequestPtr
int8_t numCCDestRegs() const
Number of coprocesor destination regs.
Definition: static_inst.hh:149
LQIterator lqIt
bool notAnInst() const
bool isNonSpeculative() const
Definition: static_inst.hh:193
Instruction is squashed.
Is a recover instruction.
Fault writeMem(uint8_t *data, unsigned size, Addr addr, Request::Flags flags, uint64_t *res, const std::vector< bool > &byte_enable=std::vector< bool >())
Base, ISA-independent static instruction class.
Definition: static_inst.hh:85
Addr effAddr
The effective virtual address (lds & stores only).
unsigned int readStCondFailures() const
Returns the number of consecutive store conditional failures.
void translationCompleted(bool f)
Instruction is squashed in the IQ.
Fault initiateMemAMO(Addr addr, unsigned size, Request::Flags flags, AtomicOpFunctorPtr amo_op)
bool isCommitted() const
Returns whether or not this instruction is committed.
const RegId & destRegIdx(int i) const
Return logical index (architectural reg num) of i&#39;th destination reg.
Definition: static_inst.hh:218
OpClass opClass() const
Returns the opclass of this instruction.
const StaticInstPtr macroop
The Macroop if one exists.
bool isSquashAfter() const
Definition: static_inst.hh:190
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:75
void setRequest()
Assert this instruction has generated a memory request.
void initVars()
Function to initialize variables in the constructors.
bool isTempSerializeBefore()
Checks if this serializeBefore is only temporarily set.
typename Impl::CPUPol::LSQUnit::SQIterator SQIterator
bool isMicroBranch() const
bool isMemBarrier() const
TheISA::PCState pcState() const
Read the PC state of this instruction.
void possibleLoadViolation(bool f)
TheISA::PCState predPC
Predicted PC state after this instruction.
void setCCRegOperand(const StaticInst *si, int idx, RegVal val)
Records a CC register being set to a value.
Instruction can commit.
bool isPinnedRegsSquashDone() const
Return whether dest registers&#39; pinning status updated after squash.
Bitfield< 5 > t
Impl::DynInstPtr DynInstPtr
bool isSerializeHandled()
Checks if the serialization part of this instruction has been handled.
bool isSquashAfter() const
bool isIssued() const
Returns whether or not this instruction has issued.
ThreadID threadNumber
The thread this instruction is from.
void translationStarted(bool f)
void setVecRegOperand(const StaticInst *si, int idx, const VecRegContainer &val)
Record a vector register being set to a value.
void dump()
Dumps out contents of this BaseDynInst.
GenericISA::DelaySlotPCState< MachInst > PCState
Definition: types.hh:41
TheISA::VecElem VecElem
Definition: exec_context.hh:75
bool isWriteBarrier() const
Instruction has committed.
void setSquashedInIQ()
Sets this instruction as squashed in the IQ.
bool isMemRef() const
Instruction has executed.
Addr physEffAddr
The effective physical address.
void setIssued()
Sets this instruction as issued from the IQ.
const char data[]
bool isSerializeAfter() const
Definition: static_inst.hh:189
std::shared_ptr< FaultBase > Fault
Definition: types.hh:238
int8_t numIntDestRegs() const
Number of integer destination regs.
Definition: static_inst.hh:141
bool isControl() const
void renameDestReg(int idx, PhysRegIdPtr renamed_dest, PhysRegIdPtr previous_rename)
Renames a destination register to a physical register.
void setCanIssue()
Sets this instruction as ready to issue.
bool isMicroop() const
Definition: static_inst.hh:199
int8_t numVecElemDestRegs() const
typename Impl::CPUPol::LSQUnit::LQIterator LQIterator
ImplState * thread
Pointer to the thread state.
void removeInLSQ()
Sets this instruction as a entry the LSQ.
Needs to serialize on instructions ahead of it.
int ContextID
Globally unique thread context ID.
Definition: types.hh:229
bool isThreadSync() const
Definition: static_inst.hh:184
bool isAtomic() const
Instruction has completed.
bool isInstPrefetch() const
Definition: static_inst.hh:165
void setInROB()
Sets this instruction as a entry the ROB.
bool isInROB() const
Returns whether or not this instruction is in the ROB.
bool readPredicate() const
Pinned registers are written back.
ThreadContext * tcBase() const
Returns the thread context.
bool isLastMicroop() const
Definition: static_inst.hh:201
void flattenDestReg(int idx, const RegId &flattened_dest)
Flattens a destination architectural register index into a logical index.
Instruction is in the ROB.
std::array< RegId, TheISA::MaxInstDestRegs > _flatDestRegIdx
Flattened register index of the destination registers of this instruction.
RefCountingPtr< BaseDynInst< Impl > > BaseDynInstPtr
bool readyToCommit() const
Returns whether or not this instruction is ready to commit.
bool isCompleted() const
Returns whether or not this instruction is completed.
bool isNop() const
void recordResult(bool f)
Records changes to result?
int8_t numVecDestRegs() const
void setSerializeHandled()
Sets the serialization part of this instruction as handled.
bool isReadySrcRegIdx(int idx) const
Returns if a source register is ready.

Generated on Thu May 28 2020 16:21:30 for gem5 by doxygen 1.8.13