changeset 7e54a9a9f6b2 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=7e54a9a9f6b2
description:
cpu: Add drain check functionality to IEW
IEW did not check the instQueue and memDepUnit to ensure
they were drained. This caused issues when drainSanityCheck()
did check those structures after asserting IEW was drained.
diffstat:
src/cpu/o3/iew_impl.hh | 2 +-
src/cpu/o3/inst_queue.hh | 3 +++
src/cpu/o3/inst_queue_impl.hh | 11 +++++++++++
src/cpu/o3/mem_dep_unit.hh | 3 +++
src/cpu/o3/mem_dep_unit_impl.hh | 13 +++++++++++++
5 files changed, 31 insertions(+), 1 deletions(-)
diffs (82 lines):
diff -r d5554f97c451 -r 7e54a9a9f6b2 src/cpu/o3/iew_impl.hh
--- a/src/cpu/o3/iew_impl.hh Wed Oct 29 23:18:26 2014 -0500
+++ b/src/cpu/o3/iew_impl.hh Wed Oct 29 23:18:26 2014 -0500
@@ -381,7 +381,7 @@
bool
DefaultIEW<Impl>::isDrained() const
{
- bool drained(ldstQueue.isDrained());
+ bool drained = ldstQueue.isDrained() && instQueue.isDrained();
for (ThreadID tid = 0; tid < numThreads; tid++) {
if (!insts[tid].empty()) {
diff -r d5554f97c451 -r 7e54a9a9f6b2 src/cpu/o3/inst_queue.hh
--- a/src/cpu/o3/inst_queue.hh Wed Oct 29 23:18:26 2014 -0500
+++ b/src/cpu/o3/inst_queue.hh Wed Oct 29 23:18:26 2014 -0500
@@ -145,6 +145,9 @@
/** Sets the global time buffer. */
void setTimeBuffer(TimeBuffer<TimeStruct> *tb_ptr);
+ /** Determine if we are drained. */
+ bool isDrained() const;
+
/** Perform sanity checks after a drain. */
void drainSanityCheck() const;
diff -r d5554f97c451 -r 7e54a9a9f6b2 src/cpu/o3/inst_queue_impl.hh
--- a/src/cpu/o3/inst_queue_impl.hh Wed Oct 29 23:18:26 2014 -0500
+++ b/src/cpu/o3/inst_queue_impl.hh Wed Oct 29 23:18:26 2014 -0500
@@ -441,6 +441,17 @@
}
template <class Impl>
+bool
+InstructionQueue<Impl>::isDrained() const
+{
+ bool drained = dependGraph.empty() && instsToExecute.empty();
+ for (ThreadID tid = 0; tid < numThreads; ++tid)
+ drained = drained && memDepUnit[tid].isDrained();
+
+ return drained;
+}
+
+template <class Impl>
void
InstructionQueue<Impl>::drainSanityCheck() const
{
diff -r d5554f97c451 -r 7e54a9a9f6b2 src/cpu/o3/mem_dep_unit.hh
--- a/src/cpu/o3/mem_dep_unit.hh Wed Oct 29 23:18:26 2014 -0500
+++ b/src/cpu/o3/mem_dep_unit.hh Wed Oct 29 23:18:26 2014 -0500
@@ -104,6 +104,9 @@
/** Registers statistics. */
void regStats();
+ /** Determine if we are drained. */
+ bool isDrained() const;
+
/** Perform sanity checks after a drain. */
void drainSanityCheck() const;
diff -r d5554f97c451 -r 7e54a9a9f6b2 src/cpu/o3/mem_dep_unit_impl.hh
--- a/src/cpu/o3/mem_dep_unit_impl.hh Wed Oct 29 23:18:26 2014 -0500
+++ b/src/cpu/o3/mem_dep_unit_impl.hh Wed Oct 29 23:18:26 2014 -0500
@@ -128,6 +128,19 @@
}
template <class MemDepPred, class Impl>
+bool
+MemDepUnit<MemDepPred, Impl>::isDrained() const
+{
+ bool drained = instsToReplay.empty()
+ && memDepHash.empty()
+ && instsToReplay.empty();
+ for (int i = 0; i < Impl::MaxThreads; ++i)
+ drained = drained && instList[i].empty();
+
+ return drained;
+}
+
+template <class MemDepPred, class Impl>
void
MemDepUnit<MemDepPred, Impl>::drainSanityCheck() const
{
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev