arch: Make the decoder moreBytes method virtual.
Change-Id: I9135508916de91172ec9649d59d80574ac2aaf16 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52077 Tested-by: kokoro <noreply+kokoro@google.com> Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br> Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
@@ -135,33 +135,7 @@ class Decoder : public InstDecoder
|
||||
/** Reset the decoders internal state. */
|
||||
void reset() override;
|
||||
|
||||
/**
|
||||
* 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)).
|
||||
*
|
||||
* @param pc Instruction pointer that we are decoding.
|
||||
* @param fetchPC The address this chunk was fetched from.
|
||||
* @param inst Raw instruction data.
|
||||
*/
|
||||
void moreBytes(const PCStateBase &pc, Addr fetchPC);
|
||||
void moreBytes(const PCStateBase &pc, Addr fetchPC) override;
|
||||
|
||||
/**
|
||||
* Decode an instruction or fetch it from the code cache.
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#ifndef __ARCH_GENERIC_DECODER_HH__
|
||||
#define __ARCH_GENERIC_DECODER_HH__
|
||||
|
||||
#include "arch/generic/pcstate.hh"
|
||||
#include "base/bitfield.hh"
|
||||
#include "base/intmath.hh"
|
||||
#include "base/types.hh"
|
||||
@@ -96,6 +97,33 @@ class InstDecoder
|
||||
* instReady() even if this method returns true.
|
||||
*/
|
||||
bool needMoreBytes() const { return outOfBytes; }
|
||||
|
||||
/**
|
||||
* 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(PCStateBase &).
|
||||
*
|
||||
* 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)).
|
||||
*
|
||||
* @param pc Instruction pointer that we are decoding.
|
||||
* @param fetchPC The address this chunk was fetched from.
|
||||
*/
|
||||
virtual void moreBytes(const PCStateBase &pc, Addr fetchPC) = 0;
|
||||
};
|
||||
|
||||
} // namespace gem5
|
||||
|
||||
@@ -58,7 +58,7 @@ class Decoder : public InstDecoder
|
||||
//Use this to give data to the decoder. This should be used
|
||||
//when there is control flow.
|
||||
void
|
||||
moreBytes(const PCStateBase &pc, Addr fetchPC)
|
||||
moreBytes(const PCStateBase &pc, Addr fetchPC) override
|
||||
{
|
||||
emi = letoh(machInst);
|
||||
instDone = true;
|
||||
|
||||
@@ -55,7 +55,7 @@ class Decoder : public InstDecoder
|
||||
// Use this to give data to the predecoder. This should be used
|
||||
// when there is control flow.
|
||||
void
|
||||
moreBytes(const PCStateBase &pc, Addr fetchPC)
|
||||
moreBytes(const PCStateBase &pc, Addr fetchPC) override
|
||||
{
|
||||
emi = gtoh(emi, pc.as<PCState>().byteOrder());
|
||||
instDone = true;
|
||||
|
||||
@@ -73,7 +73,7 @@ class Decoder : public InstDecoder
|
||||
|
||||
//Use this to give data to the decoder. This should be used
|
||||
//when there is control flow.
|
||||
void moreBytes(const PCStateBase &pc, Addr fetchPC);
|
||||
void moreBytes(const PCStateBase &pc, Addr fetchPC) override;
|
||||
|
||||
StaticInstPtr decode(PCStateBase &nextPC);
|
||||
};
|
||||
|
||||
@@ -57,7 +57,7 @@ class Decoder : public InstDecoder
|
||||
// Use this to give data to the predecoder. This should be used
|
||||
// when there is control flow.
|
||||
void
|
||||
moreBytes(const PCStateBase &pc, Addr fetchPC)
|
||||
moreBytes(const PCStateBase &pc, Addr fetchPC) override
|
||||
{
|
||||
emi = betoh(machInst);
|
||||
// The I bit, bit 13, is used to figure out where the ASI
|
||||
|
||||
@@ -319,7 +319,7 @@ class Decoder : public InstDecoder
|
||||
// Use this to give data to the decoder. This should be used
|
||||
// when there is control flow.
|
||||
void
|
||||
moreBytes(const PCStateBase &pc, Addr fetchPC)
|
||||
moreBytes(const PCStateBase &pc, Addr fetchPC) override
|
||||
{
|
||||
DPRINTF(Decoder, "Getting more bytes.\n");
|
||||
basePC = fetchPC;
|
||||
|
||||
Reference in New Issue
Block a user