How do I constrain data within hierarchy at test level?

In reply to Dragewood:

As, I understand from your query you wanted to good/default constraints as it is and try to use some variation in constraints when it needed.

You can also achieve your objective by below way.


rand bit [15:0] value;

constraint value_c {
  // Declare string type variable inside top_cfg
  // Overwrite by command line using $value$plusargs.
  if(top_cfg.constraints == "DEFAULT") {
     value inside {[0:200]};
  } else {
     // What ever you want.
  }
}

Thanks,
Harsh