Re: [sv-bc] Function in generate block

From: Greg Jaxon <Greg.Jaxon_at_.....>
Date: Wed May 25 2005 - 09:42:45 PDT
Just offering a personal opinion based on no research...
Take away the generate/endgenerate pair.
You're left with a block that declares a function and
then closes without calling it. In any classically
scoped language this makes the function identifier
undefined in the subsequent always block.

In V2K certain blocks inside generate vanished (i.e.
did not delimit new scopes) if they were controlled by
constructs that can be fully resolved at generate-time.

An outer begin/end probably vanishes in V2K, and should
not vanish under generate2005 rules.

Rakesh Gulati wrote:
> module test(clk,reset,a,b,c,x,y,z);
> 
> parameter SIZE = 4;
> input     clk;
> input     reset;
> input     [SIZE-1:0] a;
> input     [SIZE-1:0] b;
> input     [SIZE-1:0] c;
> output    [SIZE-1:0] x;
> output    [SIZE-1:0] y;
> output    [SIZE-1:0] z;
> reg       [SIZE-1:0] x;
> reg       [SIZE-1:0] y;
> reg       [SIZE-1:0] z
> generate
> begin
>  function [SIZE-1:0] output_assign;
>    input [SIZE-1:0] in;
>    output_assign = !in;
>  endfunction
> end
> endgenerate
> 
> always@(a or b or c)
> begin
>  x = output_assign(a);
>  y = output_assign(b);
>  z = output_assign(c);
> end
> 
> endmodule
> 
> 
> Function output_assign defined inside the generate block, but used 
> outside in procedural block.  Is this a  semantic error at the place of 
> function call in SV as the function is in unnamed block name space ? In 
> my opinion in V2k this is a pass case.
> 
> Rakesh
> 
> 
> 
> 
Received on Wed May 25 09:42:50 2005

This archive was generated by hypermail 2.1.8 : Wed May 25 2005 - 09:43:56 PDT