rob_impl.hh (2831:0a42b294727c) rob_impl.hh (2877:4b56debc25d1)
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;

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

36
37template <class Impl>
38ROB<Impl>::ROB(unsigned _numEntries, unsigned _squashWidth,
39 string _smtROBPolicy, unsigned _smtROBThreshold,
40 unsigned _numThreads)
41 : numEntries(_numEntries),
42 squashWidth(_squashWidth),
43 numInstsInROB(0),
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;

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

36
37template <class Impl>
38ROB<Impl>::ROB(unsigned _numEntries, unsigned _squashWidth,
39 string _smtROBPolicy, unsigned _smtROBThreshold,
40 unsigned _numThreads)
41 : numEntries(_numEntries),
42 squashWidth(_squashWidth),
43 numInstsInROB(0),
44 squashedSeqNum(0),
45 numThreads(_numThreads)
46{
47 for (int tid=0; tid < numThreads; tid++) {
44 numThreads(_numThreads)
45{
46 for (int tid=0; tid < numThreads; tid++) {
47 squashedSeqNum[tid] = 0;
48 doneSquashing[tid] = true;
49 threadEntries[tid] = 0;
50 }
51
52 string policy = _smtROBPolicy;
53
54 //Convert string to lowercase
55 std::transform(policy.begin(), policy.end(), policy.begin(),

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

347 return maxEntries[tid] - threadEntries[tid];
348}
349
350template <class Impl>
351void
352ROB<Impl>::doSquash(unsigned tid)
353{
354 DPRINTF(ROB, "[tid:%u]: Squashing instructions until [sn:%i].\n",
48 doneSquashing[tid] = true;
49 threadEntries[tid] = 0;
50 }
51
52 string policy = _smtROBPolicy;
53
54 //Convert string to lowercase
55 std::transform(policy.begin(), policy.end(), policy.begin(),

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

347 return maxEntries[tid] - threadEntries[tid];
348}
349
350template <class Impl>
351void
352ROB<Impl>::doSquash(unsigned tid)
353{
354 DPRINTF(ROB, "[tid:%u]: Squashing instructions until [sn:%i].\n",
355 tid, squashedSeqNum);
355 tid, squashedSeqNum[tid]);
356
357 assert(squashIt[tid] != instList[tid].end());
358
356
357 assert(squashIt[tid] != instList[tid].end());
358
359 if ((*squashIt[tid])->seqNum < squashedSeqNum) {
359 if ((*squashIt[tid])->seqNum < squashedSeqNum[tid]) {
360 DPRINTF(ROB, "[tid:%u]: Done squashing instructions.\n",
361 tid);
362
363 squashIt[tid] = instList[tid].end();
364
365 doneSquashing[tid] = true;
366 return;
367 }
368
369 bool robTailUpdate = false;
370
371 for (int numSquashed = 0;
372 numSquashed < squashWidth &&
373 squashIt[tid] != instList[tid].end() &&
360 DPRINTF(ROB, "[tid:%u]: Done squashing instructions.\n",
361 tid);
362
363 squashIt[tid] = instList[tid].end();
364
365 doneSquashing[tid] = true;
366 return;
367 }
368
369 bool robTailUpdate = false;
370
371 for (int numSquashed = 0;
372 numSquashed < squashWidth &&
373 squashIt[tid] != instList[tid].end() &&
374 (*squashIt[tid])->seqNum > squashedSeqNum;
374 (*squashIt[tid])->seqNum > squashedSeqNum[tid];
375 ++numSquashed)
376 {
377 DPRINTF(ROB, "[tid:%u]: Squashing instruction PC %#x, seq num %i.\n",
378 (*squashIt[tid])->threadNumber,
379 (*squashIt[tid])->readPC(),
380 (*squashIt[tid])->seqNum);
381
382 // Mark the instruction as squashed, and ready to commit so that

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

403 if ((*squashIt[tid]) == (*tail_thread))
404 robTailUpdate = true;
405
406 squashIt[tid]--;
407 }
408
409
410 // Check if ROB is done squashing.
375 ++numSquashed)
376 {
377 DPRINTF(ROB, "[tid:%u]: Squashing instruction PC %#x, seq num %i.\n",
378 (*squashIt[tid])->threadNumber,
379 (*squashIt[tid])->readPC(),
380 (*squashIt[tid])->seqNum);
381
382 // Mark the instruction as squashed, and ready to commit so that

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

403 if ((*squashIt[tid]) == (*tail_thread))
404 robTailUpdate = true;
405
406 squashIt[tid]--;
407 }
408
409
410 // Check if ROB is done squashing.
411 if ((*squashIt[tid])->seqNum <= squashedSeqNum) {
411 if ((*squashIt[tid])->seqNum <= squashedSeqNum[tid]) {
412 DPRINTF(ROB, "[tid:%u]: Done squashing instructions.\n",
413 tid);
414
415 squashIt[tid] = instList[tid].end();
416
417 doneSquashing[tid] = true;
418 }
419

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

515 }
516
517 DPRINTF(ROB, "Starting to squash within the ROB.\n");
518
519 robStatus[tid] = ROBSquashing;
520
521 doneSquashing[tid] = false;
522
412 DPRINTF(ROB, "[tid:%u]: Done squashing instructions.\n",
413 tid);
414
415 squashIt[tid] = instList[tid].end();
416
417 doneSquashing[tid] = true;
418 }
419

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

515 }
516
517 DPRINTF(ROB, "Starting to squash within the ROB.\n");
518
519 robStatus[tid] = ROBSquashing;
520
521 doneSquashing[tid] = false;
522
523 squashedSeqNum = squash_num;
523 squashedSeqNum[tid] = squash_num;
524
525 if (!instList[tid].empty()) {
526 InstIt tail_thread = instList[tid].end();
527 tail_thread--;
528
529 squashIt[tid] = tail_thread;
530
531 doSquash(tid);

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

539 if (numInstsInROB != 0) {
540 assert((*head)->isInROB()==true);
541 return *head;
542 } else {
543 return dummyInst;
544 }
545}
546*/
524
525 if (!instList[tid].empty()) {
526 InstIt tail_thread = instList[tid].end();
527 tail_thread--;
528
529 squashIt[tid] = tail_thread;
530
531 doSquash(tid);

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

539 if (numInstsInROB != 0) {
540 assert((*head)->isInROB()==true);
541 return *head;
542 } else {
543 return dummyInst;
544 }
545}
546*/
547
547template <class Impl>
548typename Impl::DynInstPtr
549ROB<Impl>::readHeadInst(unsigned tid)
550{
551 if (threadEntries[tid] != 0) {
552 InstIt head_thread = instList[tid].begin();
553
554 assert((*head_thread)->isInROB()==true);
555
556 return *head_thread;
557 } else {
558 return dummyInst;
559 }
560}
548template <class Impl>
549typename Impl::DynInstPtr
550ROB<Impl>::readHeadInst(unsigned tid)
551{
552 if (threadEntries[tid] != 0) {
553 InstIt head_thread = instList[tid].begin();
554
555 assert((*head_thread)->isInROB()==true);
556
557 return *head_thread;
558 } else {
559 return dummyInst;
560 }
561}
562
561/*
562template <class Impl>
563uint64_t
564ROB<Impl>::readHeadPC()
565{
566 //assert(numInstsInROB == countInsts());
567
568 DynInstPtr head_inst = *head;

--- 126 unchanged lines hidden ---
563/*
564template <class Impl>
565uint64_t
566ROB<Impl>::readHeadPC()
567{
568 //assert(numInstsInROB == countInsts());
569
570 DynInstPtr head_inst = *head;

--- 126 unchanged lines hidden ---