X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=3b_sim%2Fcpmem.cpp;h=7972aa8f061344cf4a5f6c4cd5d4b9dd895c71ae;hb=815c827247bc211e4785016985666fbfd201f423;hp=31205e61f17a75e557c4ac2f730fe7871362d0b7;hpb=d1dab9a35d864d5533e2a9e8d49f1ad840773687;p=calu.git diff --git a/3b_sim/cpmem.cpp b/3b_sim/cpmem.cpp index 31205e6..7972aa8 100644 --- a/3b_sim/cpmem.cpp +++ b/3b_sim/cpmem.cpp @@ -18,7 +18,7 @@ void CPMem::set(const MEMORY_ADDRESS address, const T data) throw out_of_range(error.str()); } - MEMORY_ADDRESS temp = address; + MEMORY_ADDRESS temp = (address & (~(BYTE_COUNT-1))) / BYTE_COUNT; auto iter = m_memory.begin(); while(temp > 0) { ++iter; @@ -38,7 +38,8 @@ T CPMem::get(const MEMORY_ADDRESS address) const error << "memoryaddress " << address << " out of range"; throw out_of_range(error.str()); } - return m_memory[address]; + MEMORY_ADDRESS temp = (address & (~(BYTE_COUNT-1))) / BYTE_COUNT; + return m_memory[temp]; } template