summaryrefslogtreecommitdiff
path: root/inc/storage.h
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-03-11 11:28:25 -0400
committerGitHub <noreply@github.com>2025-03-11 11:28:25 -0400
commite24e3cd4d296599b9ef1b705846b1c868148b0fd (patch)
tree25646d98b4bfcf4b9a664eabfc2651c481984c1d /inc/storage.h
parent357e7fb37caf58cdfcdf85f7553db9378ff16e0c (diff)
parentfde996690d77b81e445450671a0723f837de4eb3 (diff)
Merge pull request #23 from bdunahu/bdunahu
Memory simulator CLI function implementation
Diffstat (limited to 'inc/storage.h')
-rw-r--r--inc/storage.h24
1 files changed, 14 insertions, 10 deletions
diff --git a/inc/storage.h b/inc/storage.h
index 793b982..a30e74d 100644
--- a/inc/storage.h
+++ b/inc/storage.h
@@ -1,22 +1,18 @@
#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:
+ virtual ~Storage() = default;
+
/**
* Write `data` into `address`.
* @param the source making the request.
@@ -43,12 +39,20 @@ 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);
+ 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();
+ /**
+ * Getter for lower attribute.
+ * TODO this doesn't seem like good object-oriented practice.
+ * @return this->lower
+ */
+ Storage *get_lower();
+
protected:
/**
* The data currently stored in this level of storage.