RE: [sv-cc] Re: [sv-bc] Need your review of Mantis item 1741

From: Jonathan Bromley <jonathan.bromley_at_.....>
Date: Sat Sep 08 2007 - 12:07:07 PDT
> >    begin
> >      begin : BLK
> >        var v = 1'b1;  // Is this decl contained in the unnamed begin?
> >      end
> >    end
>
> As discussed in
>     http://www.eda-stds.org/sv/sv-champions/hm/0189.html
> doesn't that unnamed block contain local variable 
> declarations? 

If it does, then surely it must become a scope - but that's
OK (albeit weird) because there's no 1364 compatibility issue.

The weirdness is extreme, though:

    initial begin : top
      begin
        begin : BLK
          var v = 1'b1;
        end : BLK
      end
      $display(BLK.v); // this is OK
    end : top

    initial begin : weird
      begin
        var w;  // introducing this makes a scope
        begin : BLK
          var v = 1'b1;
        end : BLK
      end
      $display(BLK.v); // bad reference
    end : weird

In "weird", the anonymous begin...end must be a scope,
because it contains "var w" - the ONLY difference between
it and "top".  So not only is BLK one scope further down
from the $display, it's also hidden inside the anonymous 
scope.  That sounds like a Gotcha! to me.
-- 
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd. Church Hatch, 22 Market Place, Ringwood, Hampshire, BH24 1AW, UK
Tel: +44 (0)1425 471223                   Email: jonathan.bromley@doulos.com
Fax: +44 (0)1425 471573                           Web: http://www.doulos.com

The contents of this message may contain personal views which 
are not the views of Doulos Ltd., unless specifically stated.

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sat Sep 8 12:07:27 2007

This archive was generated by hypermail 2.1.8 : Sat Sep 08 2007 - 12:07:37 PDT