summaryrefslogtreecommitdiff
path: root/src/arch/riscv/decoder.hh
diff options
context:
space:
mode:
authorAlec Roelke <ar4jc@virginia.edu>2017-07-13 14:24:06 -0400
committerAlec Roelke <ar4jc@virginia.edu>2017-07-14 20:29:25 +0000
commit68b6f9c8a1819fdeee737cf369cc6a499b505a6c (patch)
tree5e83244b5105e118d9634e88816b8e8531e4f739 /src/arch/riscv/decoder.hh
parentd72eafa64b4313f30f4c7a25000ff04f5cf30380 (diff)
downloadgem5-68b6f9c8a1819fdeee737cf369cc6a499b505a6c.tar.xz
riscv: Fix bugs with RISC-V decoder and detailed CPUs
This patch fixes some bugs that were missed with the changes to the decoder that enabled compatibility with compressed instructions. In order to accommodate speculation with variable instruction widths, a few assertions in decoder had to be changed to returning faults as the specification describes should normally happen. The rest of these assertions will be changed in a later patch. [Remove commented-out debugging line and add clarifying comment to registerName in utility.hh.] Change-Id: I3f333008430d4a905cb59547a3513f5149b43b95 Reviewed-on: https://gem5-review.googlesource.com/4041 Reviewed-by: Jason Lowe-Power <jason@lowepower.com> Maintainer: Alec Roelke <ar4jc@virginia.edu>
Diffstat (limited to 'src/arch/riscv/decoder.hh')
-rw-r--r--src/arch/riscv/decoder.hh12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/arch/riscv/decoder.hh b/src/arch/riscv/decoder.hh
index ef644fa13..c1d68bf06 100644
--- a/src/arch/riscv/decoder.hh
+++ b/src/arch/riscv/decoder.hh
@@ -49,7 +49,9 @@ class Decoder
{
private:
DecodeCache::InstMap instMap;
+ bool aligned;
bool mid;
+ bool more;
protected:
//The extended machine instruction being generated
@@ -57,18 +59,18 @@ class Decoder
bool instDone;
public:
- Decoder(ISA* isa=nullptr)
- : mid(false), emi(NoopMachInst), instDone(false)
- {}
+ Decoder(ISA* isa=nullptr) { reset(); }
void process() {}
- void reset() { instDone = false; }
+ void reset();
+
+ inline bool compressed(ExtMachInst inst) { return (inst & 0x3) < 0x3; }
//Use this to give data to the decoder. This should be used
//when there is control flow.
void moreBytes(const PCState &pc, Addr fetchPC, MachInst inst);
- bool needMoreBytes() { return true; }
+ bool needMoreBytes() { return more; }
bool instReady() { return instDone; }
void takeOverFrom(Decoder *old) {}