gem5  v21.1.0.2
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
gem5::ArmISA::Decoder Class Reference

#include <decoder.hh>

Inheritance diagram for gem5::ArmISA::Decoder:
gem5::InstDecoder

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)
 Feed data to the decoder. More...
 
StaticInstPtr decode (ArmISA::PCState &pc)
 Decode an instruction or fetch it from the code 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 gem5::InstDecoder
template<typename MoreBytesType >
 InstDecoder (MoreBytesType *mb_buf)
 
virtual StaticInstPtr fetchRomMicroop (MicroPC micropc, StaticInstPtr curMacroop)
 
void * moreBytesPtr () const
 
size_t moreBytesSize () const
 
Addr pcMask () const
 

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...
 
StaticInstPtr decodeInst (ExtMachInst mach_inst)
 Decode a machine instruction without calling the cache. More...
 
StaticInstPtr decode (ExtMachInst mach_inst, Addr addr)
 Decode a pre-decoded machine instruction. More...
 

Protected Attributes

ExtMachInst emi
 
uint32_t 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
 
- Protected Attributes inherited from gem5::InstDecoder
void * _moreBytesPtr
 
size_t _moreBytesSize
 
Addr _pcMask
 

Static Protected Attributes

static GenericISA::BasicDecodeCache< Decoder, ExtMachInstdefaultCache
 A cache of decoded instruction objects. More...
 

Friends

class GenericISA::BasicDecodeCache< Decoder, ExtMachInst >
 

Detailed Description

Definition at line 62 of file decoder.hh.

Constructor & Destructor Documentation

◆ Decoder()

gem5::ArmISA::Decoder::Decoder ( ISA isa = nullptr)

Definition at line 57 of file decoder.cc.

References gem5::ArmISA::ISA::getCurSveVecLenInBitsAtReset(), reset(), and sveLen.

Member Function Documentation

◆ consumeBytes()

void gem5::ArmISA::Decoder::consumeBytes ( int  numBytes)
protected

Consume bytes by moving the offset into the data word and sanity check the results.

Definition at line 146 of file decoder.cc.

References data, emi, offset, and outOfBytes.

Referenced by process().

◆ decode() [1/2]

StaticInstPtr gem5::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.

Parameters
pcInstruction pointer that we are decoding.
Returns
A pointer to a static instruction or NULL if the decoder isn't ready (see instReady()).

Definition at line 174 of file decoder.cc.

References decode(), emi, foundIt, instDone, itBits, and gem5::MipsISA::pc.

◆ decode() [2/2]

StaticInstPtr gem5::ArmISA::Decoder::decode ( ExtMachInst  mach_inst,
Addr  addr 
)
inlineprotected

Decode a pre-decoded machine instruction.

@warn This method takes a pre-decoded instruction as its argument. It should typically not be called directly.

Parameters
mach_instA pre-decoded instruction
Return values
Apointer to the corresponding StaticInst object.

Definition at line 126 of file decoder.hh.

References gem5::X86ISA::addr, defaultCache, DPRINTF, and gem5::ArmISA::si.

Referenced by decode().

◆ decodeInst()

StaticInstPtr gem5::ArmISA::Decoder::decodeInst ( ExtMachInst  mach_inst)
protected

Decode a machine instruction without calling the cache.

Note
The implementation of this method is generated by the ISA parser script.

@warn This method takes a pre-decoded instruction as its argument. It should typically not be called directly.

Parameters
mach_instThe binary instruction to decode.
Return values
Apointer to the corresponding StaticInst object.

◆ instReady()

bool gem5::ArmISA::Decoder::instReady ( ) const
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 157 of file decoder.hh.

References instDone.

◆ moreBytes()

void gem5::ArmISA::Decoder::moreBytes ( const PCState pc,
Addr  fetchPC 
)

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)).

Parameters
pcInstruction pointer that we are decoding.
fetchPCThe address this chunk was fetched from.
instRaw instruction data.

Definition at line 155 of file decoder.cc.

References data, emi, fpscrLen, fpscrStride, gem5::letoh(), offset, gem5::ArmISA::OK, outOfBytes, gem5::MipsISA::pc, process(), sveLen, and gem5::ArmISA::UNALIGNED.

◆ needMoreBytes()

