Quantcast
Channel: UVM Forums RSS Feed
Viewing all articles
Browse latest Browse all 756

receiving null pointer error when accessing config object from uvm_do_with

$
0
0

Hi,

 

i have an agent (uvm_agent) which has a config object (uvm_object) which holds the agent's configurations.

i am setting this config from the environment and getting it inside the agent.

in the agent i am setting this config for everyone to see (*).

 

i have a sequence for this object that get's this config object.

everything works ok so far and i am able to access all the configurations from the config object inside the sequence.

the problem starts when i try to create constrained transactions (`uvm_do_with) with the constraints taken from this config object.

then i get a null pointer error.

 

the error:

 
Error-[CNST-NPE] Constraint null pointer error
/space/users/assafg/nu4000/verification/iae/ciif_agent/ciif_sequence.sv, 194
  Accessing null pointer cfg.frame_width in constraints.
  Please make sure variable cfg.frame_width is allocated.
 

so i can access a certain field from the sequence but when i try to set it as a constraint i get an error.

 

some code from the sequence (this is only part of the code):

 

    virtual task pre_start();
        // Get the configuration
        if (!uvm_config_db #(ciif_cfg)::get(get_sequencer(), "", "cfg", cfg)) begin
            `uvm_fatal("CFGERR", "%m cfg not set")
        end
    endtask: pre_start
 
 
    virtual task body();
        `uvm_info("DEBUG_DEBUG", $sformatf("cfg.frame_width = %0d\n", cfg.frame_width), UVM_NONE);                 // print occurs and proves that i can access this field
       
        `uvm_do_with(req, {
                                            fwidth  == cfg.frame_width;             // error here
                                       }
                               );
    endtask: body
 
 
any idea would be much appreciated.
 
Thanks,
Assaf
 

 

 

 


Viewing all articles
Browse latest Browse all 756

Trending Articles