summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/sim/dum.cc1
-rw-r--r--src/sim/ex.cc17
-rw-r--r--src/sim/stage.cc26
3 files changed, 17 insertions, 27 deletions
diff --git a/src/sim/dum.cc b/src/sim/dum.cc
index 76d4acd..f712fce 100644
--- a/src/sim/dum.cc
+++ b/src/sim/dum.cc
@@ -3,7 +3,6 @@
#include "instrDTO.h"
#include "response.h"
#include "stage.h"
-#include "utils.h"
DUM::DUM(Stage *stage) : Stage(stage) { this->id = IDLE; }
diff --git a/src/sim/ex.cc b/src/sim/ex.cc
index 50f00a8..d20d15f 100644
--- a/src/sim/ex.cc
+++ b/src/sim/ex.cc
@@ -1,10 +1,9 @@
#include "ex.h"
#include "accessor.h"
-#include "pipe_spec.h"
#include "instrDTO.h"
+#include "pipe_spec.h"
#include "response.h"
#include "stage.h"
-#include "utils.h"
#include <unordered_map>
// clang-format off
@@ -313,32 +312,28 @@ EX::EX(Stage *stage) : Stage(stage)
INIT_INSTRUCTION(
BEQ,
{
- (this->get_condition(EQ)) ? s1 = wrap_address(pc + s2)
- : s1 = -1;
+ (this->get_condition(EQ)) ? s1 = pc + s2 : s1 = -1;
(void)s3;
}),
INIT_INSTRUCTION(
BGT,
{
- (this->get_condition(GT)) ? s1 = wrap_address(pc + s2)
- : s1 = -1;
+ (this->get_condition(GT)) ? s1 = pc + s2 : s1 = -1;
(void)s3;
}),
INIT_INSTRUCTION(
BUF,
{
- (this->get_condition(UF)) ? s1 = wrap_address(pc + s2)
- : s1 = -1;
+ (this->get_condition(UF)) ? s1 = pc + s2 : s1 = -1;
(void)s3;
}),
INIT_INSTRUCTION(
BOF,
{
- (this->get_condition(OF)) ? s1 = wrap_address(pc + s2)
- : s1 = -1;
+ (this->get_condition(OF)) ? s1 = pc + s2 : s1 = -1;
(void)s3;
}),
@@ -387,7 +382,7 @@ void EX::advance_helper()
s3 = this->curr_instr->get_s3();
pc = this->curr_instr->get_pc();
- this->instr_map[m](s1, s2, s3, pc );
+ this->instr_map[m](s1, s2, s3, pc);
this->curr_instr->set_s1(s1);
this->status = OK;
diff --git a/src/sim/stage.cc b/src/sim/stage.cc
index 8a570f0..b7926fd 100644
--- a/src/sim/stage.cc
+++ b/src/sim/stage.cc
@@ -1,5 +1,4 @@
#include "stage.h"
-#include "utils.h"
#include <array>
#include <deque>
@@ -28,12 +27,12 @@ InstrDTO *Stage::advance(Response p)
InstrDTO *s = nullptr;
Response n;
- // std::cout << "advance: " << this->id << ": " << this->curr_instr << "?: " << p << ": " << this->checked_out.size() << ": ";
- // if (curr_instr)
+ // std::cout << "advance: " << this->id << ": " << this->curr_instr << "?: "
+ // << p << ": " << this->checked_out.size() << ": "; if (curr_instr)
// std::cout << curr_instr->get_mnemonic();
// for (long unsigned int i = 0; i < this->checked_out.size(); ++i)
// std::cout << this->checked_out[i] << " ";
- // std::cout << std::endl;
+ // std::cout << std::endl;
if (this->curr_instr && this->status != OK) {
this->advance_helper();
}
@@ -53,9 +52,10 @@ InstrDTO *Stage::advance(Response p)
return r;
}
-std::vector<int> Stage::stage_info() {
+std::vector<int> Stage::stage_info()
+{
std::vector<int> info;
- if(this->curr_instr){
+ if (this->curr_instr) {
info.push_back(this->curr_instr->get_mnemonic());
info.push_back(this->curr_instr->get_pc());
info.push_back(this->curr_instr->get_s1());
@@ -63,7 +63,7 @@ std::vector<int> Stage::stage_info() {
info.push_back(this->curr_instr->get_s3());
}
return info;
- }
+}
void Stage::set_condition(CC c, bool v)
{
@@ -78,10 +78,8 @@ signed int Stage::dereference_register(signed int v)
signed int r;
if (v < 0 || v >= GPR_NUM + V_NUM) {
- throw std::out_of_range(string_format(
- "instruction tried to access register %d, which does "
- "not exist",
- v));
+ throw std::out_of_range(
+ "instruction tried to access register which does not exist");
}
r = (v >= GPR_NUM) ? this->vrs[v % GPR_NUM] : this->gprs[v];
@@ -91,10 +89,8 @@ signed int Stage::dereference_register(signed int v)
void Stage::store_register(signed int v, signed int d)
{
if (v < 0 || v >= GPR_NUM + V_NUM) {
- throw std::out_of_range(string_format(
- "instruction tried to access register %d, which does "
- "not exist",
- v));
+ throw std::out_of_range(
+ "instruction tried to access register which does not exist");
}
if (v >= GPR_NUM)