Hi, Have a basic uvm question.
how do I synchronize sequence transaction count to the driver forever begin
In my below code the driver keeps taking the last item from sequence and drivers to the dut repeatedly . I have a component that doesn’t drop objection till much later and also dut doesnt have a idle signal to stop taking data
driver code:
seq_item_port.get_next_item(pkt1);
drive_item();
seq_item_port.item_done();
end
endtask
Sequence code:
repeat(trans) begin
start_item(pkt1);
pkt1.randomize();
`uvm_info(get_type_name(),$sformatf("Data sent is %s",pkt1.sprint()),UVM_NONE)
finish_item(pkt1);
end
Your question is not clear to me. You have not explained how your test is supposed to end. We do not know your DUT protocal. Typically, the driver is not supposed to be involved with objections. If the driver needs to send something evry clock cycle, use try_next_item() instead.
forever @(posedge clock)
if (seq_item_port.try_next_item(pkt1)) begin
drive_item();
seq_item_port.item_done();
end else
drive_null_item();
ideally the test ends when the number of transactions = trans is sent from sequence using raise and drop objection when I start sequencer.
However I just wanted to understand how to stop the driver from accepting more packets once required trans are sent
for example if trans = 50 and driver drives at every poseedge and clk posedge is every 10ns last packet is sent at 500 . however if my run phase runs for 700ns the last randomized packet is sent repeatedly from 500 to 700ns which shouldn’t happen.
Your driver code looks fine. Your SEQ shall decide how many transactions to send and as soon as that’s done, test should drop objections and that’s the end-of-the-show! What are you missing?
I added an extra run phase with 1000ns just to see what happens and I noticed that my driver keeps driving the last randomized packet to dut after all trans are done , so was wondering if there was a way to make sure driver doesnt drive after fixed number of transaction.
I think your observation is correct but maybe it is an interpretation thing. seq_item_port.get_next_item is blocking, hence your interpretation of “driver keeps driving” is incorrect. Maybe what you are missing is a “drive_idle” task in your driver and that you can call after item_done().
Your sequence should create a new object for every transaction. Currently you are reusing the same one over and over.
repeat(trans) begin
pkt1 = packet::type_id::create("pkt1"); // Add this line
start_item(pkt1);
pkt1.randomize();
`uvm_info(get_type_name(),$sformatf("Data sent is %s",pkt1.sprint()),UVM_NONE)
finish_item(pkt1);
end