From 4dbe50416eea0fecc2aa6f5ce3dc7032c95234c5 Mon Sep 17 00:00:00 2001 From: bd Date: Mon, 10 Mar 2025 19:42:01 -0400 Subject: CLI view, clock, store, program banner --- inc/accessor.h | 15 +++++++++++++++ inc/cli.h | 9 ++++----- inc/response.h | 3 +++ inc/risc_vector.h | 12 ++++++++++++ inc/storage.h | 15 +++++---------- 5 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 inc/accessor.h create mode 100644 inc/risc_vector.h (limited to 'inc') 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 + +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 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 + + + +/** + * 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 #include +#include #include -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> view(int base, int lines) const; + std::vector> + 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(); -- cgit v1.2.3