Which sv syntax support constraint can pass in arguement?

Dear all,
I saw that in OVM constraints can pass in argument.
such as {tran==1’b0}…;
How sv support that?
Thank you!

Hi Ahan,

Here is an example (working with Questa, not tested using IUS) :

**function**void build();
    **string**result;
    **string**verbosity_level_s;

    **if**($value$plusargs("OVM_VERBOSITY_LEVEL=%s",verbosity_level_s)) **begin**
        **case**(verbosity_level_s)
            "OVM_NONE"   : verbosity_level = OVM_NONE;
            "OVM_LOW"    : verbosity_level = OVM_LOW;
            "OVM_MEDIUM" : verbosity_level = OVM_MEDIUM;
            "OVM_HIGH"   : verbosity_level = OVM_HIGH;
            "OVM_FULL"   : verbosity_level = OVM_FULL;
            "OVM_DEBUG"  : verbosity_level = OVM_DEBUG;
            **default**      : verbosity_level = OVM_MEDIUM;
        **endcase**
    **end**
    set_config_int("*", "verbosity_level", verbosity_level);
    **super**.build();
**endfunction**

You can also have a see at $value$plusargs system task in the IEEE STD 1364 datasheet.

Also here : http://www.project-veripage.com/plusarg.php

Hope this help,

Regards

Hi Ahan,

Dear all,
I saw that in OVM constraints can pass in argument.
such as {tran==1’b0}…;
How sv support that?
Thank you!

This works in `ovm_do macro because the macro code expands into “obj.randomize with CONSTRAINT”. This is the reason ovm_do and it’s variants are macros because you can’t pass constraints as an argument to a task or a function.

Umer