Re: [sv-bc] Typing of parameter assignments

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Mon Feb 06 2006 - 20:44:43 PST
Steven Sharp wrote:
>>From: Gordon Vreugdenhil <gordonv@model.com>
> 
> 
>>For example,  the following:
>>   parameter [7:0] p = 4'b1111 + 4'b0001;
>>yields 0 as the result rather than what one would get with
>>a "reg" declaration.  This treats the rhs as a self-determined
>>expression which normalizes the values/types that you would
>>get in this case versus a defparam or module instance overrride.
> 
> 
> Can you support this from the LRM text? 

Nope.   I couldn't really support the reverse either since
parameters aren't really discussed explicitly in terms of
the RHS values.  The case of untyped parameters is but
parameters aren't really covered; perhaps a sentence should
be added to the effect that for typed parameters, parameter defaults
and module instance parameter overrides are context determined in
the same manner as an assignment to a reg.

The reason this came up was with some testing done by someone
else who tested exactly the above in a couple of other
implementations and got the "self determined" answer.

I was surprised by this result which is why I brought this up.

> NC-Verilog gets the same answer as with a reg (though I think we may
> have originally gotten the result you describe, until we realized it
> was wrong and fixed it).
> 
> If the LHS has a width, then that should be used in the evaluation
> of the RHS.  It is an assignment, and unless you can find LRM text
> to say otherwise, it should follow the rules for assignments.


Ok (mostly).  Since module instance overrides are also in the
list of "assignment like contexts", the same should be true
for those, correct?

Now, since a "defparam" is not a normal assignment and is not
listed as an assignment like context, does this also imply
that a defparam does NOT behave in the same manner?  There is
no clear LRM statement about whether the RHS of a defparam
is context sensitive or not.  Or are you implying in your
last comment that a defparam is an assignment, just not an
"assignment like context" for the purposes of non-integral
parameters?


[...]
> 
> I think it is already normalized the other way, and does not have
> a two-mode nature.


Sounds good to me.

Gord.


> Steven Sharp
> sharp@cadence.com
> 

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Mon Feb 6 20:44:58 2006

This archive was generated by hypermail 2.1.8 : Mon Feb 06 2006 - 20:46:53 PST