Hi,
I am writing a constraint, inside which I am using config variable (there are variables inside my config class), but there is runtime error that
Error-[CNST-NPE] Constraint null pointer error
Accessing null pointer config in constraint.
Please make sure config is allocated.
I want to understand that which UVM phase does constraint solver activity. (I am supposing it’s run phase & config class variable must be built in Build Phase)
If I am able to use config class variable inside task body of sequence, why I am not able to use it inside constraint block of sequence ?
It’s not compile time error, it’s run time error for me.
Please help with understanding and proper solution.
Regards,
Kavish
In reply to shahkavish77:
The constraint solver is governed by a call to randomize(), which is not tied to any phase. And a null reference can only be checked at run time.
You need to make sure you retrieve a handle to your config object before the call to randomize().
In reply to dave_59:
typedef class a_adma_col1;
typde_f class a_adma_col2;
class A_test uvm_test;
...
...
a_dma_col1 col1;
a_dma_col2 col2;
...
...
function void build (uvm_phase phase );
super.build_phase(phase);
col1 = a_dma_col1::type_id::create("a_dma_col1");
col1 = a_dma_col1::type_id::create("a_dma_col1");
endfunction
task run_phase (uvm_phase phase);
phase.raise_objections (this, "", 1 );
super.run_phase(phase);
col1.start(env.vsqr);
col2.start(env.vsqr);
phase.drop_objection(this, "", 1);
endtask
..
endclass
class a_dma_col1 extenda a_dma;
...
...
`uvm_declare_p_sequencer(`A_SEQUENCER);
constraint c1 {col > 2}
...
...
...
task body ();
if (!this.randomize() begin
`uvm_fatal ("FATAL");
end
endtask
endclass
class a_dma_col2 extenda a_dma;
...
...
`uvm_declare_p_sequencer(`A_SEQUENCER);
...
...
...
constraint c1 {col1 > 3};
task body ();
if (!this.randomize() begin
`uvm_fatal ("FATAL");
end_
endtask
endclass
Hi Dave,
Here is my pseudo code above looks like the body when i call start method of the sequence from the test i don’t see a_dma sequence body getting executed
any pointer on what could be the issue ?