cpu: Extract stage classes from O3's SimpleCPUPolicy.

Use the target types directly without that layer of indirection. This
also narrows the scope of some includes.

Change-Id: I152f2ce0684781a9b61bd9d5a38620c39a4c60e8
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/42098
Reviewed-by: Matthew Poremba <matthew.poremba@amd.com>
Maintainer: Gabe Black <gabe.black@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Gabe Black
2021-03-01 18:11:27 -08:00
parent 34c5d537af
commit 86059e7a0b
11 changed files with 41 additions and 48 deletions

View File

@@ -46,6 +46,7 @@
#include "base/statistics.hh"
#include "cpu/exetrace.hh"
#include "cpu/inst_seq.hh"
#include "cpu/o3/iew.hh"
#include "cpu/o3/limits.hh"
#include "cpu/timebuf.hh"
#include "enums/CommitPolicy.hh"
@@ -95,9 +96,6 @@ class DefaultCommit
typedef typename CPUPol::IEWStruct IEWStruct;
typedef typename CPUPol::RenameStruct RenameStruct;
typedef typename CPUPol::Fetch Fetch;
typedef typename CPUPol::IEW IEW;
typedef O3ThreadState<Impl> Thread;
/** Overall commit status. Used to determine if the CPU can deschedule
@@ -164,13 +162,13 @@ class DefaultCommit
void setIEWQueue(TimeBuffer<IEWStruct> *iq_ptr);
/** Sets the pointer to the IEW stage. */
void setIEWStage(IEW *iew_stage);
void setIEWStage(DefaultIEW<Impl> *iew_stage);
/** The pointer to the IEW stage. Used solely to ensure that
* various events (traps, interrupts, syscalls) do not occur until
* all stores have written back.
*/
IEW *iewStage;
DefaultIEW<Impl> *iewStage;
/** Sets pointer to list of active threads. */
void setActiveThreads(std::list<ThreadID> *at_ptr);

View File

@@ -291,7 +291,7 @@ DefaultCommit<Impl>::setIEWQueue(TimeBuffer<IEWStruct> *iq_ptr)
template <class Impl>
void
DefaultCommit<Impl>::setIEWStage(IEW *iew_stage)
DefaultCommit<Impl>::setIEWStage(DefaultIEW<Impl> *iew_stage)
{
iewStage = iew_stage;
}

View File

@@ -54,8 +54,13 @@
#include "base/statistics.hh"
#include "config/the_isa.hh"
#include "cpu/o3/comm.hh"
#include "cpu/o3/commit.hh"
#include "cpu/o3/cpu_policy.hh"
#include "cpu/o3/decode.hh"
#include "cpu/o3/fetch.hh"
#include "cpu/o3/iew.hh"
#include "cpu/o3/limits.hh"
#include "cpu/o3/rename.hh"
#include "cpu/o3/scoreboard.hh"
#include "cpu/o3/thread_state.hh"
#include "cpu/activity.hh"
@@ -487,19 +492,19 @@ class FullO3CPU : public BaseO3CPU
protected:
/** The fetch stage. */
typename CPUPolicy::Fetch fetch;
DefaultFetch<Impl> fetch;
/** The decode stage. */
typename CPUPolicy::Decode decode;
DefaultDecode<Impl> decode;
/** The dispatch stage. */
typename CPUPolicy::Rename rename;
DefaultRename<Impl> rename;
/** The issue/execute/writeback stages. */
typename CPUPolicy::IEW iew;
DefaultIEW<Impl> iew;
/** The commit stage. */
typename CPUPolicy::Commit commit;
DefaultCommit<Impl> commit;
/** The rename mode of the vector registers */
Enums::VecRegRenameMode vecMode;

View File

