Forum Discussion
Altera_Forum
Honored Contributor
12 years agoHello, I used this code in my test program (in test program i used standart altera_avalon_mm_master_bfm and altera_avalon_mm_slave_bfm submodels), but i have a trouble with using read task.
--- Quote Start ---
// ============================================================
// Tasks
// ============================================================
//
// Avalon-MM single-transaction read and write procedures.
//
// ------------------------------------------------------------
task avalon_write (
// ------------------------------------------------------------
input addr,
input data
);
begin
// Construct the BFM request
`BFM.set_command_request(REQ_WRITE);
`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(data, 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 discard
`BFM.pop_response();
end
endtask
// ------------------------------------------------------------
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
Cheers, Dave --- Quote End --- When i use write task address and data proceed from Master to Slave and it can be seen in diagrams in ModelSim. But when i use read task Slave component didn't form readdata in response to adress from Master. I added in read task this code
`SL.set_response_request(REQ_READ);
`SL.set_response_latency(0,0);
`SL.set_response_data('h1234567,0);
`SL.set_interface_wait_time(0,0);
`SL.push_response();
but nothing changed, readdata signal is unknown. What am I doing wrong?