Re: [sv-bc] non local function can be used as constant function?

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Wed Mar 14 2007 - 06:45:39 PDT
P1800-2005, 6.3.5 lists the following:

    A static constant declared with the const keyword can be set to an
    expression of literals, parameters, local parameters, genvars,
    enumerated names, a constant function of these, or other constants.
    Hierarchical names are allowed because constants declared with the
    const keyword are calculated after elaboration.

By this definition, your example is not legal since "constant function"
explicitly excludes heirarchical references.  The "heirarchical
names" would, I think, only apply to non-function names.  Strictly
speaking, a constant couldn't even be defined in terms of another
static constant since that isn't listed.

That said, I think the paragraph is too restrictive.  There is
no design consistency issues that arise when you allow arbitrary
expressions (as there would be for parameters).  I think that
SV should clean this up to make this a "non-assignable variable"
and allow any initialization expression.

As a side note, in 1364, "constant" essentially means "a value that
is legal for a parameter".  SV has broadened "constant" to include
values that are  not legal as the value of a parameter.

I am beginning to see a fair amount of user confusion about the
two kinds of "constant" expressions.  Perhaps the traditional
1364 term should change to "elaboration constant" or perhaps
"parametric".

Gord.

Dhiraj Kumar Prasad wrote:
> Hi,
> 
> can you tell me that a non local function i.e function is defined
> in some module and used in other module, can be used as constant
> function i.e like this
> const shortint myConst2 = botMod.myFunc(3,2);
> where myFunc is defined in a module named botMod.
> 
> Thanks,
> Dhiraj
> 
> 
> 

-- 
--------------------------------------------------------------------
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 Wed Mar 14 06:46:04 2007

This archive was generated by hypermail 2.1.8 : Wed Mar 14 2007 - 06:46:31 PDT