PDA

View Full Version : reset and the Xbus example



skootamota
03-13-2008, 05:57 PM
Just a question about the Xbus example. From the Xbus specification, section A.2.3 regarding Reset, it states that reset may be asserted at any time.

Looking at the following code snippet from the xbus_master_driver.sv file, if reset was ever asserted more than once, then this driver continues to get sequence items (it's still in the get_and drive() forever loop), tries to process them, all the while it may be in reset. I think there is an issue here, and if so, is there a proper method to deal with reset?

// run phase
virtual task run();
fork
get_and_drive();
reset_signals();
join
endtask : run

// get_and_drive
virtual protected task get_and_drive();
ovm_sequence_item item;
xbus_transfer this_trans;
@(negedge xmi.sig_reset);
`message(OVM_MEDIUM,("Reset dropped"))
forever begin
@(posedge xmi.sig_clock);
seq_item_prod_if.get_next_item(item);
$cast(this_trans, item);
drive_transfer(this_trans);
seq_item_prod_if.item_done();
end
endtask : get_and_drive

// reset_signals
virtual protected task reset_signals();
forever begin
@(posedge xmi.sig_reset);
`message(OVM_MEDIUM, ("Reset observed"))
xmi.sig_request[master_id] <= 0;
xmi.rw <= 'h0;
xmi.sig_addr <= 'hz;
xmi.sig_data_out <= 'hz;
xmi.sig_size <= 'bz;
xmi.sig_read <= 'bz;
xmi.sig_write <= 'bz;
xmi.sig_bip <= 'bz;
end
endtask : reset_signals

pjigar
03-13-2008, 10:28 PM
The xbus uVC is a representative implementation as an example. And as such it does not handle on the fly reset. On the fly reset handling is tricky topic. Let's consider couple of choices here.

a. You can "halt" the sequencer by using couple of lock step thread within get_and_drive() task.
b. You can "reset" the sequencer and restart the test sequence again.

Case-a will work if the DUT does not need to be re-configured for operation. If DUT requires configuration up front then you will need to go case-b route. Case-b route is complex but sometime required.

While on the topic of reset handling: Some devices also support "soft reset" and that's even trickier to handle in the testbench. All-in-all, reset handling is a very subjective topic based on DUT. I would advice you to discuss this with one the local Cadence AE in person for suggestions that will work for your design.

tfitz
03-14-2008, 06:29 AM
Just to be thorough (and fair)
You can also contact your local Mentor AE.
:)