summaryrefslogtreecommitdiff
path: root/src/sim
diff options
context:
space:
mode:
Diffstat (limited to 'src/sim')
-rw-r--r--src/sim/ex.cc3
-rw-r--r--src/sim/id.cc12
-rw-r--r--src/sim/instrDTO.cc1
-rw-r--r--src/sim/mm.cc2
-rw-r--r--src/sim/stage.cc3
-rw-r--r--src/sim/wb.cc1
6 files changed, 5 insertions, 17 deletions
diff --git a/src/sim/ex.cc b/src/sim/ex.cc
index 98a2d19..b6f8a1d 100644
--- a/src/sim/ex.cc
+++ b/src/sim/ex.cc
@@ -163,7 +163,6 @@ EX::EX(Stage *stage) : Stage(stage)
INIT_INSTRUCTION(
CMP,
{
- cout << "CMP: " << s1 << ":" << s2 << std::endl;
(s1 > s2) ? this->set_condition(GT, true)
: this->set_condition(GT, false);
(s1 == s2) ? this->set_condition(EQ, true)
@@ -205,8 +204,6 @@ EX::EX(Stage *stage) : Stage(stage)
INIT_INSTRUCTION(
ADDI,
{
- std::cout << this->id << ": " << s1 << "," << s2 << "," << s3
- << std::endl;
s1 = s1 + s3;
(void)pc;
(void)s2;
diff --git a/src/sim/id.cc b/src/sim/id.cc
index 805a4df..0df26f4 100644
--- a/src/sim/id.cc
+++ b/src/sim/id.cc
@@ -51,9 +51,6 @@ void ID::advance_helper()
if (curr_instr->get_mnemonic() == NOP)
this->status = OK;
else {
- std::cout << this->id << ": " << this->curr_instr->get_s1() << ","
- << this->curr_instr->get_s2() << ","
- << this->curr_instr->get_s3() << std::endl;
s1 = curr_instr->get_instr_bits();
get_instr_fields(s1, s2, s3, m, t);
if (this->status == OK) {
@@ -63,9 +60,6 @@ void ID::advance_helper()
curr_instr->set_mnemonic(m);
curr_instr->set_type(t);
}
- std::cout << this->id << ": " << this->curr_instr->get_s1() << ","
- << this->curr_instr->get_s2() << ","
- << this->curr_instr->get_s3() << std::endl;
}
}
@@ -86,7 +80,7 @@ void ID::get_instr_fields(
break;
case 0b10:
t = J;
- this->decode_J_type(s1, s2);
+ this->decode_J_type(s1, s2, s3);
break;
case 0b11:
t = INV;
@@ -126,7 +120,6 @@ void ID::decode_I_type(
s2 = GET_MID_BITS(s1, s0b, s1b);
s1 = GET_LS_BITS(s1, s0b);
- std::cout << m << ":" << s2 << std::endl;
r1 = this->read_guard(s1);
if (m != STORE && m != STOREV) {
this->status = r1;
@@ -135,12 +128,13 @@ void ID::decode_I_type(
this->status = (this->read_guard(s2) == OK && r1 == OK) ? OK : STALLED;
}
-void ID::decode_J_type(signed int &s1, signed int &s2)
+void ID::decode_J_type(signed int &s1, signed int &s2, signed int &s3)
{
unsigned int s0b, s1b;
s0b = REG_SIZE;
s1b = WORD_SPEC;
+ s3 = 0;
s2 = GET_MID_BITS(s1, s0b, s1b);
s1 = GET_LS_BITS(s1, s0b);
diff --git a/src/sim/instrDTO.cc b/src/sim/instrDTO.cc
index d36e957..aa49b7e 100644
--- a/src/sim/instrDTO.cc
+++ b/src/sim/instrDTO.cc
@@ -9,6 +9,7 @@ InstrDTO::InstrDTO()
this->s3 = 0;
this->mnemonic = ADD;
this->type = INV;
+ this->pc = 0;
}
int InstrDTO::get_time_of(Accessor a) { return this->hist[a]; }
diff --git a/src/sim/mm.cc b/src/sim/mm.cc
index c83ae7d..07a362b 100644
--- a/src/sim/mm.cc
+++ b/src/sim/mm.cc
@@ -15,7 +15,7 @@ void MM::advance_helper()
this->status = this->storage->read_word(
this->id, this->curr_instr->get_s1(), data);
if (this->status == OK) {
- this->curr_instr->set_s2(data);
+ this->curr_instr->set_s1(data);
} else
this->status = STALLED;
break;
diff --git a/src/sim/stage.cc b/src/sim/stage.cc
index bd0ff6b..24bdf75 100644
--- a/src/sim/stage.cc
+++ b/src/sim/stage.cc
@@ -22,8 +22,6 @@ int Stage::clock_cycle;
bool Stage::get_condition(CC c) { return (this->gprs[3] >> c) & 1; }
-void Stage::set_pc(unsigned int pc) { this->pc = pc; }
-
InstrDTO *Stage::advance(Response p)
{
InstrDTO *r = nullptr;
@@ -96,7 +94,6 @@ bool Stage::is_checked_out(signed int r)
void Stage::squash()
{
if (curr_instr) {
- std::cout << "!!!" << std::endl;
this->curr_instr->set_mnemonic(NOP);
this->status = OK;
}
diff --git a/src/sim/wb.cc b/src/sim/wb.cc
index 50acd05..01768e8 100644
--- a/src/sim/wb.cc
+++ b/src/sim/wb.cc
@@ -28,7 +28,6 @@ void WB::write_handler()
reg = this->checked_out.front();
this->checked_out.pop_front();
- std::cout << "storing " << reg << " with " << this->curr_instr->get_s1() << std::endl;
this->store_register(reg, this->curr_instr->get_s1());
}