summaryrefslogtreecommitdiff
path: root/src/sim/ex.cc
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-04-01 15:57:14 -0400
committerbd <bdunahu@operationnull.com>2025-04-01 15:57:14 -0400
commit25ce77db5f0dbfe6064eb0553591f1b956bad24a (patch)
tree5a1c347f05f14496d2d3a2f1befd88be9020cad3 /src/sim/ex.cc
parent6579f7272905d1e25b43ef051da6c2180e60ca2b (diff)
Fix a lot of pipeline bugs
Diffstat (limited to 'src/sim/ex.cc')
-rw-r--r--src/sim/ex.cc14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/sim/ex.cc b/src/sim/ex.cc
index 3d95917..ec4c47f 100644
--- a/src/sim/ex.cc
+++ b/src/sim/ex.cc
@@ -4,6 +4,7 @@
#include "instrDTO.h"
#include "response.h"
#include "stage.h"
+#include "utils.h"
#include <unordered_map>
// clang-format off
@@ -185,6 +186,7 @@ EX::EX(Stage *stage) : Stage(stage)
ADDI,
{
s1 = s1 + s3;
+ std::cout << "= " << s2 << std::endl;
(void)s2;
(void)this;
}),
@@ -282,28 +284,32 @@ EX::EX(Stage *stage) : Stage(stage)
INIT_INSTRUCTION(
BEQ,
{
- (this->get_condition(EQ)) ? s1 = this->pc + s2 : s1 = this->pc;
+ (this->get_condition(EQ)) ? s1 = wrap_address(this->pc + s2)
+ : s1 = -1;
(void)s3;
}),
INIT_INSTRUCTION(
BGT,
{
- (this->get_condition(GT)) ? s1 = this->pc + s2 : s1 = this->pc;
+ (this->get_condition(GT)) ? s1 = wrap_address(this->pc + s2)
+ : s1 = -1;
(void)s3;
}),
INIT_INSTRUCTION(
BUF,
{
- (this->get_condition(UF)) ? s1 = this->pc + s2 : s1 = this->pc;
+ (this->get_condition(UF)) ? s1 = wrap_address(this->pc) + s2
+ : s1 = -1;
(void)s3;
}),
INIT_INSTRUCTION(
BOF,
{
- (this->get_condition(OF)) ? s1 = this->pc + s2 : s1 = this->pc;
+ (this->get_condition(OF)) ? s1 = wrap_address(this->pc + s2)
+ : s1 = -1;
(void)s3;
}),