@@ -31,17 +31,12 @@
#define __CPU_O3_CPU_POLICY_HH__
#include "cpu/o3/comm.hh"
#include "cpu/o3/commit.hh"
#include "cpu/o3/decode.hh"
#include "cpu/o3/fetch.hh"
#include "cpu/o3/free_list.hh"
#include "cpu/o3/iew.hh"
#include "cpu/o3/inst_queue.hh"
#include "cpu/o3/lsq.hh"
#include "cpu/o3/lsq_unit.hh"
#include "cpu/o3/mem_dep_unit.hh"
#include "cpu/o3/regfile.hh"
#include "cpu/o3/rename.hh"
#include "cpu/o3/rename_map.hh"
#include "cpu/o3/rob.hh"
#include "cpu/o3/store_set.hh"
@@ -73,17 +68,6 @@ struct SimpleCPUPolicy
/** Typedef for the thread-specific LSQ units. */
typedef ::LSQUnit<Impl> LSQUnit;
/** Typedef for fetch. */
typedef DefaultFetch<Impl> Fetch;
/** Typedef for decode. */
typedef DefaultDecode<Impl> Decode;
/** Typedef for rename. */
typedef DefaultRename<Impl> Rename;
/** Typedef for Issue/Execute/Writeback. */
typedef DefaultIEW<Impl> IEW;
/** Typedef for commit. */
typedef DefaultCommit<Impl> Commit;
/** The struct for communication between fetch and decode. */
typedef DefaultFetchDefaultDecode<Impl> FetchStruct;

View File

@@ -51,6 +51,7 @@
#include "base/types.hh"
#include "cpu/inst_seq.hh"
#include "cpu/o3/dep_graph.hh"
#include "cpu/o3/iew.hh"
#include "cpu/o3/limits.hh"
#include "cpu/op_class.hh"
#include "cpu/timebuf.hh"
@@ -86,7 +87,6 @@ class InstructionQueue
typedef typename Impl::O3CPU O3CPU;
typedef typename Impl::DynInstPtr DynInstPtr;
typedef typename Impl::CPUPol::IEW IEW;
typedef typename Impl::CPUPol::MemDepUnit MemDepUnit;
typedef typename Impl::CPUPol::IssueStruct IssueStruct;
typedef typename Impl::CPUPol::TimeStruct TimeStruct;
@@ -123,7 +123,7 @@ class InstructionQueue
};
/** Constructs an IQ. */
InstructionQueue(O3CPU *cpu_ptr, IEW *iew_ptr,
InstructionQueue(O3CPU *cpu_ptr, DefaultIEW<Impl> *iew_ptr,
const DerivO3CPUParams &params);
/** Destructs the IQ. */
@@ -282,7 +282,7 @@ class InstructionQueue
MemInterface *dcacheInterface;
/** Pointer to IEW stage. */
IEW *iewStage;
DefaultIEW<Impl> *iewStage;
/** The memory dependence unit, which tracks/predicts memory dependences
* between instructions.

View File

@@ -83,8 +83,8 @@ InstructionQueue<Impl>::FUCompletion::description() const
}
template <class Impl>
InstructionQueue<Impl>::InstructionQueue(O3CPU *cpu_ptr, IEW *iew_ptr,
const DerivO3CPUParams &params)
InstructionQueue<Impl>::InstructionQueue(O3CPU *cpu_ptr,
DefaultIEW<Impl> *iew_ptr, const DerivO3CPUParams &params)
: cpu(cpu_ptr),
iewStage(iew_ptr),
fuPool(params.fuPool),

View File

@@ -64,6 +64,9 @@ struct DerivO3CPUParams;
template <class Impl>
class FullO3CPU;
template <class Impl>
class DefaultIEW;
template <class Impl>
class LSQ
@@ -71,7 +74,6 @@ class LSQ
public:
typedef typename Impl::O3CPU O3CPU;
typedef typename Impl::DynInstPtr DynInstPtr;
typedef typename Impl::CPUPol::IEW IEW;
typedef typename Impl::CPUPol::LSQUnit LSQUnit;
class LSQRequest;
@@ -853,7 +855,8 @@ class LSQ
};
/** Constructs an LSQ with the given parameters. */
LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, const DerivO3CPUParams &params);
LSQ(O3CPU *cpu_ptr, DefaultIEW<Impl> *iew_ptr,
const DerivO3CPUParams &params);
~LSQ() { }
/** Returns the name of the LSQ. */
@@ -1112,7 +1115,7 @@ class LSQ
O3CPU *cpu;
/** The IEW stage pointer. */
IEW *iewStage;
DefaultIEW<Impl> *iewStage;
/** Is D-cache blocked? */
bool cacheBlocked() const;

View File

