[sv-bc] Type comparisons in non-constant contexts (BNF)

From: Brad Pierce <Brad.Pierce_at_.....>
Date: Fri Jul 14 2006 - 00:09:52 PDT
As reported in
http://www.eda-stds.org/svdb/bug_view_page.php?bug_id=0001521 --

 

According to the BNF of A.8.3 and A.8.4, it's not possible to ask
whether (type(expr1) == type(expr2)) anywhere except where a
constant_expression is required. But the result of this comparison can
be determined at elaboration time regardless of the context. And there's
usually a clumsy workaround, namely, declaring a local parameter in the
current block and assigning it the result of the comparison.

I think that a type_reference, unlike a genvar_identifier, should not
just be a constant_primary, but also be a primary.  It would still be
subject to the restrictions of footnote A.10.29.

 

And it's not clear at all in the BNF anyway that a genvar_identifier
cannot be a primary, because syntactically it could sneak through as a
hierarchical_identifier, which is how enums and parameters become
primaries even though they, like genvars, are listed under
constant_primary.

 

The cleanest fix would be to remove constant_primary and replace
constant_expression with

 

          constant_expression ::= expression

 

plus a footnote pointing to the relevant text section.  For example, why
couldn't an inside_expression like (P inside {0,2,4,6}) be a
constant_expression if P were a parameter?  Yet, according to the BNF,
it can't.  And for that matter, why couldn't the new case-inside
construct be used with generate?  Yet, according to A.4.2, it can't.

 

Constantness is a semantic issue, not a syntactic one.

 

-- Brad

 

 
Received on Fri Jul 14 00:10:03 2006

This archive was generated by hypermail 2.1.8 : Fri Jul 14 2006 - 00:10:16 PDT