Example of writing a reset sequence

Hi,

I see good example on verification academy: https://verificationacademy.com/verification-horizons/june-2012-volume-8-issue-2/On-the-Fly-Reset on how to handle reset. Can someone point me any example or psuedo code for writing a reset sequence. Since reset will be part of virtual interface how can we control and write a separate sequence?

Thanks

In reply to curious_verifier:

Writing a separate sequence for handling resets in a UVM environment involves creating a sequence that specifically targets reset scenarios. Below is a pseudo-code example illustrating how you can approach writing a reset sequence in UVM:

class ResetSequence extends uvm_sequence#(some_transaction_type);
    // Define necessary variables or configurations

    // Constructor
    function new(string name = "ResetSequence");
        super.new(name);
    endfunction

    // The main body of the reset sequence
    task body();
        // Optional: Add any pre-reset actions

        // Send a reset command to the DUT (assume reset_command is a sequence item)
        `uvm_do_with(reset_command, {
            .reset_type   = RESET_ASSERT; // or RESET_DEASSERT for deassert
            // Add any specific reset-related configuration if needed
        })

        // Optionally, wait for acknowledgment or check status

        // Optional: Add any post-reset actions

        // Optionally, wait for some duration after the reset
        #10;

        // Other sequence items or actions after reset if needed

        // End of sequence
        `uvm_sequence_utils(finish_sequence)
    endtask
endclass

In this pseudo-code:

some_transaction_type is a placeholder for the actual transaction type you are using in your environment.

The reset_command is assumed to be a sequence item representing a reset command. You need to define this sequence item based on your DUT’s protocol.

The reset_type field in the reset_command specifies whether it’s an assert or deassert type of reset.

The optional sections labeled “Optional: Add any pre-reset actions” and similar provide spaces where you can customize the sequence to include any setup or cleanup actions before or after the reset.

The #10 delay after the reset is optional and can be adjusted based on your requirements.

To use this sequence in a test, you would typically call it from your test’s main function or another sequence. For example:

class MyTest extends uvm_test;
    // ... other test components ...

    virtual task run_phase(uvm_phase phase);
        ResetSequence reset_seq;

        // Create an instance of the reset sequence
        reset_seq = ResetSequence::type_id::create("reset_seq");

        // Start the reset sequence
        `uvm_create(reset_seq)
        `uvm_sequence_start(reset_seq)

        // Continue with other sequences or actions after the reset if needed
    endtask
endclass

This example provides a basic structure for a reset sequence. You may need to adapt it to fit the specifics of your DUT, your verification environment, and your desired reset handling strategy.


rahulvala@gmail.com
Freelancer/verification engineer
https://www.linkedin.com/in/rahulvala/