Poor performance using function call within a uvm_driver class

Hello, I am dealing with a simulation performance problem using UVM,

The main objective of the image_driver is to write a image into an memory array in DUT, it calls init_image() to complete the above task.

task image_driver::main_phase();

init_image();

endtask

the init_image() task reads from a file and calls mem_backdoor_acc() to fill data into an memory array.

task init_image();

for(i=0;i< height;i++) begin
for(j=0;j< width;j++) begin
mem_backdoor_acc(addr,data);
end
end

endtask

The question is the simulation speed is VERY slow when calling mem_backdoor_acc() function, is there any solution to this kind of issue?

In reply to lihan:

Not really enough information to help you.

Is the memory array in the DUT modeled as a single Verilog/SystemVerilog/VHDL memory?

How does mem_backdoor_acc access the memory?

In reply to dave_59:

dave_59:

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

In reply to lihan:

How big is this memory? And you need to define “poor performance” in relation to loading and other simulation time.

In reply to dave_59:

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.

Srini