The null pointer de-reference error is caused as you have just declared the reg_model in the sequence but you don’t have the handle for it. You need to get the handle to the reg_model within your sequence.
You could do something like this.
// set configuration for register model (Usually after you are done building the model in sys env file)
uvm_config_db#(sys_reg_model)::set(null,“*”, “reg_model”, reg_model_instance);
// Get configuration in sequence
class seq extends …
// Class members
sys_reg_model reg_model_handle;
…
…
task body();
uvm_config_db#(sys_reg_model)::get( uvm_root::get(),get_name(), “reg_model”, reg_model_handle);
reg_model_handle.some_register.write(…
endtask
endclass
This should work.
- Sujith SH