summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorbd <bdunahu@operationnull.com>2025-03-10 19:42:01 -0400
committerbd <bdunahu@operationnull.com>2025-03-10 19:42:01 -0400
commit4dbe50416eea0fecc2aa6f5ce3dc7032c95234c5 (patch)
tree140af0aec8ee90ac4c15e8b877ff2dc88f33d7ae /inc
parent9009d358f7959b1dd60b77fea181be04ae190ef3 (diff)
CLI view, clock, store, program banner
Diffstat (limited to 'inc')
-rw-r--r--inc/accessor.h15
-rw-r--r--inc/cli.h9
-rw-r--r--inc/response.h3
-rw-r--r--inc/risc_vector.h12
-rw-r--r--inc/storage.h15
5 files changed, 39 insertions, 15 deletions
diff --git a/inc/accessor.h b/inc/accessor.h
new file mode 100644
index 0000000..fb4999d
--- /dev/null
+++ b/inc/accessor.h
@@ -0,0 +1,15 @@
+#ifndef ACCESSOR_H
+#define ACCESSOR_H
+#include <iostream>
+
+enum Accessor {
+ IDLE,
+ MEM,
+ FETCH,
+ L1CACHE,
+ SIDE,
+};
+
+std::ostream &operator<<(std::ostream &os, Accessor a);
+
+#endif /* ACCESSOR_H_INCLUDED */
diff --git a/inc/cli.h b/inc/cli.h
index 4a5726c..2194228 100644
--- a/inc/cli.h
+++ b/inc/cli.h
@@ -29,10 +29,11 @@ class Cli
/**
* Stores data into memory at the specified address.
- * @param memory_address address of the memory where data needs to be stored
+ * @param accessor the pipline stage that is making this request
* @param data data value to be written to the memory
+ * @param address address of the memory where data needs to be stored
*/
- void store(int memory_address, int data);
+ void store(Accessor accessor, int data, int address);
/**
* Resets the memory configuration and cycles to their initial state.
@@ -64,10 +65,8 @@ class Cli
* @param level the level specifying the storage device. The first level
* one cache is level zero, with descending levels incrementing by a factor
* of one.
- * @param base the first index to be printed
- * @param the number of lines to be printed
*/
- void view(int level, int base, int lines);
+ void peek(int level);
/**
* Runs the command line interface
diff --git a/inc/response.h b/inc/response.h
index d945e0f..6cd6678 100644
--- a/inc/response.h
+++ b/inc/response.h
@@ -1,5 +1,6 @@
#ifndef RESPONSE_H
#define RESPONSE_H
+#include <iostream>
enum Response {
OK,
@@ -7,4 +8,6 @@ enum Response {
BLOCKED,
};
+std::ostream &operator<<(std::ostream &os, Response r);
+
#endif /* RESPONSE_H_INCLUDED */
diff --git a/inc/risc_vector.h b/inc/risc_vector.h
new file mode 100644
index 0000000..244adb6
--- /dev/null
+++ b/inc/risc_vector.h
@@ -0,0 +1,12 @@
+#ifndef RISC_VECTOR_H
+#define RISC_VECTOR_H
+#include <string>
+
+
+
+/**
+ * Outputs the program version and banner.
+ */
+void print_version_number();
+
+#endif /* RISC_VECTOR_H_INCLUDED */
diff --git a/inc/storage.h b/inc/storage.h
index 3f113d3..a30e74d 100644
--- a/inc/storage.h
+++ b/inc/storage.h
@@ -1,19 +1,13 @@
#ifndef STORAGE_H
#define STORAGE_H
+#include "accessor.h"
#include "definitions.h"
#include "response.h"
#include <algorithm>
#include <array>
+#include <map>
#include <vector>
-enum Accessor {
- IDLE,
- MEM,
- FETCH,
- L1CACHE,
- SIDE,
-};
-
class Storage
{
public:
@@ -45,9 +39,10 @@ class Storage
* @return A matrix of data values, where each row is a line and each column
* is a word.
*/
- std::vector<std::array<signed int, LINE_SIZE>> view(int base, int lines) const;
+ std::vector<std::array<signed int, LINE_SIZE>>
+ view(int base, int lines) const;
/**
- * Advances to the next job if the current job is completed.
+ * Refreshes the state of this storage device and lower.
*/
void resolve();