N
New to Verilog
Guest
Hi,
I have to write a module which has tons of parameters. So for
simplicity lets just focus on one paramter. Lets say the parameter
is called: NRCB_G. This parameter is a integer and it's valid values
are only 2, 4 or 8. In order to guarantee correct hook-up of the
module at the higher level (selection of the parameter) I would like
to embedd an assertion inside the module which checks the value given
to the parameter. This assertion should fire if the parameter is not
set to 2, 4 or 8.
I chose to use the assert_proposition assertion and this is how I use
it:
assert_proposition #(0, 0, "CONFIG_ERROR : Valid Values for NRCB_G parameter are : 2, 4 or 8")
NRCB_G_RANGE_CHECK (1'b1, NRCB_G == 2 || NRCB_G == 4 || NRCB_G == 8);
So in case i set the parameter to 2, 4 or 8 everything is fine, the
assertion keeps quite. Now when I chose a value outside the valid range,
the assertion still doesn't fire. So my question is, do i pick
the wrong assertion for these kind of checks, or in case this is the
appropriate assertion, am I using it the wrong way or is there another
switch/parameter I need to set inorder to enable the assertion ?
Thanks in advance for your response !!
I have to write a module which has tons of parameters. So for
simplicity lets just focus on one paramter. Lets say the parameter
is called: NRCB_G. This parameter is a integer and it's valid values
are only 2, 4 or 8. In order to guarantee correct hook-up of the
module at the higher level (selection of the parameter) I would like
to embedd an assertion inside the module which checks the value given
to the parameter. This assertion should fire if the parameter is not
set to 2, 4 or 8.
I chose to use the assert_proposition assertion and this is how I use
it:
assert_proposition #(0, 0, "CONFIG_ERROR : Valid Values for NRCB_G parameter are : 2, 4 or 8")
NRCB_G_RANGE_CHECK (1'b1, NRCB_G == 2 || NRCB_G == 4 || NRCB_G == 8);
So in case i set the parameter to 2, 4 or 8 everything is fine, the
assertion keeps quite. Now when I chose a value outside the valid range,
the assertion still doesn't fire. So my question is, do i pick
the wrong assertion for these kind of checks, or in case this is the
appropriate assertion, am I using it the wrong way or is there another
switch/parameter I need to set inorder to enable the assertion ?
Thanks in advance for your response !!