Reputation: 943
I usually have a typical driver-sequencer communication mechanism as follows:
// somewhere in driver run_phase
seq_item_port.get(req_item);
$cast(rsp_item, req_item.clone());
// ... execute the item
seq_item.port.put(rsp_item);
While executing the item, there may be a condition that requires the driver to suspend the execution until specific event is met. And when the event met, the driver can resume and finish execution. During the suspension, the driver should be able to execute other sequence_item transmitted by sequencer.
Apparently, the above codes can not handle this situation. So I guess I need sort of non-blocking mechanism between sequencer and driver. Since I never did this before, so I am wondering if there is an example or standard use model/mechanism to do this.
Upvotes: 0
Views: 1216
Reputation: 7573
You'll have to implement this kind of both in the driver and in the sequence that's running on the sequencer.
In the driver, you'll need to do some forking. Since I can't know exactly what you want to do I'll write something generic:
class some_driver;
task run_phase(uvm_phase phase);
forever begin
seq_item_port.get(req);
$cast(rsp, req.clone());
fork
if (<some_condition_here>) begin
drive(req);
seq_item.port.put(rsp);
end
join_none
end
endtask
endclass
<some_condition>
can depend on the item being driven, the state of the system or both. Your driver will merrily get items from the sequencer and drive them in its own pace.
In the sequence that's running you'll also have to implement parallelism by forking:
class some_sequence;
task body();
// item1 has to be finished completely before going further
start_item(item1);
finish_item(item1);
get_response(item1);
// item2 has to start before item3, but it doesn't matter which is done first
start_item(item2);
finish_item(item2);
start_item(item3);
finish_item(item3);
fork
begin
get_response(item2);
get_response(item3);
end
join
endtask
endclass
You can implement all sorts of crazy scenarios. Again, this is all pretty generic, but it should be a starting point to implement your own code.
Upvotes: 1