bool gem5::ArmISA::Decoder::needMoreBytes ( ) const
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 147 of file decoder.hh.

References outOfBytes.

◆ process()

void gem5::ArmISA::Decoder::process ( )
protected

Pre-decode an instruction from the current state of the decoder.

Definition at line 79 of file decoder.cc.

References bigThumb, gem5::bits(), gem5::ArmISA::COND_UC, consumeBytes(), data, DPRINTF, emi, foundIt, instDone, itBits, and offset.

Referenced by moreBytes().

◆ reset()

void gem5::ArmISA::Decoder::reset ( )

Reset the decoders internal state.

Definition at line 68 of file decoder.cc.

References bigThumb, emi, foundIt, instDone, offset, and outOfBytes.

Referenced by Decoder().

◆ setContext()

void gem5::ArmISA::Decoder::setContext ( FPSCR  fpscr)
inline

Definition at line 210 of file decoder.hh.

References fpscrLen, and fpscrStride.

◆ setSveLen()

void gem5::ArmISA::Decoder::setSveLen ( uint8_t  len)
inline

Definition at line 217 of file decoder.hh.

References gem5::ArmISA::len, and sveLen.

◆ takeOverFrom()

void gem5::ArmISA::Decoder::takeOverFrom ( Decoder old)
inline

Take over the state from an old decoder when switching CPUs.

Parameters
oldDecoder used in old CPU

Definition at line 205 of file decoder.hh.

Friends And Related Function Documentation

◆ GenericISA::BasicDecodeCache< Decoder, ExtMachInst >

Definition at line 88 of file decoder.hh.

Member Data Documentation

◆ bigThumb

bool gem5::ArmISA::Decoder::bigThumb
protected

Definition at line 68 of file decoder.hh.

Referenced by process(), and reset().

◆ data

uint32_t gem5::ArmISA::Decoder::data
protected

Definition at line 67 of file decoder.hh.

Referenced by consumeBytes(), moreBytes(), and process().

◆ decoderFlavor

enums::DecoderFlavor gem5::ArmISA::Decoder::decoderFlavor
protected

Definition at line 84 of file decoder.hh.

◆ defaultCache

GenericISA::BasicDecodeCache< Decoder, ExtMachInst > gem5::ArmISA::Decoder::defaultCache
staticprotected

A cache of decoded instruction objects.

Definition at line 87 of file decoder.hh.

Referenced by decode().

◆ emi

ExtMachInst gem5::ArmISA::Decoder::emi
protected

Definition at line 66 of file decoder.hh.

Referenced by consumeBytes(), decode(), moreBytes(), process(), and reset().

◆ foundIt

bool gem5::ArmISA::Decoder::foundIt
protected

Definition at line 72 of file decoder.hh.

Referenced by decode(), process(), and reset().

◆ fpscrLen

int gem5::ArmISA::Decoder::fpscrLen
protected

Definition at line 75 of file decoder.hh.

Referenced by moreBytes(), and setContext().

◆ fpscrStride

int gem5::ArmISA::Decoder::fpscrStride
protected

Definition at line 76 of file decoder.hh.

Referenced by moreBytes(), and setContext().

◆ instDone

bool gem5::ArmISA::Decoder::instDone
protected

Definition at line 69 of file decoder.hh.

Referenced by decode(), instReady(), process(), and reset().

◆ itBits

ITSTATE gem5::ArmISA::Decoder::itBits
protected

Definition at line 73 of file decoder.hh.

Referenced by decode(), and process().

◆ offset

int gem5::ArmISA::Decoder::offset
protected

Definition at line 71 of file decoder.hh.

Referenced by consumeBytes(), moreBytes(), process(), and reset().

◆ outOfBytes

bool gem5::ArmISA::Decoder::outOfBytes
protected

Definition at line 70 of file decoder.hh.

Referenced by consumeBytes(), moreBytes(), needMoreBytes(), and reset().

◆ sveLen

int gem5::ArmISA::Decoder::sveLen
protected

SVE vector length, encoded in the same format as the ZCR_EL<x>.LEN bitfields.

Definition at line 82 of file decoder.hh.

Referenced by Decoder(), moreBytes(), and setSveLen().


The documentation for this class was generated from the following files:

Generated on Tue Sep 21 2021 12:28:31 for gem5 by doxygen 1.8.17