From fca4fea769c09add919099e5ede694145c5c5f77 Mon Sep 17 00:00:00 2001 From: Andreas Sandberg Date: Mon, 7 Jan 2013 13:05:46 -0500 Subject: [PATCH] cpu: Fix O3 LSQ debug dumping constness and formatting --- src/cpu/o3/lsq.hh | 4 ++-- src/cpu/o3/lsq_impl.hh | 6 +++--- src/cpu/o3/lsq_unit.hh | 10 +++++----- src/cpu/o3/lsq_unit_impl.hh | 17 ++++++++++------- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/cpu/o3/lsq.hh b/src/cpu/o3/lsq.hh index 07881da9f..7caee86f6 100644 --- a/src/cpu/o3/lsq.hh +++ b/src/cpu/o3/lsq.hh @@ -263,9 +263,9 @@ class LSQ { { retryTid = tid; } /** Debugging function to print out all instructions. */ - void dumpInsts(); + void dumpInsts() const; /** Debugging function to print out instructions from a specific thread. */ - void dumpInsts(ThreadID tid) + void dumpInsts(ThreadID tid) const { thread[tid].dumpInsts(); } /** Executes a read operation, using the load specified at the load diff --git a/src/cpu/o3/lsq_impl.hh b/src/cpu/o3/lsq_impl.hh index 58a0526c1..7051c9f7c 100644 --- a/src/cpu/o3/lsq_impl.hh +++ b/src/cpu/o3/lsq_impl.hh @@ -577,10 +577,10 @@ LSQ::willWB() template void -LSQ::dumpInsts() +LSQ::dumpInsts() const { - list::iterator threads = activeThreads->begin(); - list::iterator end = activeThreads->end(); + list::const_iterator threads = activeThreads->begin(); + list::const_iterator end = activeThreads->end(); while (threads != end) { ThreadID tid = *threads++; diff --git a/src/cpu/o3/lsq_unit.hh b/src/cpu/o3/lsq_unit.hh index c0fc52caf..2c79931e2 100644 --- a/src/cpu/o3/lsq_unit.hh +++ b/src/cpu/o3/lsq_unit.hh @@ -241,17 +241,17 @@ class LSQUnit { bool sendStore(PacketPtr data_pkt); /** Increments the given store index (circular queue). */ - inline void incrStIdx(int &store_idx); + inline void incrStIdx(int &store_idx) const; /** Decrements the given store index (circular queue). */ - inline void decrStIdx(int &store_idx); + inline void decrStIdx(int &store_idx) const; /** Increments the given load index (circular queue). */ - inline void incrLdIdx(int &load_idx); + inline void incrLdIdx(int &load_idx) const; /** Decrements the given load index (circular queue). */ - inline void decrLdIdx(int &load_idx); + inline void decrLdIdx(int &load_idx) const; public: /** Debugging function to dump instructions in the LSQ. */ - void dumpInsts(); + void dumpInsts() const; private: /** Pointer to the CPU. */ diff --git a/src/cpu/o3/lsq_unit_impl.hh b/src/cpu/o3/lsq_unit_impl.hh index 799759557..d640f94a3 100644 --- a/src/cpu/o3/lsq_unit_impl.hh +++ b/src/cpu/o3/lsq_unit_impl.hh @@ -1228,7 +1228,7 @@ LSQUnit::recvRetry() template inline void -LSQUnit::incrStIdx(int &store_idx) +LSQUnit::incrStIdx(int &store_idx) const { if (++store_idx >= SQEntries) store_idx = 0; @@ -1236,7 +1236,7 @@ LSQUnit::incrStIdx(int &store_idx) template inline void -LSQUnit::decrStIdx(int &store_idx) +LSQUnit::decrStIdx(int &store_idx) const { if (--store_idx < 0) store_idx += SQEntries; @@ -1244,7 +1244,7 @@ LSQUnit::decrStIdx(int &store_idx) template inline void -LSQUnit::incrLdIdx(int &load_idx) +LSQUnit::incrLdIdx(int &load_idx) const { if (++load_idx >= LQEntries) load_idx = 0; @@ -1252,7 +1252,7 @@ LSQUnit::incrLdIdx(int &load_idx) template inline void -LSQUnit::decrLdIdx(int &load_idx) +LSQUnit::decrLdIdx(int &load_idx) const { if (--load_idx < 0) load_idx += LQEntries; @@ -1260,7 +1260,7 @@ LSQUnit::decrLdIdx(int &load_idx) template void -LSQUnit::dumpInsts() +LSQUnit::dumpInsts() const { cprintf("Load store queue: Dumping instructions.\n"); cprintf("Load queue size: %i\n", loads); @@ -1269,10 +1269,12 @@ LSQUnit::dumpInsts() int load_idx = loadHead; while (load_idx != loadTail && loadQueue[load_idx]) { - cprintf("%s ", loadQueue[load_idx]->pcState()); + const DynInstPtr &inst(loadQueue[load_idx]); + cprintf("%s.[sn:%i] ", inst->pcState(), inst->seqNum); incrLdIdx(load_idx); } + cprintf("\n"); cprintf("Store queue size: %i\n", stores); cprintf("Store queue: "); @@ -1280,7 +1282,8 @@ LSQUnit::dumpInsts() int store_idx = storeHead; while (store_idx != storeTail && storeQueue[store_idx].inst) { - cprintf("%s ", storeQueue[store_idx].inst->pcState()); + const DynInstPtr &inst(storeQueue[store_idx].inst); + cprintf("%s.[sn:%i] ", inst->pcState(), inst->seqNum); incrStIdx(store_idx); }