CPU: Merge the predecoder and decoder.
These classes are always used together, and merging them will give the ISAs more flexibility in how they cache things and manage the process. --HG-- rename : src/arch/x86/predecoder_tables.cc => src/arch/x86/decoder_tables.cc
This commit is contained in:
@@ -1773,9 +1773,9 @@ InOrderCPU::getDTBPtr()
|
||||
}
|
||||
|
||||
TheISA::Decoder *
|
||||
InOrderCPU::getDecoderPtr()
|
||||
InOrderCPU::getDecoderPtr(unsigned tid)
|
||||
{
|
||||
return &resPool->getInstUnit()->decoder;
|
||||
return resPool->getInstUnit()->decoder[tid];
|
||||
}
|
||||
|
||||
Fault
|
||||
|
||||
@@ -342,7 +342,7 @@ class InOrderCPU : public BaseCPU
|
||||
TheISA::TLB *getITBPtr();
|
||||
TheISA::TLB *getDTBPtr();
|
||||
|
||||
TheISA::Decoder *getDecoderPtr();
|
||||
TheISA::Decoder *getDecoderPtr(unsigned tid);
|
||||
|
||||
/** Accessor Type for the SkedCache */
|
||||
typedef uint32_t SkedID;
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#include "arch/isa_traits.hh"
|
||||
#include "arch/locked_mem.hh"
|
||||
#include "arch/predecoder.hh"
|
||||
#include "arch/utility.hh"
|
||||
#include "config/the_isa.hh"
|
||||
#include "cpu/inorder/resources/cache_unit.hh"
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "arch/predecoder.hh"
|
||||
#include "arch/tlb.hh"
|
||||
#include "base/hashmap.hh"
|
||||
#include "config/the_isa.hh"
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
|
||||
#include "arch/isa_traits.hh"
|
||||
#include "arch/locked_mem.hh"
|
||||
#include "arch/predecoder.hh"
|
||||
#include "arch/utility.hh"
|
||||
#include "config/the_isa.hh"
|
||||
#include "cpu/inorder/resources/cache_unit.hh"
|
||||
@@ -60,7 +59,7 @@ FetchUnit::FetchUnit(string res_name, int res_id, int res_width,
|
||||
instSize(sizeof(TheISA::MachInst)), fetchBuffSize(params->fetchBuffSize)
|
||||
{
|
||||
for (int tid = 0; tid < MaxThreads; tid++)
|
||||
predecoder[tid] = new Predecoder(NULL);
|
||||
decoder[tid] = new Decoder(NULL);
|
||||
}
|
||||
|
||||
FetchUnit::~FetchUnit()
|
||||
@@ -92,7 +91,6 @@ void
|
||||
FetchUnit::createMachInst(std::list<FetchBlock*>::iterator fetch_it,
|
||||
DynInstPtr inst)
|
||||
{
|
||||
ExtMachInst ext_inst;
|
||||
Addr block_addr = cacheBlockAlign(inst->getMemAddr());
|
||||
Addr fetch_addr = inst->getMemAddr();
|
||||
unsigned fetch_offset = (fetch_addr - block_addr) / instSize;
|
||||
@@ -111,13 +109,11 @@ FetchUnit::createMachInst(std::list<FetchBlock*>::iterator fetch_it,
|
||||
MachInst mach_inst =
|
||||
TheISA::gtoh(fetchInsts[fetch_offset]);
|
||||
|
||||
predecoder[tid]->setTC(cpu->thread[tid]->getTC());
|
||||
predecoder[tid]->moreBytes(instPC, inst->instAddr(), mach_inst);
|
||||
assert(predecoder[tid]->extMachInstReady());
|
||||
ext_inst = predecoder[tid]->getExtMachInst(instPC);
|
||||
|
||||
decoder[tid]->setTC(cpu->thread[tid]->getTC());
|
||||
decoder[tid]->moreBytes(instPC, inst->instAddr(), mach_inst);
|
||||
assert(decoder[tid]->instReady());
|
||||
inst->setStaticInst(decoder[tid]->decode(instPC));
|
||||
inst->pcState(instPC);
|
||||
inst->setStaticInst(decoder.decode(ext_inst, instPC.instAddr()));
|
||||
}
|
||||
|
||||
void
|
||||
@@ -582,7 +578,7 @@ void
|
||||
FetchUnit::trap(Fault fault, ThreadID tid, DynInstPtr inst)
|
||||
{
|
||||
//@todo: per thread?
|
||||
predecoder[tid]->reset();
|
||||
decoder[tid]->reset();
|
||||
|
||||
//@todo: squash using dummy inst seq num
|
||||
squash(NULL, NumStages - 1, 0, tid);
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
#include <vector>
|
||||
|
||||
#include "arch/decoder.hh"
|
||||
#include "arch/predecoder.hh"
|
||||
#include "arch/tlb.hh"
|
||||
#include "config/the_isa.hh"
|
||||
#include "cpu/inorder/resources/cache_unit.hh"
|
||||
@@ -89,7 +88,7 @@ class FetchUnit : public CacheUnit
|
||||
|
||||
void trap(Fault fault, ThreadID tid, DynInstPtr inst);
|
||||
|
||||
TheISA::Decoder decoder;
|
||||
TheISA::Decoder *decoder[ThePipeline::MaxThreads];
|
||||
|
||||
private:
|
||||
void squashCacheRequest(CacheReqPtr req_ptr);
|
||||
@@ -129,8 +128,6 @@ class FetchUnit : public CacheUnit
|
||||
|
||||
int fetchBuffSize;
|
||||
|
||||
TheISA::Predecoder *predecoder[ThePipeline::MaxThreads];
|
||||
|
||||
/** Valid Cache Blocks*/
|
||||
std::list<FetchBlock*> fetchBuffer;
|
||||
|
||||
|
||||
@@ -83,7 +83,11 @@ class InOrderThreadContext : public ThreadContext
|
||||
*/
|
||||
CheckerCPU *getCheckerCpuPtr() { return NULL; }
|
||||
|
||||
TheISA::Decoder *getDecoderPtr() { return cpu->getDecoderPtr(); }
|
||||
TheISA::Decoder *
|
||||
getDecoderPtr()
|
||||
{
|
||||
return cpu->getDecoderPtr(thread->contextId());
|
||||
}
|
||||
|
||||
System *getSystemPtr() { return cpu->system; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user