summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-05-11 12:20:33 -0400
committerbd <bdunahu@operationnull.com>2025-05-11 12:21:34 -0400
commit26c24ab3c581967015490d1a11ee098bb5ba338a (patch)
tree94c8f59ae7d530127d8cd49ce1e6480da7397d6f
parent6f4e9e0b914c3e68691a5d884cbad0b5813fcf18 (diff)
Replaced STOREV with LOADV
-rw-r--r--gui/gui.h21
-rw-r--r--inc/ex.h2
-rw-r--r--inc/instr.h4
-rw-r--r--src/ex.cc14
-rw-r--r--src/id.cc54
-rw-r--r--src/instr.cc28
-rw-r--r--tests/ex.cc4
-rw-r--r--tests/id.cc4
8 files changed, 63 insertions, 68 deletions
diff --git a/gui/gui.h b/gui/gui.h
index 3f82898..fd0eacb 100644
--- a/gui/gui.h
+++ b/gui/gui.h
@@ -160,17 +160,16 @@ class GUI : public QMainWindow
{Mnemonic::SUBV, "SUBV"}, {Mnemonic::MULV, "MULV"},
{Mnemonic::DIVV, "DIVV"}, {Mnemonic::CMP, "CMP"},
{Mnemonic::CEV, "CEV"}, {Mnemonic::LOAD, "LOAD"},
- {Mnemonic::LOADV, "LOADV"}, {Mnemonic::ADDI, "ADDI"},
- {Mnemonic::SUBI, "SUBI"}, {Mnemonic::SFTRI, "SFTRI"},
- {Mnemonic::SFTLI, "SFTLI"}, {Mnemonic::ANDI, "ANDI"},
- {Mnemonic::ORI, "ORI"}, {Mnemonic::XORI, "XORI"},
- {Mnemonic::STORE, "STORE"}, {Mnemonic::STOREV, "STOREV"},
- {Mnemonic::JMP, "JMP"}, {Mnemonic::JRL, "JRL"},
- {Mnemonic::JAL, "JAL"}, {Mnemonic::BEQ, "BEQ"},
- {Mnemonic::BGT, "BGT"}, {Mnemonic::BUF, "BUF"},
- {Mnemonic::BOF, "BOF"}, {Mnemonic::PUSH, "PUSH"},
- {Mnemonic::POP, "POP"}, {Mnemonic::NOP, "NOP"},
- {Mnemonic::RET, "RET"},
+ {Mnemonic::ADDI, "ADDI"}, {Mnemonic::SUBI, "SUBI"},
+ {Mnemonic::SFTRI, "SFTRI"}, {Mnemonic::SFTLI, "SFTLI"},
+ {Mnemonic::ANDI, "ANDI"}, {Mnemonic::ORI, "ORI"},
+ {Mnemonic::XORI, "XORI"}, {Mnemonic::SRDL, "SRDL"},
+ {Mnemonic::SRDS, "SRDS"}, {Mnemonic::JMP, "JMP"},
+ {Mnemonic::JRL, "JRL"}, {Mnemonic::JAL, "JAL"},
+ {Mnemonic::BEQ, "BEQ"}, {Mnemonic::BGT, "BGT"},
+ {Mnemonic::BUF, "BUF"}, {Mnemonic::BOF, "BOF"},
+ {Mnemonic::PUSH, "PUSH"}, {Mnemonic::POP, "POP"},
+ {Mnemonic::NOP, "NOP"}, {Mnemonic::RET, "RET"},
};
QString mnemonicToString(Mnemonic mnemonic)
{
diff --git a/inc/ex.h b/inc/ex.h
index ff4041b..30a6639 100644
--- a/inc/ex.h
+++ b/inc/ex.h
@@ -90,7 +90,7 @@ class EX : public Stage
/**
* Handles operations involving a single vector register.
- * Currently, this is LOADV and STOREV
+ * Currently, this is SRDL and SRDS
* @param slot 1, and later, the result of the mnemonic operation.
* @param slot 2
* @param the mnemonic
diff --git a/inc/instr.h b/inc/instr.h
index 0c49a79..7a6396d 100644
--- a/inc/instr.h
+++ b/inc/instr.h
@@ -37,8 +37,9 @@ enum Mnemonic {
DIVV,
CMP,
CEV,
+ SRDL,
+ SRDS,
LOAD,
- LOADV,
ADDI,
SUBI,
SFTRI,
@@ -47,7 +48,6 @@ enum Mnemonic {
ORI,
XORI,
STORE,
- STOREV,
JMP,
JRL,
JAL,
diff --git a/src/ex.cc b/src/ex.cc
index 56a59d7..3328cbe 100644
--- a/src/ex.cc
+++ b/src/ex.cc
@@ -243,18 +243,14 @@ void EX::handle_vector_operations(
void EX::handle_i_vector_operations(signed int &s1, signed int s2, Mnemonic m)
{
switch (m) {
- case LOADV:
- case STOREV:
- s1 = s1 + s2;
- break;
-
- case RET:
- case NOP:
- break;
+ // case SRDL:
+ // case SRDS:
+ // s1 = s1 + s2;
+ // break;
default:
throw std::invalid_argument("handle_i_vector_operations did not "
- "receive a LOADV or STOREV operation!");
+ "receive a SRDL or SRDS operation!");
}
}
diff --git a/src/id.cc b/src/id.cc
index 85637a6..371e3b7 100644
--- a/src/id.cc
+++ b/src/id.cc
@@ -164,35 +164,35 @@ void ID::decode_I_type(signed int &s1)
this->curr_instr->operands.integer.slot_two = s2;
this->status = (r1 == OK && r2 == OK) ? OK : STALLED;
return;
- case STOREV:
- this->curr_instr->operands.i_vector.slot_two = s3;
- s2 = GET_MID_BITS(s1, s0b, s1b);
- s1 = GET_LS_BITS(s1, s0b);
+ // case SRDS:
+ // this->curr_instr->operands.i_vector.slot_two = s3;
+ // s2 = GET_MID_BITS(s1, s0b, s1b);
+ // s1 = GET_LS_BITS(s1, s0b);
- // base address
- r1 = this->read_guard<signed int>(s1, s1);
- this->curr_instr->operands.i_vector.slot_one = s1;
- // vector value to be stored
- r2 = this->read_guard<std::array<signed int, V_R_LIMIT>>(
- s2, this->curr_instr->operands.i_vector.slot_three);
- r3 = this->set_vlen();
+ // // base address
+ // r1 = this->read_guard<signed int>(s1, s1);
+ // this->curr_instr->operands.i_vector.slot_one = s1;
+ // // vector value to be stored
+ // r2 = this->read_guard<std::array<signed int, V_R_LIMIT>>(
+ // s2, this->curr_instr->operands.i_vector.slot_three);
+ // r3 = this->set_vlen();
- this->status = (r1 == OK && r2 == OK && r3 == OK) ? OK : STALLED;
- return;
- case LOADV:
- this->curr_instr->operands.i_vector.slot_two = s3;
- s2 = GET_LS_BITS(s1, s0b);
- s1 = GET_MID_BITS(s1, s0b, s1b);
- // base address
- r1 = this->read_guard<signed int>(s1, s1);
- this->curr_instr->operands.i_vector.slot_one = s1;
- r3 = this->set_vlen();
- if (r1 == OK && r3 == OK)
- // vector destination
- this->curr_instr->operands.i_vector.slot_three =
- this->write_guard<std::array<signed int, V_R_LIMIT>>(s2);
- this->status = (r1 == OK && r3 == OK) ? OK : STALLED;
- return;
+ // this->status = (r1 == OK && r2 == OK && r3 == OK) ? OK : STALLED;
+ // return;
+ // case SRDL:
+ // this->curr_instr->operands.i_vector.slot_two = s3;
+ // s2 = GET_LS_BITS(s1, s0b);
+ // s1 = GET_MID_BITS(s1, s0b, s1b);
+ // // base address
+ // r1 = this->read_guard<signed int>(s1, s1);
+ // this->curr_instr->operands.i_vector.slot_one = s1;
+ // r3 = this->set_vlen();
+ // if (r1 == OK && r3 == OK)
+ // // vector destination
+ // this->curr_instr->operands.i_vector.slot_three =
+ // this->write_guard<std::array<signed int, V_R_LIMIT>>(s2);
+ // this->status = (r1 == OK && r3 == OK) ? OK : STALLED;
+ // return;
case LOAD:
this->curr_instr->operands.integer.slot_three = s3;
s2 = GET_LS_BITS(s1, s0b);
diff --git a/src/instr.cc b/src/instr.cc
index ee2d37f..98028fc 100644
--- a/src/instr.cc
+++ b/src/instr.cc
@@ -23,26 +23,26 @@
namespace instr
{
const std::unordered_map<unsigned int, Mnemonic> mnemonic_map = {
- {0b0000100, ADD}, {0b0001000, SUB}, {0b0001100, MUL},
- {0b0010000, QUOT}, {0b0010100, REM}, {0b0011000, SFTR},
- {0b0011100, SFTL}, {0b0100000, AND}, {0b0100100, OR},
- {0b0101000, NOT}, {0b0101100, XOR}, {0b0110000, ADDV},
- {0b0110100, SUBV}, {0b0111000, MULV}, {0b0111100, DIVV},
- {0b1000000, CMP}, {0b1000100, CEV}, {0b000101, LOAD},
- {0b001001, LOADV}, {0b0001101, ADDI}, {0b0010001, SUBI},
- {0b0010101, SFTRI}, {0b0011001, SFTLI}, {0b0011101, ANDI},
- {0b0100001, ORI}, {0b0100101, XORI}, {0b0101001, STORE},
- {0b0101101, STOREV}, {0b0000110, JMP}, {0b0001010, JRL},
- {0b0001110, JAL}, {0b0010010, BEQ}, {0b0010110, BGT},
- {0b0011010, BUF}, {0b0011110, BOF}, {0b0100010, PUSH},
- {0b0100110, POP}, {0b0101010, RET},
+ {0b0000100, ADD}, {0b0001000, SUB}, {0b0001100, MUL},
+ {0b0010000, QUOT}, {0b0010100, REM}, {0b0011000, SFTR},
+ {0b0011100, SFTL}, {0b0100000, AND}, {0b0100100, OR},
+ {0b0101000, NOT}, {0b0101100, XOR}, {0b0110000, ADDV},
+ {0b0110100, SUBV}, {0b0111000, MULV}, {0b0111100, DIVV},
+ {0b1000000, CMP}, {0b1000100, CEV}, {0b1001000, SRDL},
+ {0b1001100, SRDS}, {0b000101, LOAD}, {0b0001001, ADDI},
+ {0b0001101, SUBI}, {0b0010001, SFTRI}, {0b0010101, SFTLI},
+ {0b0011001, ANDI}, {0b0011101, ORI}, {0b0100001, XORI},
+ {0b0100101, STORE}, {0b0000110, JMP}, {0b0001010, JRL},
+ {0b0001110, JAL}, {0b0010010, BEQ}, {0b0010110, BGT},
+ {0b0011010, BUF}, {0b0011110, BOF}, {0b0100010, PUSH},
+ {0b0100110, POP}, {0b0101010, RET},
};
FieldType get_field_types(Mnemonic m)
{
if (m == ADDV || m == SUBV || m == MULV || m == DIVV || m == CEV) {
return R_VECT;
- } else if (m == STOREV || m == LOADV) {
+ } else if (m == SRDL || m == SRDS) {
return I_VECT;
} else {
return SI_INT;
diff --git a/tests/ex.cc b/tests/ex.cc
index 5972182..5dbbe32 100644
--- a/tests/ex.cc
+++ b/tests/ex.cc
@@ -538,7 +538,7 @@ TEST_CASE_METHOD(EXFixture, "LOAD", "[ex]")
delete i;
}
-// TEST_CASE_METHOD(EXFixture, "LOADV", "[ex]")
+// TEST_CASE_METHOD(EXFixture, "SRDL", "[ex]")
// {
// }
@@ -763,7 +763,7 @@ TEST_CASE_METHOD(EXFixture, "STORE", "[ex]")
delete i;
}
-// TEST_CASE_METHOD(EXFixture, "STOREV", "[ex]")
+// TEST_CASE_METHOD(EXFixture, "SRDS", "[ex]")
// {
// }
diff --git a/tests/id.cc b/tests/id.cc
index b52ad9c..20b3200 100644
--- a/tests/id.cc
+++ b/tests/id.cc
@@ -166,13 +166,13 @@ TEST_CASE_METHOD(IDFixture, "Parse arbitrary i-type # two", "[id]")
signed int t;
InstrDTO *i;
- t = this->encode_I_type(0xCC, 0b10101, 0b00110, 0b11011, 0b1);
+ t = this->encode_I_type(0xCC, 0b10101, 0b00110, 0b11010, 0b1);
i = this->decode_bits(t);
CHECK(i->operands.integer.slot_one == 0x00000000); // registers are empty
CHECK(i->operands.integer.slot_two == 0x00000000);
CHECK(i->operands.integer.slot_three == 0xCC);
- CHECK(i->mnemonic == STOREV);
+ CHECK(i->mnemonic == STORE);
delete i;
}