Jump to content

Recommended Posts

Posted

Hi UVM experts:

Normally, driver gets transaction at posedge clock and then drive transaction to interface.

But when driver gets a transaction at non-posedge clock, it cannot drive transaction immediately, and must wait next posedge clock (NBA region) to drive it out. My code as below shows:

[example code begin]

forever begin

seq_item_port.get_next_item(req);

vif.cb.address <= req.address;

vif.cb.data <= req.data;

@(vif.cb);

end

[example code end]

transaction_1 : address = 32'h0000_1010; data = 32'h0000_1111;

transaction_2 : address = 32'h0000_1111; data = 32'h1111_0000;

When driver gets tranasction_1 at non-posedge clock, and gets transaction_2 at next posedge clock, I found only transaction_2's address=32'h0000_1111 & data=32'h1111_0000 been driven to the interface.

So how to fix this bug?

Thanks in advence.

Best Regards

wuddi

Posted

Define a SVA sequence in the clocking block:

clocking cb @(posedge clk);

...

sequence at_posedge;

1;

endsequence

endclocking

Then in the driver use the following code before driving the transaction:

wait (vif.cb.at_posedge.triggered);

Posted

Hi dudi, Thanks.

I solve the problem in a different way.

first, I declare a event clock_detected;

then use a task to triggered the event.

task sync_to_posedge_clk();

fork

forever begin

@(vif.cb);

-> clock_detected;

end

join_none

endtask

task run_phase(uvm_phase phase);

sync_to_posedge_clk();

seq_item_port.get_next_item(req);

wait(clock_detected.triggered);

. . .

endtask

Best Regards

wuddi

Posted

That will do the trick. You can also move the event to the interface, and trigger it in an always@(posedge clk) block. Then wait for vif.event_name.triggered . This way you won't need to fork it in the run_phase

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...