Jump to content

how to overwrite the constraint that's present in another file.?


Recommended Posts

Here is a sample code of what I'm working on

 

class c_cfg extends uvm_object;
	rand bit c_bit;
	
	constraint c_turnoff {
		c_bit == 1'b0;
	}
	...........

endclass: c_cfg

2nd file

 

class b_cfg extends uvm_object;

	rand c_cfg	cfg_c;
	........
	........

endclass: b_cfg

main file

class a_cfg extends b_cfg;

// I want to overwrite the constraint in c_cfg here.
// I want that to be 1

endclass: a_cfg

I tried overwriting the constraint in c_cfg by using the same constraint name in a_cfg, but it doesn't solve (I guess it is because in c_cfg and not in b_cfg) simulator is not able to solve the constraint. Then tried cfg_c.c_turnoff.constraint_mode(0); in the new function in a_cfg, but it still considers the constraint in c_cfg.

Can someone suggest how to do that.

Thanks

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...