From 1e095065907c2ab7b3a9705fab7c44e60361e035 Mon Sep 17 00:00:00 2001 From: bd Date: Tue, 11 Mar 2025 17:33:27 -0400 Subject: Call memory wrapping functions properly --- src/storage/dram.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/storage') 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 #include #include +#include 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 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 &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); -- cgit v1.2.3