mem_backdoor_acc(addr,data) is a function call, it changes the memory context by direct access, thus it should be really fast since it doesn’t need any cycle for processing.
here is a simplified version of mem_backdoor_acc()
function mem_backdoor_acc(integer addr, bit [31:0] data)
test_top.dut.ddr.mem[row,bank] = data;
endfunction
The processing speed is still slow after marking out all the context inside the mem_backdoor_acc function, so I re-written the access method by macro to solve it.
`define mem_backdoor_acc(integer addr, bit [31:0] data) \
test_top.dut.ddr.mem[row,bank] = data; \
end
Another wild guess - it maybe that the file reading is taking more time? File IOs can slow down a lot depending on several factors. Since you mentioned “image” this could be large.