diff options
author | bd <bdunahu@operationnull.com> | 2025-03-11 17:33:27 -0400 |
---|---|---|
committer | bd <bdunahu@operationnull.com> | 2025-03-11 17:33:27 -0400 |
commit | 1e095065907c2ab7b3a9705fab7c44e60361e035 (patch) | |
tree | 97f5628e53672ca63e1a7fa86972e4b0fb9ed5b0 /src/storage | |
parent | 979723533989a38660ece630b9e458cb3aa61bda (diff) |
Call memory wrapping functions properly
Diffstat (limited to 'src/storage')
-rw-r--r-- | src/storage/dram.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/storage/dram.cc b/src/storage/dram.cc index c244da5..60b4ae5 100644 --- a/src/storage/dram.cc +++ b/src/storage/dram.cc @@ -6,6 +6,7 @@ #include <bitset> #include <iostream> #include <iterator> +#include <utils.h> Dram::Dram(int lines, int delay) { @@ -22,6 +23,7 @@ Dram::~Dram() { delete this->data; } void Dram::do_write(signed int data, int address) { + address = wrap_address(address); int line = address / LINE_SIZE; int word = address % LINE_SIZE; @@ -31,18 +33,21 @@ void Dram::do_write(signed int data, int address) void Dram::do_write_line( std::array<signed int, LINE_SIZE> data_line, int address) { + address = wrap_address(address); int line = address / LINE_SIZE; this->data->at(line) = data_line; } void Dram::do_read(std::array<signed int, LINE_SIZE> &data_line, int address) { + address = wrap_address(address); int line = address / LINE_SIZE; data_line = this->data->at(line); } void Dram::do_read_word(signed int &data, int address) { + address = wrap_address(address); int line = address / LINE_SIZE; int word = address % LINE_SIZE; data = this->data->at(line).at(word); |