How to I set manual sequence ID in UVM?
In reply to Henriques:
i dont think, there is support in uvm to set sequence id while doing creation/randomization/sending (`uvm_do macros). you can set it when you create your sequence and start it on specific sequencer.
In reply to Henriques:
In reply to mitesh.patel:
Hi Mitesh
can I use it with `uvm_do_wit macro?
No , we can not change it via `uvm_do_with macro.
Because it is declared as a local variable in uvm_sequence_item base class.
In reply to het:
Hi Het/Mitesh
Do you know any other way to identify sequencce when we use `UVM_do_with macro?
In reply to Henriques:
In reply to het:
Hi Het/Mitesh
Do you know any other way to identify sequencce when we use `UVM_do_with macro?
I think it can be done via any customized enum/variable in your sequence.
For example,
int my_sequence_id;
…
`uvm_do_with(… my_sequence_id == 100);
By this, you can identify that which of the sequence’s response is not received or which of the sequence is not completed successfully.
In reply to Henriques:
How to I set manual sequence ID in UVM?
I believe this is a real bad idea, overwriting the id mechanism implemented in the base classes, because this will confuse all the id generation and you might get sequencs or seq_items with the same id.
I thin this is the reason why the method set_sequence_id is not containes in the UVM Reference Manual.
What is useful is the set_id_info to copy the id from a request to a corresponding responce seq_item
In reply to chr_sue:
Hi char_sue
I have question
q1 when sequence id set internally ,creation time or randomization time or sending time?
q2 why set_seq_id and get_seq_id facility availabe in uvm?
q3 when and where i can use this sequence_id in which situation it will be benefit for me?
In reply to Henriques:
seq_items are generated in 0 time, i.e. it is all the same time.
the sequence id information allows you to identify each sequence or seq_item with respect to this id. Very important this id becomes when you are working with responses, because each request will have a specific response the id is indicating this. This allows you to evaluate the data in a proper manner.
The set_seq_id is used to have unique seq_items. The get_seq_id allows you to check the corresponding id. This might be of interest when you are debugging your testbench and the corresponding sequences/seq_items.
In reply to chr_sue:
i set sequence id in sequence class but when i displayed get_seq_id from driver class then it display 1 it not displayed same as i set.
In reply to Henriques:
Driver class
`define DRIV_IF vif.DRIVER.driver_cb
class mem_driver extends uvm_driver #(mem_seq_item);
//---------------------------------------
// Virtual Interface
//---------------------------------------
virtual mem_if vif;
`uvm_component_utils(mem_driver)
//---------------------------------------
// Constructor
//---------------------------------------
function new (string name, uvm_component parent);
super.new(name, parent);
endfunction : new
//---------------------------------------
// build phase
//---------------------------------------
function void build_phase(uvm_phase phase);
super.build_phase(phase);
if(!uvm_config_db#(virtual mem_if)::get(this, “”, “vif”, vif))
`uvm_fatal(“NO_VIF”,{“virtual interface must be set for: “,get_full_name(),”.vif”});
endfunction: build_phase
//---------------------------------------
// run phase
//---------------------------------------
virtual task run_phase(uvm_phase phase);
forever begin
seq_item_port.get_next_item(req);
**$display("---------------",req.get_sequence_id);
** drive();
req.print();
seq_item_port.item_done();
end
endtask : run_phase
**sequence class
**//=========================================================================
class mem_sequence extends uvm_sequence#(mem_seq_item);
`uvm_object_utils(mem_sequence)
mem_seq_item re;
static int a;
//---------------------------------------
//Constructor
//---------------------------------------
function new(string name = “mem_sequence”);
super.new(name);
endfunction
`uvm_declare_p_sequencer(mem_sequencer)
//---------------------------------------
// create, randomize and send the item to driver
//---------------------------------------
virtual task body();
a= 14;
repeat(5) begin
req = mem_seq_item::type_id::create("req");
wait_for_grant();
**req.set_sequence_id(a);[b] //set sequence id
** req.randomize();
[/b] send_request(req);
wait_for_item_done();
end
endtask
endclass
In reply to Henriques:
You are mixing 2 things: there is an id for each sequence in your actual environmemnt and another one for each seq_item.