From ac547772d45d588f1f10b59c0f8790f55e75a123 Mon Sep 17 00:00:00 2001 From: Yinan Xu Date: Thu, 6 Aug 2020 08:55:40 +0800 Subject: [PATCH] ram_helper: print error index when out of bound --- src/test/csrc/ram.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/test/csrc/ram.cpp b/src/test/csrc/ram.cpp index 8a8beaf02..1ad661bd1 100644 --- a/src/test/csrc/ram.cpp +++ b/src/test/csrc/ram.cpp @@ -95,7 +95,10 @@ void init_ram(const char *img) { extern "C" void ram_helper( uint64_t rIdx, uint64_t *rdata, uint64_t wIdx, uint64_t wdata, uint64_t wmask, uint8_t wen) { - assert(rIdx < RAMSIZE / sizeof(uint64_t)); + if (rIdx >= RAMSIZE / sizeof(uint64_t)) { + printf("ERROR: ram idx = 0x%x out of bound!\n", rIdx); + assert(rIdx < RAMSIZE / sizeof(uint64_t)); + } *rdata = ram[rIdx]; if (wen) { assert(wIdx < RAMSIZE / sizeof(uint64_t)); -- GitLab