What is the difference between sequence item, sequence, sequence length and Virtual sequence?

Sequence_item → Wr or rd or both of them

sequence → collection of sequence items

virtual sequence —> collection of sequences (Is it correct?)

Shall i use virtual sequence on different agent sequencers? how it can be done?

Shall i use normal sequences on virtual sequencer? how it can be done?

For Example:

I have a sequence of back to back write transaction.

If the above sequence is run for number of sequence length (let us assume sequence length =5).

Is there any name if i run same sequence for ‘N’ times?

can i say sequence with 5 sequences or sequence with 5 back to back write transaction or sequence with 5 sub sequences?

What is meant by sub-sequence, which is encountered in UVM_cookbook

These are pretty basic questions. I’ll answer them briefly here, but you should really read the UVM Cookbook.

Sequence_item → Wr or rd or both of them

A sequence item is an object that models a piece of information being transmitted between two components (sometimes it’s called a “transaction”). In bus-based systems, the sequence_item usually includes a field “rw” which indicates whether it is a read or a write. This is done because you can only have a single transaction type being communicated between the sequence/sequencer/driver. You could have separate read and write transaction types if you want, but these would both need to be extended from a base_bus_item type, and then you get into casting issues so it’s probably not worth it.

sequence → collection of sequence items

Conceptually, sort of. Sequences are objects whose body() method is used to generate sequence_items to be sent to the driver.

virtual sequence —> collection of sequences (Is it correct?)

Not correct. A virtual sequence is a sequence that controls the execution of other sequences and almost never generates sequence_items itself. This is different from a sequence_library which is a sequence that lets you pick from a group of sequences that are registered with the library.

Shall i use virtual sequence on different agent sequencers? how it can be done?

A virtual sequence contains pointers to agent sequencers so you start other sequences on those sequencers.

Shall i use normal sequences on virtual sequencer? how it can be done?

We do not recommend using a virtual sequencer.

What is meant by sub-sequence, which is encountered in UVM_cookbook

In addition to executing sequence_items (via start_item/finish_item), sequences can call other sequences (via sequence.start()). A sequence that is started from another sequence (as opposed to from a test) is called a sub-sequence.
To execute N back-to-back write transactions, you could do something like

class my_seq extends uvm_sequence#(bus_item);
  `uvm_object_utils(my_seq)
  task body();
    bus_item item;
    int n;
    if(!uvm_config_db#(cfg)::get(this,"seq","n",n)) begin
      `uvm_warning("SEQ","n not set via cfg, using default value")
      n = 5;
    end
    for(int i = 0; i < n; i++) begin
      item = bus_item::type_id::create("item");
      start_item(item);
      item.rw = WRITE;
      item.addr = pick_an_addr();
      finish_item(item);
    end
  endtask