Altera_Forum
Honored Contributor
11 years agoBFM Read from On Chip RAM
I followed D. W. Hawkins (dwh@ovro.caltech.edu) tutorial on JTAG-to-Avalon-MM. There is a task in the tutorial that reads a slave address using the BFM master. The slave is onchip_ram. The problem is that there is a latency of 1 clock cycle for the data to be available on the bus after the read address is available. This task reads the current value on bus (at the moment when the address is up), not the next cycle of the data (which is what I need). How can I fix it (such as introduce a latency in the response)?
// --------------------------------------------
task avalon_read (
// --------------------------------------------
input addr,
output data
);
begin
// Construct the BFM request
`BFM.set_command_request(REQ_READ);
`BFM.set_command_idle(0, 0);
`BFM.set_command_init_latency(0);
`BFM.set_command_address(addr);
`BFM.set_command_byte_enable('1,0);
`BFM.set_command_data(0, 0);
// Queue the command
`BFM.push_command();
// Wait until the transaction has completed
while (`BFM.get_response_queue_size() != 1)
@(posedge clk);
// Dequeue the response and return the data
`BFM.pop_response();
data = `BFM.get_response_data(0);
end
endtask