Hi ,
SystemVerilog allows function call from a constraint as well as covergroup expression .
I am trying following 2 codes :: (1) constraint_code (2) covergroup_code
LRM 18.5.12 says ::
- Functions that appear in constraint expressions should be automatic (or preserve no state information) and have no side effects.
- Function calls in active constraints are executed an unspecified number of times (at least once) in an unspecified order.
LRM 19.5 says ::
- Functions shall be automatic (or preserve no state information) and have no side effects .
- Functions shall not reference non-constant variables outside the local scope of the function
So via (1) and (3) , it’s illegal to define static variable within the function and assign it from it ( in both codes )
I have following queries ::
(A) Via (2) the order of display within the function called in constraint isn’t defined as per LRM .
**Is the order defined for function called from covergroup expression ?**
Currently I observe **' item ' is passed in incremental order from min to max value . Does the LRM guarantee this order ?**
(B) Is it legal to access the queue from the function in both code ?
The queue would be assigned by user and then used within the function based on user-defined implementation in both codes.
(C) For covergroups apart from with expression , SV facilitates function call from coverpoint expression .
**Can function be called using any other way ?**
Thanks .