Re: [sv-bc] Hierarchical references in #(...) instantiations and $bits() constant function calls (1224 and 2856)

From: Gordon Vreugdenhil <gordonv@model.com>
Date: Thu Mar 24 2011 - 13:01:08 PDT

Note that for $typename, the following explicit restriction applies:
     When used as an elaboration time constant, the expression shall not
     contain any hierarchical references or references to elements of
     dynamic objects.

That restriction should likely apply to all query systfs.

Note as well that there are some other very strange situations that
can expose these issues as well.

       foreach (a.b.c[i]) begin:blk
           reg [$bits(i):0] some_reg;
           type(i) some_other_reg;
       end

Such a block also relies on type and queries functions on
hierarchical names, but indirectly through the induction
variable. Even the $typename restriction wouldn't directly
restrict it unless you apply some transitivity to the reasoning.

Gord.

On 3/24/2011 11:06 AM, Brad Pierce wrote:
> According to the comments on http://www.eda.org/svdb/view.php?id=1224 , hierarchical references are allowed in the parameter value assignments in module instantiations, hence the use of param_expression instead of constant_param_expression in A.4.1.1 .
>
> In http://www.eda.org/svdb/view.php?id=2856 , Françoise gives an example of the dangers of allowing hierarchical references in $bits() constant function calls. I think the following is equivalent
>
> module top;
> child #($bits(inst.v)-1) inst();
> endmodule
>
> module child #(P = 32);
> bit v[P];
> endmodule
>
> or simply
>
> module top;
> child #(inst.P-1) inst();
> endmodule
>
> module child #(P = 32);
> bit v[P];
> endmodule
>
> If hierarchical references are legal within the #(), yet the final example is illegal, then maybe whichever rule makes it illegal could be applied to the $bits() call in Françoise's example.
>
> -- Brad
>
>
>

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Thu Mar 24 13:01:44 2011

This archive was generated by hypermail 2.1.8 : Thu Mar 24 2011 - 13:01:52 PDT