Re: More draft 4 errata (about constant functions)

From: Steven Sharp (sharp@cadence.com)
Date: Wed Feb 09 2000 - 10:30:06 PST


> Could I at least beg for a restriction that only localparams be allowed to
> be passed to or used in constant functions?

Why? It is an arbitrary restriction that does nothing to solve the problem.

> Using localparams
> would at least self-document the intent that the constant passed to the
> constant function cannot be redefined.

Since localparams can be redefined indirectly via parameters, I don't see
how using them documents an intent to do otherwise.
 
> Since a localparam can be assigned values based on parameters, I would
> suggest also adding a caveat to the effect "If the value of a localparam
> used by a constant function is affected by a parameter that is redefined,
> the return value of the constant function shall be indeterminate."

This just describes the same "fuzzy" restriction, with an extra complication
that it refers to localparams affected by parameters, instead of just to the
parameters themselves. Restricting to localparams has just made things more
confusing.

However, it may be a good idea to change the wording to state that the return
value of a constant function is indeterminate if it refers to a parameter
that is affected by a defparam. This would remove any implication that the
elaborator would point out the error to the user.

> This
> rule would put less burden on elaborators than checking to see if a
> defparam or # redefinition exists anywhere in the entire design structure.

Forbidding a defparam in this situation does not require the elaborator to
check for it. It just makes the unexpected behavior the fault of the user.
Your approach to describing the restriction has the advantage of making this
clearer.

Also, I don't think that # redefinition is a problem, as long as there is
not a defparam involved somewhere. In fact, allowing # redefinition is
important to some uses.
 
Sorry if my responses are not very sugar-coated. I was strongly opposed to
constant functions because of these kinds of problems. I was asked to come
up with "fixes" for the problems. I have very little patience with complaints
about the fixes, since the only clean fix was rejected: remove constant
functions from the standard.



This archive was generated by hypermail 2.1.4 : Mon Jul 08 2002 - 12:54:11 PDT and
sponsored by Boyd Technology, Inc.