gem5  v19.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-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-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  * Authors: Kevin Lim
43  * Timothy M. Jones
44  */
45 
46 #ifndef __CPU_BASE_DYN_INST_HH__
47 #define __CPU_BASE_DYN_INST_HH__
48 
49 #include <array>
50 #include <bitset>
51 #include <deque>
52 #include <list>
53 #include <string>
54 
55 #include "arch/generic/tlb.hh"
56 #include "arch/utility.hh"
57 #include "base/trace.hh"
58 #include "config/the_isa.hh"
59 #include "cpu/checker/cpu.hh"
60 #include "cpu/exec_context.hh"
61 #include "cpu/exetrace.hh"
62 #include "cpu/inst_res.hh"
63 #include "cpu/inst_seq.hh"
64 #include "cpu/op_class.hh"
65 #include "cpu/static_inst.hh"
66 #include "cpu/translation.hh"
67 #include "mem/packet.hh"
68 #include "mem/request.hh"
69 #include "sim/byteswap.hh"
70 #include "sim/system.hh"
71 
77 template <class Impl>
78 class BaseDynInst : public ExecContext, public RefCounted
79 {
80  public:
81  // Typedef for the CPU.
82  typedef typename Impl::CPUType ImplCPU;
83  typedef typename ImplCPU::ImplState ImplState;
85 
86  using LSQRequestPtr = typename Impl::CPUPol::LSQ::LSQRequest*;
87  using LQIterator = typename Impl::CPUPol::LSQUnit::LQIterator;
88  using SQIterator = typename Impl::CPUPol::LSQUnit::SQIterator;
89 
90  // The DynInstPtr type.
91  typedef typename Impl::DynInstPtr DynInstPtr;
93 
94  // The list of instructions iterator type.
96 
97  enum {
99  MaxInstDestRegs = TheISA::MaxInstDestRegs
100  };
101 
102  protected:
103  enum Status {
130  };
131 
132  enum Flags {
147  };
148 
149  public:
152 
155 
157  ImplCPU *cpu;
158 
159  BaseCPU *getCpuPtr() { return cpu; }
160 
162  ImplState *thread;
163 
166 
169 
170  protected:
174  std::queue<InstResult> instResult;
175 
178 
179  private:
180  /* An amalgamation of a lot of boolean values into one */
181  std::bitset<MaxFlags> instFlags;
182 
184  std::bitset<NumStatus> status;
185 
186  protected:
190  std::bitset<MaxInstSrcRegs> _readySrcRegIdx;
191 
192  public:
195 
197  ListIt instListIt;
198 
200 
202 
205 
207  uint8_t readyRegs;
208 
209  public:
211 
213 
216 
218  unsigned memReqFlags;
219 
221  short asid;
222 
224  unsigned effSize;
225 
227  uint8_t *memData;
228 
230  int16_t lqIdx;
232 
234  int16_t sqIdx;
236 
237 
239 
244 
246  // Need a copy of main request pointer to verify on writes.
248 
249  protected:
253  std::array<RegId, TheISA::MaxInstDestRegs> _flatDestRegIdx;
254 
258  std::array<PhysRegIdPtr, TheISA::MaxInstDestRegs> _destRegIdx;
259 
263  std::array<PhysRegIdPtr, TheISA::MaxInstSrcRegs> _srcRegIdx;
264 
268  std::array<PhysRegIdPtr, TheISA::MaxInstDestRegs> _prevDestRegIdx;
269 
270 
271  public:
273  void recordResult(bool f) { instFlags[RecordResult] = f; }
274 
276  bool effAddrValid() const { return instFlags[EffAddrValid]; }
277  void effAddrValid(bool b) { instFlags[EffAddrValid] = b; }
278 
280  bool memOpDone() const { return instFlags[MemOpDone]; }
281  void memOpDone(bool f) { instFlags[MemOpDone] = f; }
282 
283  bool notAnInst() const { return instFlags[NotAnInst]; }
284  void setNotAnInst() { instFlags[NotAnInst] = true; }
285 
286 
288  //
289  // INSTRUCTION EXECUTION
290  //
292 
293  void demapPage(Addr vaddr, uint64_t asn)
294  {
295  cpu->demapPage(vaddr, asn);
296  }
297  void demapInstPage(Addr vaddr, uint64_t asn)
298  {
299  cpu->demapPage(vaddr, asn);
300  }
301  void demapDataPage(Addr vaddr, uint64_t asn)
302  {
303  cpu->demapPage(vaddr, asn);
304  }
305 
306  Fault initiateMemRead(Addr addr, unsigned size, Request::Flags flags,
307  const std::vector<bool>& byte_enable = std::vector<bool>());
308 
309  Fault writeMem(uint8_t *data, unsigned size, Addr addr,
310  Request::Flags flags, uint64_t *res,
311  const std::vector<bool>& byte_enable = std::vector<bool>());
312 
313  Fault initiateMemAMO(Addr addr, unsigned size, Request::Flags flags,
314  AtomicOpFunctorPtr amo_op);
315 
317  bool translationStarted() const { return instFlags[TranslationStarted]; }
318  void translationStarted(bool f) { instFlags[TranslationStarted] = f; }
319 
321  bool translationCompleted() const { return instFlags[TranslationCompleted]; }
322  void translationCompleted(bool f) { instFlags[TranslationCompleted] = f; }
323 
329  bool possibleLoadViolation() const { return instFlags[PossibleLoadViolation]; }
330  void possibleLoadViolation(bool f) { instFlags[PossibleLoadViolation] = f; }
331 
336  bool hitExternalSnoop() const { return instFlags[HitExternalSnoop]; }
337  void hitExternalSnoop(bool f) { instFlags[HitExternalSnoop] = f; }
338 
343  bool isTranslationDelayed() const
344  {
345  return (translationStarted() && !translationCompleted());
346  }
347 
348  public:
349 #ifdef DEBUG
350  void dumpSNList();
351 #endif
352 
357  {
358  return _destRegIdx[idx];
359  }
360 
363  {
364  assert(TheISA::MaxInstSrcRegs > idx);
365  return _srcRegIdx[idx];
366  }
367 
371  const RegId& flattenedDestRegIdx(int idx) const
372  {
373  return _flatDestRegIdx[idx];
374  }
375 
380  {
381  return _prevDestRegIdx[idx];
382  }
383 
387  void renameDestReg(int idx,
388  PhysRegIdPtr renamed_dest,
389  PhysRegIdPtr previous_rename)
390  {
391  _destRegIdx[idx] = renamed_dest;
392  _prevDestRegIdx[idx] = previous_rename;
393  if (renamed_dest->isPinned())
395  }
396 
401  void renameSrcReg(int idx, PhysRegIdPtr renamed_src)
402  {
403  _srcRegIdx[idx] = renamed_src;
404  }
405 
409  void flattenDestReg(int idx, const RegId& flattened_dest)
410  {
411  _flatDestRegIdx[idx] = flattened_dest;
412  }
420  BaseDynInst(const StaticInstPtr &staticInst, const StaticInstPtr &macroop,
421  TheISA::PCState pc, TheISA::PCState predPC,
422  InstSeqNum seq_num, ImplCPU *cpu);
423 
427  BaseDynInst(const StaticInstPtr &staticInst, const StaticInstPtr &macroop);
428 
430  ~BaseDynInst();
431 
432  private:
434  void initVars();
435 
436  public:
438  void dump();
439 
441  void dump(std::string &outstring);
442 
444  int cpuId() const { return cpu->cpuId(); }
445 
447  uint32_t socketId() const { return cpu->socketId(); }
448 
450  MasterID masterId() const { return cpu->dataMasterId(); }
451 
453  ContextID contextId() const { return thread->contextId(); }
454 
456  Fault getFault() const { return fault; }
459  Fault& getFault() { return fault; }
460 
466  bool doneTargCalc() { return false; }
467 
469  void setPredTarg(const TheISA::PCState &_predPC)
470  {
471  predPC = _predPC;
472  }
473 
474  const TheISA::PCState &readPredTarg() { return predPC; }
475 
477  Addr predInstAddr() { return predPC.instAddr(); }
478 
480  Addr predNextInstAddr() { return predPC.nextInstAddr(); }
481 
483  Addr predMicroPC() { return predPC.microPC(); }
484 
487  {
488  return instFlags[PredTaken];
489  }
490 
491  void setPredTaken(bool predicted_taken)
492  {
493  instFlags[PredTaken] = predicted_taken;
494  }
495 
498  {
499  TheISA::PCState tempPC = pc;
500  TheISA::advancePC(tempPC, staticInst);
501  return !(tempPC == predPC);
502  }
503 
504  //
505  // Instruction types. Forward checks to StaticInst object.
506  //
507  bool isNop() const { return staticInst->isNop(); }
508  bool isMemRef() const { return staticInst->isMemRef(); }
509  bool isLoad() const { return staticInst->isLoad(); }
510  bool isStore() const { return staticInst->isStore(); }
511  bool isAtomic() const { return staticInst->isAtomic(); }
512  bool isStoreConditional() const
513  { return staticInst->isStoreConditional(); }
514  bool isInstPrefetch() const { return staticInst->isInstPrefetch(); }
515  bool isDataPrefetch() const { return staticInst->isDataPrefetch(); }
516  bool isInteger() const { return staticInst->isInteger(); }
517  bool isFloating() const { return staticInst->isFloating(); }
518  bool isVector() const { return staticInst->isVector(); }
519  bool isControl() const { return staticInst->isControl(); }
520  bool isCall() const { return staticInst->isCall(); }
521  bool isReturn() const { return staticInst->isReturn(); }
522  bool isDirectCtrl() const { return staticInst->isDirectCtrl(); }
523  bool isIndirectCtrl() const { return staticInst->isIndirectCtrl(); }
524  bool isCondCtrl() const { return staticInst->isCondCtrl(); }
525  bool isUncondCtrl() const { return staticInst->isUncondCtrl(); }
526  bool isCondDelaySlot() const { return staticInst->isCondDelaySlot(); }
527  bool isThreadSync() const { return staticInst->isThreadSync(); }
528  bool isSerializing() const { return staticInst->isSerializing(); }
529  bool isSerializeBefore() const
530  { return staticInst->isSerializeBefore() || status[SerializeBefore]; }
531  bool isSerializeAfter() const
532  { return staticInst->isSerializeAfter() || status[SerializeAfter]; }
533  bool isSquashAfter() const { return staticInst->isSquashAfter(); }
534  bool isMemBarrier() const { return staticInst->isMemBarrier(); }
535  bool isWriteBarrier() const { return staticInst->isWriteBarrier(); }
536  bool isNonSpeculative() const { return staticInst->isNonSpeculative(); }
537  bool isQuiesce() const { return staticInst->isQuiesce(); }
538  bool isIprAccess() const { return staticInst->isIprAccess(); }
539  bool isUnverifiable() const { return staticInst->isUnverifiable(); }
540  bool isSyscall() const { return staticInst->isSyscall(); }
541  bool isMacroop() const { return staticInst->isMacroop(); }
542  bool isMicroop() const { return staticInst->isMicroop(); }
543  bool isDelayedCommit() const { return staticInst->isDelayedCommit(); }
544  bool isLastMicroop() const { return staticInst->isLastMicroop(); }
545  bool isFirstMicroop() const { return staticInst->isFirstMicroop(); }
546  bool isMicroBranch() const { return staticInst->isMicroBranch(); }
547 
549  void setSerializeBefore() { status.set(SerializeBefore); }
550 
552  void clearSerializeBefore() { status.reset(SerializeBefore); }
553 
555  bool isTempSerializeBefore() { return status[SerializeBefore]; }
556 
558  void setSerializeAfter() { status.set(SerializeAfter); }
559 
561  void clearSerializeAfter() { status.reset(SerializeAfter); }
562 
564  bool isTempSerializeAfter() { return status[SerializeAfter]; }
565 
567  void setSerializeHandled() { status.set(SerializeHandled); }
568 
574  bool isSerializeHandled() { return status[SerializeHandled]; }
575 
577  OpClass opClass() const { return staticInst->opClass(); }
578 
581  { return staticInst->branchTarget(pc); }
582 
584  int8_t numSrcRegs() const { return staticInst->numSrcRegs(); }
585 
587  int8_t numDestRegs() const { return staticInst->numDestRegs(); }
588 
589  // the following are used to track physical register usage
590  // for machines with separate int & FP reg files
591  int8_t numFPDestRegs() const { return staticInst->numFPDestRegs(); }
592  int8_t numIntDestRegs() const { return staticInst->numIntDestRegs(); }
593  int8_t numCCDestRegs() const { return staticInst->numCCDestRegs(); }
594  int8_t numVecDestRegs() const { return staticInst->numVecDestRegs(); }
595  int8_t numVecElemDestRegs() const
596  {
597  return staticInst->numVecElemDestRegs();
598  }
599  int8_t
601  {
602  return staticInst->numVecPredDestRegs();
603  }
604 
606  const RegId& destRegIdx(int i) const { return staticInst->destRegIdx(i); }
607 
609  const RegId& srcRegIdx(int i) const { return staticInst->srcRegIdx(i); }
610 
612  uint8_t resultSize() { return instResult.size(); }
613 
618  {
619  if (!instResult.empty()) {
620  InstResult t = instResult.front();
621  instResult.pop();
622  return t;
623  }
624  return dflt;
625  }
626 
630  template<typename T>
631  void setScalarResult(T&& t)
632  {
633  if (instFlags[RecordResult]) {
634  instResult.push(InstResult(std::forward<T>(t),
636  }
637  }
638 
640  template<typename T>
641  void setVecResult(T&& t)
642  {
643  if (instFlags[RecordResult]) {
644  instResult.push(InstResult(std::forward<T>(t),
646  }
647  }
648 
650  template<typename T>
651  void setVecElemResult(T&& t)
652  {
653  if (instFlags[RecordResult]) {
654  instResult.push(InstResult(std::forward<T>(t),
656  }
657  }
658 
660  template<typename T>
661  void setVecPredResult(T&& t)
662  {
663  if (instFlags[RecordResult]) {
664  instResult.push(InstResult(std::forward<T>(t),
666  }
667  }
671  void setIntRegOperand(const StaticInst *si, int idx, RegVal val)
672  {
673  setScalarResult(val);
674  }
675 
677  void setCCRegOperand(const StaticInst *si, int idx, RegVal val)
678  {
679  setScalarResult(val);
680  }
681 
683  void setVecRegOperand(const StaticInst *si, int idx,
684  const VecRegContainer& val)
685  {
686  setVecResult(val);
687  }
688 
690  void
692  {
693  setScalarResult(val);
694  }
695 
697  void setVecElemOperand(const StaticInst *si, int idx, const VecElem val)
698  {
699  setVecElemResult(val);
700  }
701 
703  void setVecPredRegOperand(const StaticInst *si, int idx,
704  const VecPredRegContainer& val)
705  {
706  setVecPredResult(val);
707  }
708 
710  void markSrcRegReady();
711 
713  void markSrcRegReady(RegIndex src_idx);
714 
716  bool isReadySrcRegIdx(int idx) const
717  {
718  return this->_readySrcRegIdx[idx];
719  }
720 
722  void setCompleted() { status.set(Completed); }
723 
725  bool isCompleted() const { return status[Completed]; }
726 
728  void setResultReady() { status.set(ResultReady); }
729 
731  bool isResultReady() const { return status[ResultReady]; }
732 
734  void setCanIssue() { status.set(CanIssue); }
735 
737  bool readyToIssue() const { return status[CanIssue]; }
738 
740  void clearCanIssue() { status.reset(CanIssue); }
741 
743  void setIssued() { status.set(Issued); }
744 
746  bool isIssued() const { return status[Issued]; }
747 
749  void clearIssued() { status.reset(Issued); }
750 
752  void setExecuted() { status.set(Executed); }
753 
755  bool isExecuted() const { return status[Executed]; }
756 
758  void setCanCommit() { status.set(CanCommit); }
759 
761  void clearCanCommit() { status.reset(CanCommit); }
762 
764  bool readyToCommit() const { return status[CanCommit]; }
765 
766  void setAtCommit() { status.set(AtCommit); }
767 
768  bool isAtCommit() { return status[AtCommit]; }
769 
771  void setCommitted() { status.set(Committed); }
772 
774  bool isCommitted() const { return status[Committed]; }
775 
777  void setSquashed();
778 
780  bool isSquashed() const { return status[Squashed]; }
781 
782  //Instruction Queue Entry
783  //-----------------------
785  void setInIQ() { status.set(IqEntry); }
786 
788  void clearInIQ() { status.reset(IqEntry); }
789 
791  bool isInIQ() const { return status[IqEntry]; }
792 
794  void setSquashedInIQ() { status.set(SquashedInIQ); status.set(Squashed);}
795 
797  bool isSquashedInIQ() const { return status[SquashedInIQ]; }
798 
799 
800  //Load / Store Queue Functions
801  //-----------------------
803  void setInLSQ() { status.set(LsqEntry); }
804 
806  void removeInLSQ() { status.reset(LsqEntry); }
807 
809  bool isInLSQ() const { return status[LsqEntry]; }
810 
812  void setSquashedInLSQ() { status.set(SquashedInLSQ); status.set(Squashed);}
813 
815  bool isSquashedInLSQ() const { return status[SquashedInLSQ]; }
816 
817 
818  //Reorder Buffer Functions
819  //-----------------------
821  void setInROB() { status.set(RobEntry); }
822 
824  void clearInROB() { status.reset(RobEntry); }
825 
827  bool isInROB() const { return status[RobEntry]; }
828 
830  void setSquashedInROB() { status.set(SquashedInROB); }
831 
833  bool isSquashedInROB() const { return status[SquashedInROB]; }
834 
836  bool isPinnedRegsRenamed() const { return status[PinnedRegsRenamed]; }
837 
839  void
841  {
842  assert(!status[PinnedRegsSquashDone]);
843  assert(!status[PinnedRegsWritten]);
844  status.set(PinnedRegsRenamed);
845  }
846 
848  bool isPinnedRegsWritten() const { return status[PinnedRegsWritten]; }
849 
851  void
853  {
854  assert(!status[PinnedRegsSquashDone]);
855  assert(status[PinnedRegsRenamed]);
856  status.set(PinnedRegsWritten);
857  }
858 
860  bool
861  isPinnedRegsSquashDone() const { return status[PinnedRegsSquashDone]; }
862 
864  void
866  assert(!status[PinnedRegsSquashDone]);
867  status.set(PinnedRegsSquashDone);
868  }
869 
871  TheISA::PCState pcState() const { return pc; }
872 
874  void pcState(const TheISA::PCState &val) { pc = val; }
875 
877  Addr instAddr() const { return pc.instAddr(); }
878 
880  Addr nextInstAddr() const { return pc.nextInstAddr(); }
881 
883  Addr microPC() const { return pc.microPC(); }
884 
885  bool readPredicate() const
886  {
887  return instFlags[Predicate];
888  }
889 
890  void setPredicate(bool val)
891  {
892  instFlags[Predicate] = val;
893 
894  if (traceData) {
895  traceData->setPredicate(val);
896  }
897  }
898 
899  bool
901  {
902  return instFlags[MemAccPredicate];
903  }
904 
905  void
907  {
908  instFlags[MemAccPredicate] = val;
909  }
910 
912  void setASID(short addr_space_id) { asid = addr_space_id; }
913  short getASID() { return asid; }
914 
916  void setTid(ThreadID tid) { threadNumber = tid; }
917 
919  void setThreadState(ImplState *state) { thread = state; }
920 
922  ThreadContext *tcBase() { return thread->getTC(); }
923 
924  public:
926  bool eaSrcsReady() const;
927 
929  bool strictlyOrdered() const { return instFlags[IsStrictlyOrdered]; }
930  void strictlyOrdered(bool so) { instFlags[IsStrictlyOrdered] = so; }
931 
933  bool hasRequest() const { return instFlags[ReqMade]; }
935  void setRequest() { instFlags[ReqMade] = true; }
936 
938  ListIt &getInstListIt() { return instListIt; }
939 
941  void setInstListIt(ListIt _instListIt) { instListIt = _instListIt; }
942 
943  public:
945  unsigned int readStCondFailures() const
946  { return thread->storeCondFailures; }
947 
949  void setStCondFailures(unsigned int sc_failures)
950  { thread->storeCondFailures = sc_failures; }
951 
952  public:
953  // monitor/mwait funtions
954  void armMonitor(Addr address) { cpu->armMonitor(threadNumber, address); }
955  bool mwait(PacketPtr pkt) { return cpu->mwait(threadNumber, pkt); }
957  { return cpu->mwaitAtomic(threadNumber, tc, cpu->dtb); }
959  { return cpu->getCpuAddrMonitor(threadNumber); }
960 };
961 
962 template<class Impl>
963 Fault
965  Request::Flags flags,
966  const std::vector<bool>& byte_enable)
967 {
968  assert(byte_enable.empty() || byte_enable.size() == size);
969  return cpu->pushRequest(
970  dynamic_cast<typename DynInstPtr::PtrType>(this),
971  /* ld */ true, nullptr, size, addr, flags, nullptr, nullptr,
972  byte_enable);
973 }
974 
975 template<class Impl>
976 Fault
977 BaseDynInst<Impl>::writeMem(uint8_t *data, unsigned size, Addr addr,
978  Request::Flags flags, uint64_t *res,
979  const std::vector<bool>& byte_enable)
980 {
981  assert(byte_enable.empty() || byte_enable.size() == size);
982  return cpu->pushRequest(
983  dynamic_cast<typename DynInstPtr::PtrType>(this),
984  /* st */ false, data, size, addr, flags, res, nullptr,
985  byte_enable);
986 }
987 
988 template<class Impl>
989 Fault
991  Request::Flags flags,
992  AtomicOpFunctorPtr amo_op)
993 {
994  // atomic memory instructions do not have data to be written to memory yet
995  // since the atomic operations will be executed directly in cache/memory.
996  // Therefore, its `data` field is nullptr.
997  // Atomic memory requests need to carry their `amo_op` fields to cache/
998  // memory
999  return cpu->pushRequest(
1000  dynamic_cast<typename DynInstPtr::PtrType>(this),
1001  /* atomic */ false, nullptr, size, addr, flags, nullptr,
1002  std::move(amo_op));
1003 }
1004 
1005 #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:180
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:160
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:133
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:198
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:160
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:196
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:159
bool isSerializeAfter() const
void clearSerializeAfter()
Clears the serializeAfter part of this instruction.
std::shared_ptr< Request > RequestPtr
Definition: request.hh:83
bool isCondCtrl() const
int8_t numVecElemDestRegs() const
Number of vector element destination regs.
Definition: static_inst.hh:143
int8_t numVecPredDestRegs() const
Number of predicate destination regs.
Definition: static_inst.hh:145
ip6_addr_t addr
Definition: inet.hh:335
std::unique_ptr< AtomicOpFunctor > AtomicOpFunctorPtr
Definition: amo.hh:230
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:135
bool isFloating() const
Definition: static_inst.hh:169
int8_t numIntDestRegs() const
bool isUnverifiable() const
Definition: static_inst.hh:194
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:161
void setVecPredResult(T &&t)
Predicate result.
std::array< PhysRegIdPtr, TheISA::MaxInstDestRegs > _destRegIdx
Physical register index of the destination registers of this instruction.
short asid
data address space ID, for loads & stores.
void hitExternalSnoop(bool f)
uint64_t RegVal
Definition: types.hh:168
Trace::InstRecord * traceData
InstRecord that tracks this instructions.
bool isDataPrefetch() const
Definition: static_inst.hh:164
bool isIndirectCtrl() const
Definition: static_inst.hh:177
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:220
bool isSerializeBefore() const
Definition: static_inst.hh:186
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:195
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.
short getASID()
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:137
void clearIssued()
Clears this instruction as being issued.
bool isLoad() const
bool isReturn() const
Definition: static_inst.hh:175
const int MaxInstSrcRegs
Definition: registers.hh:59
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:120
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:202
Bitfield< 28 > so
Definition: miscregs.hh:51
bool isDirectCtrl() const
Definition: static_inst.hh:176
bool isUncondCtrl() const
Definition: static_inst.hh:179
bool isAtCommit()
void setScalarResult(T &&t)
Pushes a result onto the instResult queue.
bool isMemBarrier() const
Definition: static_inst.hh:189
PhysRegIdPtr renamedDestRegIdx(int idx) const
Returns the physical register index of the i&#39;th destination register.
Bitfield< 63 > val
Definition: misc.hh:771
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:55
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:158
bool isNop() const
Definition: static_inst.hh:156
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:336
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:141
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:183
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Definition: exec_context.hh:73
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:190
void setSerializeBefore()
Temporarily sets this instruction as a serialize before instruction.
uint16_t RegIndex
Definition: types.hh:42
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:35
::DummyVecRegContainer VecRegContainer
Definition: registers.hh:53
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:178
unsigned effSize
The size of the request.
void demapInstPage(Addr vaddr, uint64_t asn)
ImplCPU::ImplState ImplState
bool isIprAccess() const
Definition: static_inst.hh:193
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:192
AddressMonitor * getAddrMonitor()
bool isDelayedCommit() const
void setPredicate(bool val)
Definition: insttracer.hh:222
Instruction is squashed in the LSQ.
bool isThreadSync() const
void setASID(short addr_space_id)
Sets the ASID.
bool mispredicted()
Returns whether the instruction mispredicted.
uint64_t InstSeqNum
Definition: inst_seq.hh:40
bool isCall() const
Definition: static_inst.hh:174
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:59
void setMemAccPredicate(bool val)
void clearInROB()
Sets this instruction as a entry the ROB.
STL list class.
Definition: stl.hh:54
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:142
TheISA::PCState pc
PC state for this instruction.
TheISA::PCState branchTarget() const
Returns the branch target address.
uint16_t MasterID
Definition: request.hh:86
SQIterator sqIt
std::bitset< MaxInstSrcRegs > _readySrcRegIdx
Whether or not the source register is ready.
Pinned registers are renamed.
void advancePC(PCState &pc, const StaticInstPtr &inst)
Definition: utility.hh:98
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:255
bool isInteger() const
Definition: static_inst.hh:168
Instruction can issue and execute.
ThreadContext * tcBase()
Returns the thread context.
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:211
bool isStoreConditional() const
Definition: static_inst.hh:162
int8_t numFPDestRegs() const
bool isFirstMicroop() const
Definition: static_inst.hh:200
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:170
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:229
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:227
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:107
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:173
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
GenericISA::SimplePCState< MachInst > PCState
Definition: types.hh:43
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:51
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:147
LQIterator lqIt
bool notAnInst() const
bool isNonSpeculative() const
Definition: static_inst.hh:191
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:83
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:216
OpClass opClass() const
Returns the opclass of this instruction.
const StaticInstPtr macroop
The Macroop if one exists.
bool isSquashAfter() const
Definition: static_inst.hh:188
Register ID: describe an architectural register with its class and index.
Definition: reg_class.hh:79
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.
TheISA::VecElem VecElem
Definition: exec_context.hh:78
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:187
std::shared_ptr< FaultBase > Fault
Definition: types.hh:240
int8_t numIntDestRegs() const
Number of integer destination regs.
Definition: static_inst.hh:139
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:197
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:231
bool isThreadSync() const
Definition: static_inst.hh:182
bool isAtomic() const
Instruction has completed.
bool isInstPrefetch() const
Definition: static_inst.hh:163
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.
bool isLastMicroop() const
Definition: static_inst.hh:199
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 Fri Feb 28 2020 16:26:59 for gem5 by doxygen 1.8.13