summaryrefslogtreecommitdiff
path: root/src/cpu/inorder/resources/fetch_unit.hh
diff options
context:
space:
mode:
authorKorey Sewell <ksewell@umich.edu>2011-02-04 00:08:22 -0500
committerKorey Sewell <ksewell@umich.edu>2011-02-04 00:08:22 -0500
commit68d962f8aff7d2fcc2f8ee77878dd5cab73b69f2 (patch)
treec4bb7d88b864e5ee353b743553bbea0efd34cbb8 /src/cpu/inorder/resources/fetch_unit.hh
parent56ce8acd412747b728b7ad02537a3afd202ae8e8 (diff)
downloadgem5-68d962f8aff7d2fcc2f8ee77878dd5cab73b69f2.tar.xz
inorder: add a fetch buffer to fetch unit
Give fetch unit it's own parameterizable fetch buffer to read from. Very inefficient (architecturally and in simulation) to continually fetch at the granularity of the wordsize. As expected, the number of fetch memory requests drops dramatically
Diffstat (limited to 'src/cpu/inorder/resources/fetch_unit.hh')
-rw-r--r--src/cpu/inorder/resources/fetch_unit.hh51
1 files changed, 38 insertions, 13 deletions
diff --git a/src/cpu/inorder/resources/fetch_unit.hh b/src/cpu/inorder/resources/fetch_unit.hh
index 257a8c50a..035f3f4a1 100644
--- a/src/cpu/inorder/resources/fetch_unit.hh
+++ b/src/cpu/inorder/resources/fetch_unit.hh
@@ -52,19 +52,31 @@
class FetchUnit : public CacheUnit
{
public:
- typedef ThePipeline::DynInstPtr DynInstPtr;
-
- public:
FetchUnit(std::string res_name, int res_id, int res_width,
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params);
- /** Actions that this resources can take on an instruction */
+ typedef ThePipeline::DynInstPtr DynInstPtr;
+ typedef TheISA::ExtMachInst ExtMachInst;
+
+ struct FetchBlock {
+ int asid;
+ Addr addr;
+ uint8_t *block;
+ short cnt;
+ bool valid;
+
+ FetchBlock(int _asid, Addr _addr)
+ : asid(_asid), addr(_addr), block(NULL), cnt(1), valid(false)
+ { }
+ };
+
+ /** Actions that this resource can take on an instruction */
enum Command {
InitiateFetch,
CompleteFetch
};
- public:
+
ResourceRequest* getRequest(DynInstPtr _inst, int stage_num,
int res_idx, int slot_num,
unsigned cmd);
@@ -74,8 +86,11 @@ class FetchUnit : public CacheUnit
/** Executes one of the commands from the "Command" enum */
void execute(int slot_num);
- void squash(DynInstPtr inst, int stage_num,
- InstSeqNum squash_seq_num, ThreadID tid);
+ private:
+ void squashCacheRequest(CacheReqPtr req_ptr);
+
+ void createMachInst(std::list<FetchBlock*>::iterator fetch_it,
+ DynInstPtr inst);
/** After memory request is completed, then turn the fetched data
into an instruction.
@@ -94,14 +109,24 @@ class FetchUnit : public CacheUnit
void removeAddrDependency(DynInstPtr inst);
- public:
- /** The mem line being fetched. */
- uint8_t *fetchData[ThePipeline::MaxThreads];
+ std::list<FetchBlock*>::iterator findReplacementBlock();
+ std::list<FetchBlock*>::iterator findBlock(std::list<FetchBlock*>
+ &fetch_blocks, int asid,
+ Addr block_addr);
+
+ void markBlockUsed(std::list<FetchBlock*>::iterator block_it);
+
+ int instSize;
+
+ int fetchBuffSize;
+
+ TheISA::Predecoder predecoder;
+ /** Valid Cache Blocks*/
+ std::list<FetchBlock*> fetchBuffer;
- /** The Addr of the cacheline that has been loaded. */
- //Addr cacheBlockAddr[ThePipeline::MaxThreads];
- //unsigned fetchOffset[ThePipeline::MaxThreads];
+ /** Cache lines that are pending */
+ std::list<FetchBlock*> pendingFetch;
};
#endif //__CPU_FETCH_UNIT_HH__