Skip to content

Commit 482e736

Browse files
committed
Fix memory handling for page boundary operations in handle_operation
1 parent c38c577 commit 482e736

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/components/scc/memory.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ int memory<SIZE, BUSWIDTH>::handle_operation(tlm::tlm_generic_payload& trans, sc
251251
auto first_part = mem.page_size - offs;
252252
std::copy(p.data() + offs, p.data() + offs + first_part, ptr);
253253
const auto& p2 = mem((adr / mem.page_size) + 1);
254-
std::copy(p2.data(), p2.data() + len, ptr + first_part);
254+
auto second_part = len - first_part;
255+
std::copy(p2.data(), p2.data() + second_part, ptr + first_part);
255256
} else {
256257
std::copy(p.data() + offs, p.data() + offs + len, ptr);
257258
}

0 commit comments

Comments
 (0)