Re: [sv-bc] Generate with multiple begins

From: Brad Pierce <brad_pierce@acm.org>
Date: Sun Jan 09 2011 - 20:43:58 PST

Verilog-2005 prohibits standalone generate begin-end blocks, regardless of
whether they are nested. It is definitely not an oversight in the BNF. The
restrictions were added on purpose to Verilog-2005.

I can well believe that some simulators are still not enforcing the generate
restrictions of the Verilog-2005 standard, upon which SystemVerilog-2005
depends, and which was merged into Verilog-2009. But that is an issue to
take up with the simulator vendors. The LRM is clear.

My advice is to stay strictly within the Verilog-2005 LRM, regardless of
what some simulators still allow.

-- Brad

On Sun, Jan 9, 2011 at 6:24 PM, Wilson Snyder <wsnyder@wsnyder.org> wrote:

>
> Hello all,
>
> I have a user that sent me the following case which seems to
> work on several simulators, but I don't see that nested
> begin/ends are legal in generates according to the 2009
> grammar. Is this an oversight in the grammar, or intended
> to fail? Can someone clarify please? Thanks!
>
> module t;
> generate
> if (1) begin : g1
> begin : g2
> initial $display("Hello");
> end
> begin : g3
> initial $display("World");
> end
> end
> endgenerate
> endmodule
>
> My reading of the grammar is thus:
>
> loop_generate_construct ::=
> FOR '(' ... ')' generate_block
>
> generate_block ::=
> generate_item
> | [ generate_block_identifier ':' ] BEGIN [ ':'
> generate_block_identifier ]
> { generate_item }
> yEND [ ':' generate_block_identifier ]
>
> generate_item ::=
> module_or_generate_item
> | interface_or_generate_item
> | checker_or_generate_item
>
> None of these three _item's have a path back to
> generate_block without hitting another generate
> if/case/for.
>
> Looking at it from the bottom up, the only relevant rules which use the
> begin/end keywords are seq_block and generate_block.
>
> generate_block called from
> loop_generate_construct,
> if_generate_construct,
> case_generate_item
>
> seq_block called from
> statement_item
>
> We're not in a statement, so begin must be preceeded by
> loop/if/case; there's no direct path from generate_item
> (etc).
>
> Thanks
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
Received on Sun Jan 9 20:44:21 2011

This archive was generated by hypermail 2.1.8 : Sun Jan 09 2011 - 20:44:28 PST