From 48273a38e5ec6d53f6dc5d022a69a6892a899f15 Mon Sep 17 00:00:00 2001 From: Ziang Date: Mon, 11 Nov 2019 12:58:28 -0500 Subject: [PATCH] Fixed bug in RAT recovery --- InputTest.txt | 1 - ROB.h | 1 + branch.cpp | 6 ++---- issue.cpp | 1 + output.cpp | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/InputTest.txt b/InputTest.txt index 35ec594..2b126b3 100644 --- a/InputTest.txt +++ b/InputTest.txt @@ -8,7 +8,6 @@ CDB buffer entries = 1 R1=12, R2=32, F20=3.0 Mem[4]=3.0, Mem[8]=2.0, Mem[12]=1.0, Mem[24]=6.0, Mem[28]=5.0, Mem[32]=4.0 - ld F2, 0(R1) mult.d F4, F2, F20 ld F6, 0(R2) diff --git a/ROB.h b/ROB.h index de023f6..18ea0e6 100644 --- a/ROB.h +++ b/ROB.h @@ -30,6 +30,7 @@ class ROBEntry opCode code; // Opcode of the operation. timeLine output; // Output display int instr_i; // The Correspond instruction index + unordered_map bkupRAT; }; class ROB diff --git a/branch.cpp b/branch.cpp index 1655829..a3a118a 100644 --- a/branch.cpp +++ b/branch.cpp @@ -58,9 +58,8 @@ void branchCtrl::branch_automat() { int R_f = CPU_ROB->get_front(); int R_r = CPU_ROB->get_rear(); - for (auto m = RAT.begin(); m != RAT.end(); m++) - if (is_prev_index(i, m->second, R_f, R_r)) - RAT.erase(m); + ROBEntry *R = CPU_ROB->get_entry(i); + RAT = R->bkupRAT; main_mem.squash(i); at_falling_edge(next_vdd); fCDB.squash(i); @@ -72,7 +71,6 @@ void branchCtrl::branch_automat() fu->squash(i); for (auto fu : lsUnit) fu->squash(i); - ROBEntry *R = CPU_ROB->get_entry(i); R->finished = true; at_rising_edge(next_vdd); CPU_ROB->squash(i); diff --git a/issue.cpp b/issue.cpp index 2962070..f80480d 100644 --- a/issue.cpp +++ b/issue.cpp @@ -213,6 +213,7 @@ void *issue_automat(void *arg) } ROBEntry *R = CPU_ROB->get_entry(dest); R->instr_i = instr_Q->get_head(); + R->bkupRAT = RAT; avai->set_code(tmp->code); avai->fill_rs(dest, tmp, Qj, Qk, Vj, Vk); if (BTBEntry* predctr = CPU_BTB.getEntry(R->instr_i)) diff --git a/output.cpp b/output.cpp index 9635bf4..c935ec4 100644 --- a/output.cpp +++ b/output.cpp @@ -41,7 +41,7 @@ void* output_automat(void *args) cout<