@@ -48,6 +48,7 @@
#include "base/logging.hh"
#include "cpu/o3/cpu.hh"
#include "cpu/o3/iew.hh"
#include "cpu/o3/limits.hh"
#include "cpu/o3/lsq.hh"
#include "debug/Drain.hh"
@@ -58,7 +59,8 @@
#include "params/DerivO3CPU.hh"
template <class Impl>
LSQ<Impl>::LSQ(O3CPU *cpu_ptr, IEW *iew_ptr, const DerivO3CPUParams &params)
LSQ<Impl>::LSQ(O3CPU *cpu_ptr, DefaultIEW<Impl> *iew_ptr,
const DerivO3CPUParams &params)
: cpu(cpu_ptr), iewStage(iew_ptr),
_cacheBlocked(false),
cacheStorePorts(params.cacheStorePorts), usedStorePorts(0),

View File

@@ -62,6 +62,9 @@
struct DerivO3CPUParams;
#include "base/circular_queue.hh"
template <class Impl>
class DefaultIEW;
/**
* Class that implements the actual LQ and SQ for each specific
* thread. Both are circular queues; load entries are freed upon
@@ -82,7 +85,6 @@ class LSQUnit
typedef typename Impl::O3CPU O3CPU;
typedef typename Impl::DynInstPtr DynInstPtr;
typedef typename Impl::CPUPol::IEW IEW;
typedef typename Impl::CPUPol::LSQ LSQ;
typedef typename Impl::CPUPol::IssueStruct IssueStruct;
@@ -232,8 +234,8 @@ class LSQUnit
}
/** Initializes the LSQ unit with the specified number of entries. */
void init(O3CPU *cpu_ptr, IEW *iew_ptr, const DerivO3CPUParams &params,
LSQ *lsq_ptr, unsigned id);
void init(O3CPU *cpu_ptr, DefaultIEW<Impl> *iew_ptr,
const DerivO3CPUParams &params, LSQ *lsq_ptr, unsigned id);
/** Returns the name of the LSQ unit. */
std::string name() const;
@@ -408,7 +410,7 @@ class LSQUnit
O3CPU *cpu;
/** Pointer to the IEW stage. */
IEW *iewStage;
DefaultIEW<Impl> *iewStage;
/** Pointer to the LSQ. */
LSQ *lsq;

View File

@@ -215,7 +215,7 @@ LSQUnit<Impl>::LSQUnit(uint32_t lqEntries, uint32_t sqEntries)
template<class Impl>
void
LSQUnit<Impl>::init(O3CPU *cpu_ptr, IEW *iew_ptr,
LSQUnit<Impl>::init(O3CPU *cpu_ptr, DefaultIEW<Impl> *iew_ptr,
const DerivO3CPUParams &params, LSQ *lsq_ptr, unsigned id)
{
lsqID = id;

View File

@@ -47,6 +47,8 @@
#include "base/statistics.hh"
#include "config/the_isa.hh"
#include "cpu/o3/commit.hh"
#include "cpu/o3/iew.hh"
#include "cpu/o3/limits.hh"
#include "cpu/timebuf.hh"
#include "sim/probe/probe.hh"
@@ -80,9 +82,6 @@ class DefaultRename
typedef typename CPUPol::TimeStruct TimeStruct;
typedef typename CPUPol::FreeList FreeList;
typedef typename CPUPol::RenameMap RenameMap;
// These are used only for initialization.
typedef typename CPUPol::IEW IEW;
typedef typename CPUPol::Commit Commit;
// A deque is used to queue the instructions. Barrier insts must
// be added to the front of the queue, which is the only reason for
@@ -149,19 +148,19 @@ class DefaultRename
void setDecodeQueue(TimeBuffer<DecodeStruct> *dq_ptr);
/** Sets pointer to IEW stage. Used only for initialization. */
void setIEWStage(IEW *iew_stage)
void setIEWStage(DefaultIEW<Impl> *iew_stage)
{ iew_ptr = iew_stage; }
/** Sets pointer to commit stage. Used only for initialization. */
void setCommitStage(Commit *commit_stage)
void setCommitStage(DefaultCommit<Impl> *commit_stage)
{ commit_ptr = commit_stage; }
private:
/** Pointer to IEW stage. Used only for initialization. */
IEW *iew_ptr;
DefaultIEW<Impl> *iew_ptr;
/** Pointer to commit stage. Used only for initialization. */
Commit *commit_ptr;
DefaultCommit<Impl> *commit_ptr;
public:
/** Initializes variables for the stage. */