43#ifndef __CPU_STATIC_INST_HH__
44#define __CPU_STATIC_INST_HH__
58#include "enums/StaticInstFlags.hh"
170 flags[IsSerializeBefore] ||
171 flags[IsSerializeAfter]; }
178 return flags[IsReadBarrier] &&
flags[IsWriteBarrier];
240 virtual uint64_t
getEMI()
const {
return 0; }
300 panic(
"initiateAcc not defined!");
307 panic(
"completeAcc not defined!");
313 virtual std::unique_ptr<PCStateBase>
316 panic(
"buildRetPC not defined!");
322 "Instruction size for this instruction not set! It's size is "
323 "required for the decoupled front-end. Either use the standard "
324 "front-end or this ISA needs to be extended with the instruction "
325 "size. Refer to the X86, Arm or RiscV decoders for an example.");
368 void printFlags(std::ostream &outs,
const std::string &separator)
const;
378 size_t size =
sizeof(T);
379 if (
size <= max_size)
380 *
reinterpret_cast<T *
>(buf) =
htole<T>(
t);
396 virtual size_t asBytes(
void *buf,
size_t max_size) {
return 0; }
The ExecContext is an abstract base class the provides the interface used by the ISA to manipulate th...
Wrapper that groups a few flag bits under the same undelying container.
A Packet is used to encapsulate a transfer between two objects in the memory system (e....
Derive from RefCounted if you want to enable reference counting of this class.
Register ID: describe an architectural register with its class and index.
Base, ISA-independent static instruction class.
static StaticInstPtr nullStaticInstPtr
Pointer to a statically allocated "null" instruction object.
StaticInst(const char *_mnemonic, OpClass op_class)
Constructor.
void printFlags(std::ostream &outs, const std::string &separator) const
Print a separator separated list of this instruction's set flag names on the given stream.
virtual const std::string & disassemble(Addr pc, const loader::SymbolTable *symtab=nullptr) const
Return string representation of disassembled instruction.
bool isUnverifiable() const
RegIdArrayPtr _srcRegIdxPtr
See srcRegIdx().
virtual uint64_t getEMI() const
uint8_t numSrcRegs() const
Number of source registers.
virtual StaticInstPtr fetchMicroop(MicroPC upc) const
Return the microop that goes with a particular micropc.
virtual void size(size_t newSize)
virtual std::string generateDisassembly(Addr pc, const loader::SymbolTable *symtab) const =0
Internal function to generate disassembly string.
void setDestRegIdx(int i, const RegId &val)
OpClass opClass() const
Operation class. Used to select appropriate function unit in issue.
void setRegIdxArrays(RegIdArrayPtr src, RegIdArrayPtr dest)
Set the pointers which point to the arrays of source and destination register indices.
virtual std::unique_ptr< PCStateBase > buildRetPC(const PCStateBase &cur_pc, const PCStateBase &call_pc) const
std::array< uint8_t, MiscRegClass+1 > _numTypedDestRegs
std::unique_ptr< std::string > cachedDisassembly
String representation of disassembly (lazily evaluated via disassemble()).
bool isStoreConditional() const
bool isFirstMicroop() const
bool isDirectCtrl() const
bool isUncondCtrl() const
bool isSerializeBefore() const
virtual std::unique_ptr< PCStateBase > branchTarget(const PCStateBase &pc) const
Return the target address for a PC-relative branch.
size_t simpleAsBytes(void *buf, size_t max_size, const T &t)
bool isSquashAfter() const
uint8_t numDestRegs() const
Number of destination registers.
virtual void advancePC(PCStateBase &pc_state) const =0
RegId(StaticInst::*)[] RegIdArrayPtr
bool isWriteBarrier() const
uint8_t _numSrcRegs
See numSrcRegs().
virtual Fault execute(ExecContext *xc, trace::InstRecord *traceData) const =0
bool isReadBarrier() const
uint8_t _numDestRegs
See numDestRegs().
std::string getName()
Return name of machine instruction.
bool isNonSpeculative() const
RegIdArrayPtr _destRegIdxPtr
See destRegIdx().
const RegId & destRegIdx(int i) const
Return logical index (architectural reg num) of i'th destination reg.
bool isDataPrefetch() const
uint8_t numDestRegs(RegClassType type) const
Number of destination registers of a particular type.
bool isIndirectCtrl() const
bool isLastMicroop() const
void setSrcRegIdx(int i, const RegId &val)
bool isFullMemBarrier() const
size_t _size
Instruction size in bytes.
bool isInstPrefetch() const
bool isSerializing() const
const char * mnemonic
Base mnemonic (e.g., "add").
virtual Fault completeAcc(Packet *pkt, ExecContext *xc, trace::InstRecord *trace_data) const
std::bitset< Num_Flags > flags
Flag values for this instruction.
virtual size_t asBytes(void *buf, size_t max_size)
Instruction classes can override this function to return a a representation of themselves as a blob o...
const RegId & srcRegIdx(int i) const
Return logical index (architectural reg num) of i'th source reg.
virtual Fault initiateAcc(ExecContext *xc, trace::InstRecord *traceData) const
bool isDelayedCommit() const
bool isSerializeAfter() const
OpClass _opClass
See opClass().
ThreadContext is the external interface to all thread state for anything outside of the CPU.
#define panic(...)
This implements a cprintf based panic() function.
#define fatal(...)
This implements a cprintf based fatal() function.
ProbePointArg< PacketInfo > Packet
Packet probe point.
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.
std::shared_ptr< FaultBase > Fault
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
RegClassType
Enumerate the classes of registers.
Classes for managing reference counted objects.