Hi,
The UVM cookbook on page 266 states following regarding the pipelined accesses:
" Pipelined Accesses
Pipelined accesses are primarily used to stress test the bus but they require a different approach in the sequence. A
pipelined sequence needs to have a seperate threads for generating the request sequence items and for handling the
response sequence items.
The generation loop will block on each finish_item() call until one of the threads in the driver completes a get() call.
Once the generation loop is unblocked it needs to generate a new item to have something for the next driver thread to
get(). Note that a new request sequence item needs to be generated on each iteration of the loop, if only one request item
handle is used then the driver will be attempting to execute its contents whilst the sequence is changing it.
Since the driver uses pipelined accesses, the sequence could modify a request item while the driver is still working on the previous sequence item. If only one handle is used for request item, driver could be executing its contents and sequence could be simultanesously modifying it. However, the code for pipelined sequence given below(reproduced from UVM cookbook) uses only one handle :
class mbus_pipelined_seq extends uvm_sequence #(mbus_seq_item);
`uvm_object_utils(mbus_pipelined_seq)
logic[31:0] addr[10]; // To save addresses
int count; // To ensure that the sequence does not complete too early
function new(string name = "mbus_pipelined_seq");
super.new(name);
endfunction
task body;
mbus_seq_item req = mbus_seq_item::type_id::create("req");
use_response_handler(1);
count = 0;
for(int i=0; i<10; i++) begin
start_item(req);
assert(req.randomize() with {MREAD == 0; MOPCODE == SINGLE; MADDR inside {[32'h0010_0000:32'h001F_FFFC]};});
addr[i] = req.MADDR;
finish_item(req);
end
foreach (addr[i]) begin
start_item(req);
req.MADDR = addr[i];
req.MREAD = 1;
finish_item(req);
end
// Do not end the sequence until the last req item is complete
wait(count == 20);
endtask: body
// This response_handler function is enabled to keep the sequence response
// FIFO empty
function void response_handler(uvm_sequence_item response);
count++;
endfunction: response_handler
endclass: mbus_pipelined_seq
Here the create function is not put inside the loop but is outside loop. So only one request item will be generated and there will be only one handle for request item. Is this an error in the code given in the UVM cookbook or my understanding is not correct?. Can someone explain please
regards,
-sunil puranik