task foo::body()
forever begin
this.source_sequencer.get_next_item(tmp);
this.start_item(tmp);
this.finish_item(tmp);
this.source_sequencer.item_done();
end
endtask: body
In the above body(), I get only 1 item at a time.
The total number of items I can get is unknown a priori.
My goal is to reorder the items.
E.g. if the incoming items are A, B, C, the output should be (randomly) B, A, C.
How do I do this?
I am allowed to use a queue for storing "tmp".
I am not allowed to change the behaviour of the upstream sequence.
Please let me know. Thank You!