X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=3b_sim%2Fcpmem.cpp;h=7972aa8f061344cf4a5f6c4cd5d4b9dd895c71ae;hb=d4a0ea68530da911bc41c44b24d244c7dc198190;hp=31205e61f17a75e557c4ac2f730fe7871362d0b7;hpb=12d2a7c14a42e01b6caf2a097db32404a403d213;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