diff options
Diffstat (limited to 'inc')
-rw-r--r-- | inc/cache.h | 2 | ||||
-rw-r--r-- | inc/definitions.h | 10 | ||||
-rw-r--r-- | inc/dram.h | 2 | ||||
-rw-r--r-- | inc/storage.h | 5 |
4 files changed, 15 insertions, 4 deletions
diff --git a/inc/cache.h b/inc/cache.h index 4d143aa..312f3d1 100644 --- a/inc/cache.h +++ b/inc/cache.h @@ -8,7 +8,7 @@ class Cache : public Storage /** * Constructor. * @param The number of `lines` contained in memory. The total number of - * words is this number multiplied by 4. + * words is this number multiplied by LINE_SIZE. * @param The next lowest level in storage. Methods from this object are * called in case of a cache miss. * @param The number of clock cycles each access takes. diff --git a/inc/definitions.h b/inc/definitions.h new file mode 100644 index 0000000..1593162 --- /dev/null +++ b/inc/definitions.h @@ -0,0 +1,10 @@ +#ifndef DEFINITIONS_H +#define DEFINITIONS_H + +/** + * Defines common macros. + */ + +#define LINE_SIZE 4 + +#endif /* DEFINITIONS_H_INCLUDED */ @@ -8,7 +8,7 @@ class Dram : public Storage /** * Constructor. * @param The number of `lines` contained in memory. The total number of - * words is this number multiplied by 4. + * words is this number multiplied by LINE_SIZE. * @param The number of clock cycles each access takes. * @return A new memory object. */ diff --git a/inc/storage.h b/inc/storage.h index 5ad4f99..c0f09a3 100644 --- a/inc/storage.h +++ b/inc/storage.h @@ -1,5 +1,6 @@ #ifndef STORAGE_H #define STORAGE_H +#include "definitions.h" #include "response.h" #include <array> #include <vector> @@ -37,13 +38,13 @@ 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, 4>> view(int base, int lines); + std::vector<std::array<signed int, LINE_SIZE>> view(int base, int lines); protected: /** * The data currently stored in this level of storage. */ - std::vector<std::array<signed int, 4>> *data; + std::vector<std::array<signed int, LINE_SIZE>> *data; /** * A pointer to the next lowest level of storage. * Used in case of cache misses. |