summaryrefslogtreecommitdiff
path: root/inc/instrDTO.h
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-03-29 22:14:42 -0400
committerGitHub <noreply@github.com>2025-03-29 22:14:42 -0400
commitd20623d031cf909d8892c2db38cf2e2e02bc6a9b (patch)
tree56ef4ae4325a5b803c484a3e5c8d87b89572cedf /inc/instrDTO.h
parentcaeff52f029920e027d18bc01149425560801f82 (diff)
parent1250c3765f59801d060152d5f6eed0a9faa11b50 (diff)
Merge pull request #37 from bdunahu/bdunahu
Instr, InstrDTO gets/sets, other structures required for decode -- tests as we move forward -- base classes -- decode stage implemented
Diffstat (limited to 'inc/instrDTO.h')
-rw-r--r--inc/instrDTO.h69
1 files changed, 63 insertions, 6 deletions
diff --git a/inc/instrDTO.h b/inc/instrDTO.h
index 86cec05..77a223e 100644
--- a/inc/instrDTO.h
+++ b/inc/instrDTO.h
@@ -1,5 +1,10 @@
#ifndef INSTRDTO_H
#define INSTRDTO_H
+#include "accessor.h"
+#include "instr.h"
+#include <functional>
+#include <string>
+#include <unordered_map>
class InstrDTO
{
@@ -11,29 +16,81 @@ class InstrDTO
~InstrDTO() = default;
/**
- * @return if_cycle
+ * @return hist entry for Accessor
*/
- int get_if_cycle();
+ int get_time_of(Accessor);
+ /**
+ * @return id_cycle
+ */
+ int get_id_cycle();
/**
* @return instr_bits
*/
signed int get_instr_bits();
+ /**
+ * @return s1
+ */
+ signed int get_s1();
+ /**
+ * @return s2
+ */
+ signed int get_s2();
+ /**
+ * @return s3
+ */
+ signed int get_s3();
+ /**
+ * @return the mnemonic of the instruction
+ */
+ Mnemonic get_mnemonic();
/**
- * @param if_cycle
+ * @param set hist key
*/
- void set_if_cycle(int);
+ void set_time_of(Accessor, int);
/**
* @param instr_bits
*/
void set_instr_bits(signed int);
+ /**
+ * @param s1
+ */
+ void set_s1(signed int);
+ /**
+ * @param s2
+ */
+ void set_s2(signed int);
+ /**
+ * @param s3
+ */
+ void set_s3(signed int);
+ /**
+ * @param the mnemonic of the instruction
+ */
+ void set_mnemonic(Mnemonic);
private:
/**
- * The current clock cycle.
+ * The clock cycle each stage finished an operation.
+ */
+ std::unordered_map<Accessor, int> hist;
+ /**
+ * The raw bits encoding the instruction.
*/
- int if_cycle;
signed int instr_bits;
+ /**
+ * Slots in this instruction, for storing temporary registers, immediates,
+ * or other.
+ * Some instruction types may use these differently.
+ * The `oper` function is in charge of knowing how to parse these.
+ */
+ signed int s1;
+ signed int s2;
+ signed int s3;
+ /**
+ * The mnemonic of the operation.
+ */
+ Mnemonic mnemonic;
};
#endif /* INSTRDTO_H_INCLUDED */