Use of uvm_config_db# in sequence

Hello,
I am new to uvm so kindly apologize me if there is any mistake in my query

  1. Can we use uvm_config_db in sequence??
  2. how to change the config parameter value for different sequences say for example

// this is my config class
class my_config extends uvm_object;
`uvm_object_utils( my_config )
int a;

function new ( string name = "my_config" );
   super.new( name );
endfunction : new

endclass: my_config

// test class
class my_test extends uvm_test;
`uvm_component_utils(my_test)

my_config cfg;

virtual function void build_phase( uvm_phase phase );
    super.build_phase(phase);
    //this slice of code changes "a" value in configuration
    cfg = my_config::type_id::create( "cfg", this );
    cfg.a = 0;
    uvm_config_db#(my_config)::set( uvm_root::get(), "", "cfg" , cfg );
 endfunction

endclass

but the value of “a” has to be changed for different sequences

In reply to santhiya_R:

Hi,

you can not directly use uvm_config_db in seq but you have other way to do this using p_sequencer.

In reply to dhaval_sanepara:

Can you help me with how to use p_sequencer? and
The other question in which the variable “a” has to be changed for different sequences can you help me with that how to change?

In reply to santhiya_R:

Hi,

maybe this can help you :- p_sequencer m_sequencer diff(1) - EDA Playground (not mine).
if you want to accept or get variable from config db first you have to declare in seqr
like you have one int type variable than define int temp_var in seqr and get variable using config_db inside seqr , then inside seq you have to use p_sequncer.temp_var.

to change the config parameter value for different sequences say for example

→ to do this we have multiple ways like we can
1 >> extends sequence from base sequence and write constraints ,
2 >> using p_sequencer get config class and set vars ,
3 >> use parameter in sequence etc…

also read this :- P_sequencer and m_sequencer - UVM - Verification Academy

In reply to dhaval_sanepara:
Hi,
Thank you so much I will go through it