1/*
2 * Copyright (c) 2004-2006 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 20 unchanged lines hidden (view full) ---

29 * Korey Sewell
30 */
31
32#include <list>
33
34#include "config/full_system.hh"
35#include "cpu/o3/rename.hh"
36
37using namespace std;
38
37template <class Impl>
38DefaultRename<Impl>::DefaultRename(Params *params)
39 : iewToRenameDelay(params->iewToRenameDelay),
40 decodeToRenameDelay(params->decodeToRenameDelay),
41 commitToRenameDelay(params->commitToRenameDelay),
42 renameWidth(params->renameWidth),
43 commitWidth(params->commitWidth),
44 numThreads(params->numberOfThreads)

--- 171 unchanged lines hidden (view full) ---

216 freeEntries[tid].lsqEntries = iew_ptr->ldstQueue.numFreeEntries(tid);
217 freeEntries[tid].robEntries = commit_ptr->numROBFreeEntries(tid);
218 emptyROB[tid] = true;
219 }
220}
221
222template<class Impl>
223void
226DefaultRename::setActiveThreads(list *at_ptr)
224DefaultRename<Impl>::setActiveThreads(std::list<unsigned> *at_ptr)
225{
226 DPRINTF(Rename, "Setting active threads list pointer.\n");
227 activeThreads = at_ptr;
228}
229
230
231template <class Impl>
232void

--- 32 unchanged lines hidden (view full) ---

265}
266
267template <class Impl>
268void
269DefaultRename<Impl>::switchOut()
270{
271 // Clear any state, fix up the rename map.
272 for (int i = 0; i < numThreads; i++) {
275 typename list<RenameHistory>::iterator hb_it = historyBuffer[i].begin();
273 typename std::list<RenameHistory>::iterator hb_it =
274 historyBuffer[i].begin();
275
276 while (!historyBuffer[i].empty()) {
277 assert(hb_it != historyBuffer[i].end());
278
279 DPRINTF(Rename, "[tid:%u]: Removing history entry with sequence "
280 "number %i.\n", i, (*hb_it).instSeqNum);
281
282 // Tell the rename map to set the architected register to the

--- 118 unchanged lines hidden (view full) ---

401 blockThisCycle = false;
402
403 bool status_change = false;
404
405 toIEWIndex = 0;
406
407 sortInsts();
408
410 list::iterator threads = (*activeThreads).begin();
409 std::list<unsigned>::iterator threads = (*activeThreads).begin();
410
411 // Check stall and squash signals.
412 while (threads != (*activeThreads).end()) {
413 unsigned tid = *threads++;
414
415 DPRINTF(Rename, "Processing [tid:%i]\n", tid);
416
417 status_change = checkSignalsAndUpdate(tid) || status_change;

--- 335 unchanged lines hidden (view full) ---

753 insts[inst->threadNumber].push_back(inst);
754 }
755}
756
757template<class Impl>
758bool
759DefaultRename<Impl>::skidsEmpty()
760{
762 list::iterator threads = (*activeThreads).begin();
761 std::list<unsigned>::iterator threads = (*activeThreads).begin();
762
763 while (threads != (*activeThreads).end()) {
764 if (!skidBuffer[*threads++].empty())
765 return false;
766 }
767
768 return true;
769}
770
771template<class Impl>
772void
773DefaultRename<Impl>::updateStatus()
774{
775 bool any_unblocking = false;
776
778 list::iterator threads = (*activeThreads).begin();
777 std::list<unsigned>::iterator threads = (*activeThreads).begin();
778
779 threads = (*activeThreads).begin();
780
781 while (threads != (*activeThreads).end()) {
782 unsigned tid = *threads++;
783
784 if (renameStatus[tid] == Unblocking) {
785 any_unblocking = true;

--- 73 unchanged lines hidden (view full) ---

859
860 return false;
861}
862
863template <class Impl>
864void
865DefaultRename<Impl>::doSquash(const InstSeqNum &squashed_seq_num, unsigned tid)
866{
868 typename list<RenameHistory>::iterator hb_it = historyBuffer[tid].begin();
867 typename std::list<RenameHistory>::iterator hb_it =
868 historyBuffer[tid].begin();
869
870 // After a syscall squashes everything, the history buffer may be empty
871 // but the ROB may still be squashing instructions.
872 if (historyBuffer[tid].empty()) {
873 return;
874 }
875
876 // Go through the most recent instructions, undoing the mappings

--- 21 unchanged lines hidden (view full) ---

898template<class Impl>
899void
900DefaultRename<Impl>::removeFromHistory(InstSeqNum inst_seq_num, unsigned tid)
901{
902 DPRINTF(Rename, "[tid:%u]: Removing a committed instruction from the "
903 "history buffer %u (size=%i), until [sn:%lli].\n",
904 tid, tid, historyBuffer[tid].size(), inst_seq_num);
905
906 typename list<RenameHistory>::iterator hb_it = historyBuffer[tid].end();
906 typename std::list<RenameHistory>::iterator hb_it =
907 historyBuffer[tid].end();
908
909 --hb_it;
910
911 if (historyBuffer[tid].empty()) {
912 DPRINTF(Rename, "[tid:%u]: History buffer is empty.\n", tid);
913 return;
914 } else if (hb_it->instSeqNum > inst_seq_num) {
915 DPRINTF(Rename, "[tid:%u]: Old sequence number encountered. Ensure "

--- 382 unchanged lines hidden (view full) ---

1298 break;
1299 }
1300}
1301
1302template <class Impl>
1303void
1304DefaultRename<Impl>::dumpHistory()
1305{
1305 typename list::iterator buf_it;
1306 typename std::list<RenameHistory>::iterator buf_it;
1307
1308 for (int i = 0; i < numThreads; i++) {
1309
1310 buf_it = historyBuffer[i].begin();
1311
1312 while (buf_it != historyBuffer[i].end()) {
1313 cprintf("Seq num: %i\nArch reg: %i New phys reg: %i Old phys "
1314 "reg: %i\n", (*buf_it).instSeqNum, (int)(*buf_it).archReg,
1315 (int)(*buf_it).newPhysReg, (int)(*buf_it).prevPhysReg);
1316
1317 buf_it++;
1318 }
1319 }
1320}