gem5
v20.1.0.0
|
#include <decoder.hh>
Public Member Functions | |
Decoder (ISA *isa=nullptr) | |
void | reset () |
Reset the decoders internal state. More... | |
bool | needMoreBytes () const |
Can the decoder accept more data? More... | |
bool | instReady () const |
Is an instruction ready to be decoded? More... | |
void | moreBytes (const PCState &pc, Addr fetchPC, MachInst inst) |
Feed data to the decoder. More... | |
StaticInstPtr | decode (ArmISA::PCState &pc) |
Decode an instruction or fetch it from the code cache. More... | |
StaticInstPtr | decode (ExtMachInst mach_inst, Addr addr) |
Decode a pre-decoded machine instruction. More... | |
StaticInstPtr | decodeInst (ExtMachInst mach_inst) |
Decode a machine instruction without calling the cache. More... | |
void | takeOverFrom (Decoder *old) |
Take over the state from an old decoder when switching CPUs. More... | |
void | setContext (FPSCR fpscr) |
void | setSveLen (uint8_t len) |
Public Member Functions inherited from InstDecoder | |
virtual StaticInstPtr | fetchRomMicroop (MicroPC micropc, StaticInstPtr curMacroop) |
Protected Member Functions | |
void | process () |
Pre-decode an instruction from the current state of the decoder. More... | |
void | consumeBytes (int numBytes) |
Consume bytes by moving the offset into the data word and sanity check the results. More... | |
Protected Attributes | |
ExtMachInst | emi |
MachInst | data |
bool | bigThumb |
bool | instDone |
bool | outOfBytes |
int | offset |
bool | foundIt |
ITSTATE | itBits |
int | fpscrLen |
int | fpscrStride |
int | sveLen |
SVE vector length, encoded in the same format as the ZCR_EL<x>.LEN bitfields. More... | |
Enums::DecoderFlavor | decoderFlavor |
Static Protected Attributes | |
static GenericISA::BasicDecodeCache | defaultCache |
A cache of decoded instruction objects. More... | |
Definition at line 58 of file decoder.hh.
ArmISA::Decoder::Decoder | ( | ISA * | isa = nullptr | ) |
Definition at line 55 of file decoder.cc.
References ArmISA::ISA::getCurSveVecLenInBitsAtReset(), reset(), and sveLen.
|
protected |
Consume bytes by moving the offset into the data word and sanity check the results.
Definition at line 144 of file decoder.cc.
References emi, offset, and outOfBytes.
Referenced by process().
StaticInstPtr ArmISA::Decoder::decode | ( | ArmISA::PCState & | pc | ) |
Decode an instruction or fetch it from the code cache.
This method decodes the currently pending pre-decoded instruction. Data must be fed to the decoder using moreBytes() until instReady() is true before calling this method.
pc | Instruction pointer that we are decoding. |
Definition at line 172 of file decoder.cc.
References emi, foundIt, instDone, itBits, and MipsISA::pc.
|
inline |
Decode a pre-decoded machine instruction.
@warn This method takes a pre-decoded instruction as its argument. It should typically not be called directly.
mach_inst | A pre-decoded instruction |
A | pointer to the corresponding StaticInst object. |
Definition at line 172 of file decoder.hh.
References addr, GenericISA::BasicDecodeCache::decode(), and defaultCache.
StaticInstPtr ArmISA::Decoder::decodeInst | ( | ExtMachInst | mach_inst | ) |
Decode a machine instruction without calling the cache.
@warn This method takes a pre-decoded instruction as its argument. It should typically not be called directly.
mach_inst | The binary instruction to decode. |
A | pointer to the corresponding StaticInst object. |
|
inline |
Is an instruction ready to be decoded?
CPU models call this method to determine if decode() will return a new instruction on the next call. It typically only returns false if the decoder hasn't received enough data to decode a full instruction.
Definition at line 120 of file decoder.hh.
References instDone.
Feed data to the decoder.
A CPU model uses this interface to load instruction data into the decoder. Once enough data has been loaded (check with instReady()), a decoded instruction can be retrieved using decode(ArmISA::PCState).
This method is intended to support both fixed-length and variable-length instructions. Instruction data is fetch in MachInst blocks (which correspond to the size of a typical insturction). The method might need to be called multiple times if the instruction spans multiple blocks, in that case needMoreBytes() will return true and instReady() will return false.
The fetchPC parameter is used to indicate where in memory the instruction was fetched from. This is should be the same address as the pc. If fetching multiple blocks, it indicates where subsequent blocks are fetched from (pc + n * sizeof(MachInst)).
pc | Instruction pointer that we are decoding. |
fetchPC | The address this chunk was fetched from. |
inst | Raw instruction data. |
Definition at line 153 of file decoder.cc.
References data, emi, fpscrLen, fpscrStride, letoh(), offset, ArmISA::OK, outOfBytes, MipsISA::pc, process(), sveLen, and ArmISA::UNALIGNED.
|
inline |
Can the decoder accept more data?
A CPU model uses this method to determine if the decoder can accept more data. Note that an instruction can be ready (see instReady() even if this method returns true.
Definition at line 110 of file decoder.hh.
References outOfBytes.
|
protected |
Pre-decode an instruction from the current state of the decoder.
Definition at line 77 of file decoder.cc.
References bigThumb, bits(), ArmISA::COND_UC, consumeBytes(), data, DPRINTF, emi, foundIt, instDone, itBits, and offset.
Referenced by moreBytes().
void ArmISA::Decoder::reset | ( | ) |
Reset the decoders internal state.
Definition at line 66 of file decoder.cc.
References bigThumb, emi, foundIt, instDone, offset, and outOfBytes.
Referenced by Decoder().
|
inline |
Definition at line 200 of file decoder.hh.
References fpscrLen, and fpscrStride.
|
inline |
Definition at line 206 of file decoder.hh.
References ArmISA::len, and sveLen.
|
inline |
Take over the state from an old decoder when switching CPUs.
old | Decoder used in old CPU |
Definition at line 196 of file decoder.hh.
|
protected |
Definition at line 64 of file decoder.hh.
|
protected |
Definition at line 63 of file decoder.hh.
Referenced by moreBytes(), and process().
|
protected |
Definition at line 80 of file decoder.hh.
|
staticprotected |
A cache of decoded instruction objects.
Definition at line 83 of file decoder.hh.
Referenced by decode().
|
protected |
Definition at line 62 of file decoder.hh.
Referenced by consumeBytes(), decode(), moreBytes(), process(), and reset().
|
protected |
Definition at line 68 of file decoder.hh.
|
protected |
Definition at line 71 of file decoder.hh.
Referenced by moreBytes(), and setContext().
|
protected |
Definition at line 72 of file decoder.hh.
Referenced by moreBytes(), and setContext().
|
protected |
Definition at line 65 of file decoder.hh.
Referenced by decode(), instReady(), process(), and reset().
|
protected |
Definition at line 69 of file decoder.hh.
|
protected |
Definition at line 67 of file decoder.hh.
Referenced by consumeBytes(), moreBytes(), process(), and reset().
|
protected |
Definition at line 66 of file decoder.hh.
Referenced by consumeBytes(), moreBytes(), needMoreBytes(), and reset().
|
protected |
SVE vector length, encoded in the same format as the ZCR_EL<x>.LEN bitfields.
Definition at line 78 of file decoder.hh.
Referenced by Decoder(), moreBytes(), and setSveLen().