arch: Promote outOfBytes/needMoreBytes to the InstDecoder class.

Change-Id: Ie8f31e424081f002e3d74edd1685b4a977c545c3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/52073
Reviewed-by: Daniel Carvalho <odanrc@yahoo.com.br>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-10-25 02:08:30 -07:00
parent 29950b81ce
commit 5e7c964158
8 changed files with 14 additions and 38 deletions

View File

@@ -66,7 +66,6 @@ class Decoder : public InstDecoder
ExtMachInst emi;
uint32_t data;
bool bigThumb;
bool outOfBytes;
int offset;
bool foundIt;
ITSTATE itBits;
@@ -136,15 +135,6 @@ class Decoder : public InstDecoder
/** Reset the decoders internal state. */
void reset();
/**
* 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.
*/
bool needMoreBytes() const { return outOfBytes; }
/**
* Feed data to the decoder.
*

View File

@@ -44,6 +44,7 @@ class InstDecoder
Addr _pcMask;
bool instDone = false;
bool outOfBytes = true;
public:
template <typename MoreBytesType>
@@ -68,6 +69,15 @@ class InstDecoder
* decode a full instruction.
*/
bool instReady() const { return instDone; }
/**
* 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.
*/
bool needMoreBytes() const { return outOfBytes; }
};
} // namespace gem5

View File

@@ -75,12 +75,6 @@ class Decoder : public InstDecoder
instDone = true;
}
bool
needMoreBytes()
{
return true;
}
void takeOverFrom(Decoder *old) {}
protected:

View File

@@ -72,12 +72,6 @@ class Decoder : public InstDecoder
instDone = true;
}
bool
needMoreBytes()
{
return true;
}
void takeOverFrom(Decoder *old) {}
protected:

View File

@@ -42,7 +42,7 @@ void Decoder::reset()
{
aligned = true;
mid = false;
more = true;
outOfBytes = true;
emi = 0;
instDone = false;
}
@@ -63,19 +63,19 @@ Decoder::moreBytes(const PCStateBase &pc, Addr fetchPC)
emi = inst;
if (compressed(emi))
emi = bits(emi, mid_bit, 0);
more = !compressed(emi);
outOfBytes = !compressed(emi);
instDone = true;
} else {
if (mid) {
assert(bits(emi, max_bit, mid_bit + 1) == 0);
replaceBits(emi, max_bit, mid_bit + 1, inst);
mid = false;
more = false;
outOfBytes = false;
instDone = true;
} else {
emi = bits(inst, max_bit, mid_bit + 1);
mid = !compressed(emi);
more = true;
outOfBytes = true;
instDone = compressed(emi);
}
}

View File

@@ -51,7 +51,6 @@ class Decoder : public InstDecoder
decode_cache::InstMap<ExtMachInst> instMap;
bool aligned;
bool mid;
bool more;
protected:
//The extended machine instruction being generated
@@ -77,7 +76,6 @@ class Decoder : public InstDecoder
//when there is control flow.
void moreBytes(const PCStateBase &pc, Addr fetchPC);
bool needMoreBytes() { return more; }
void takeOverFrom(Decoder *old) {}
StaticInstPtr decode(PCStateBase &nextPC);

View File

@@ -82,12 +82,6 @@ class Decoder : public InstDecoder
instDone = true;
}
bool
needMoreBytes()
{
return true;
}
void
setContext(RegVal _asi)
{

View File

@@ -174,8 +174,6 @@ class Decoder : public InstDecoder
// State machine state.
protected:
// Whether or not we're out of bytes.
bool outOfBytes = true;
// The size of the displacement value.
int displacementSize;
// The size of the immediate value.
@@ -321,8 +319,6 @@ class Decoder : public InstDecoder
process();
}
bool needMoreBytes() { return outOfBytes; }
void
updateNPC(X86ISA::PCState &nextPC)
{