Re: [sv-bc] Function in generate block

From: Gordon Vreugdenhil <gordonv_at_.....>
Date: Tue May 24 2005 - 22:56:19 PDT
Rakesh,

This entire area is defined very, very poorly in 1364-2001.
There are all sorts of issues with the spec as written in
1364-2001.  I generally agree with your view in this specific
case, but I would strongly recommend that people not try to
conform to the 2001 spec as written but rather actively
encourage moving to the 2005 spec since naming issues are
well defined.

Gord.

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
> 
> 

-- 
--------------------------------------------------------------------
Gordon Vreugdenhil,  Staff Engineer               503-685-0808
Model Technology (Mentor Graphics)                gordonv@model.com
Received on Tue May 24 22:56:22 2005

This archive was generated by hypermail 2.1.8 : Tue May 24 2005 - 22:56:26 PDT