How do we generate Stimulus using UVM ?

In order to generate stimulus we need to define sequence using UVM library "uvm_sequence" and is pointed to the earlier defined sequence item.

Sequences can be multiple but will be connected to sequencer before it is transferred to Driver.

Let us look into one simple example wich demonstrate the definition of sequence

class tx_sequence  extends uvm_sequence #(tx_item);

       `uvm_object_utils(tx_sequence)

       function new (string name = "tx_sequence");

           super.new(name);

        endfunction

  // Now, define the task to generate the stimulus multiple times

        virtual task body();

          repeat (5)  begin   // Iterate generation for 5 times

             tx_item       tx;  // handle definition for tx_item

             // create tx_item handle using factory mechanism

             tx  = tx_item::type_id::create("tx");  

                 start_item(tx);

                 if (!tx.randomize() )

                   `uvm_fatal(.......);

                 finish_item(tx);

            end

         endtask

endclass





Comments