Re: [sv-bc] Is an unnamed block with declarations a scope?

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Thu Aug 11 2005 - 11:08:16 PDT
Mac,

Your response, and in particular:

   >   Always @( posedge k ) begin
   >      R = b.c;  // legal in 1364, not in P1800
   >   End

presumes an answer to the issue I raised.


Do you believe that a unnamed block *always* introduces a true
scope in P1800?  I've certainly been operating under the
assumption that unnamed blocks should not create a real scope
if there are no block_item_declaration items due to the backwards
compatibility issue that your example (and mine) raise.

The three options I see are:
   1) unnamed block is always a real scope
   2) unnamed block is a real scope iff the block_item_declaration
      list is empty
   3) unnamed block is only a real scope for block_item_declaration
      list elements (i.e. other labels go into the nearest upwards
      named scope).

(1) is the only choice that breaks 1364 compatibility which
is why I was assuming that (1) was not the intent.  This
leaves me with either (2) or (3).  While both of those have
issues, I think that (2) is a cleaner rule with more
obvious effects and interactions.

Gord.




Michael McNamara wrote:

> Unnamed blocks were reportedly introduced soley in order to allow creation of "hidden" variables (they can not be referenced hierarchically). As I stated before, this is an overly cumbersome way to get this effect.  Much better would be introducing a qualifier like static or scalared as part of the variable declaration.
> 
> That would allow hidden variables at module scope.
> 
> That would allow declaring together three variables that are related, while hiding one of them from external influence.
> 
> As it stands today, one can not refer hierarchially to scopes created under an unnamed block.
> 
> Does this apply to unnamed blocks that do NOT contain a declaration?
> 
> EG:
> 
> Module a;
>   Integer R;
>   Always @( posedge k ) begin
>      R = b.c;  // legal in 1364, not in P1800
>   End
> 
>   Always @(negedge k)  begin
>      Begin : b
>        Integer c;
>        C = $random;
>       
>     End
>   End
> Endmodule
> 
>  -----Original Message-----
> From: 	Brad Pierce [mailto:Brad.Pierce@synopsys.com]
> Sent:	Thu Aug 11 09:00:18 2005
> To:	sv-bc@eda.org
> Subject:	Re: [sv-bc] Is an unnamed block with declarations a scope?
> 
> Most programming languages don't even have named blocks.  If designers
> want to declare their variables in the local scope that uses them,
> instead of declaring global variables, why would you force them to make
> up block names?
> 
> -- Brad
> 
> 
>>I go back to my point that we should remove unnamed blocks.  
>>They add no value and only break things; and as you point out the 
>>problem is even worse than first surmised.
> 
> 
> 
> 
> 
> 
> 
> 

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil                                503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Thu Aug 11 11:08:19 2005

This archive was generated by hypermail 2.1.8 : Thu Aug 11 2005 - 11:08:26 PDT