assafgedalia Posted January 7, 2016 Report Share Posted January 7, 2016 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 Quote Link to comment Share on other sites More sharing options...
apfitch Posted January 7, 2016 Report Share Posted January 7, 2016 One possible problem is that there is a member in instance req which is also called cfg. If that's the case, then using local:: should help `uvm_do_with(req, { fwidth == local::cfg.frame_width; } ); Another possibility is that the cfg object is being cloned for some reason and you haven't implemented do_copy() correctly. In that case you'd just have to implement do_copy in the config object. regards Alan Quote Link to comment Share on other sites More sharing options...
assafgedalia Posted January 7, 2016 Author Report Share Posted January 7, 2016 Alan you are the man! there was a rogue cfg in the transaction i created, and now i understand that the scope of the constraint is the scope of the new transaction and in the scope of the newly created transaction the cfg has not been declared yet. many thanks, Assaf Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.