UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

AR# 20431

8.2i XST - "ERROR:Xst:894 - "file.v" line xx:Unsupported recursivity."

Description

The coding below is not supported if "max" is a function:

c <= max(max(a,b), max(a,b));

Incorrect Example

module test(a, b, c, clk);

input [3 :0] a;

input clk;

input [3 :0] b;

output reg [3 :0] c;

parameter width_acc = 4 ;

always @(posedge clk)

begin

c <= max(max(a,b), max(a,b));

end

function [width_acc-1 : 0] max;

input [width_acc-1 : 0] a;

input [width_acc-1 : 0] b;

reg [width_acc-1 : 0] sub;

begin

sub = a -b;

if (!sub[width_acc - 1])

max = a;

else

max = b;

end

endfunction

endmodule

Solution

To work around this issue, add an intermediate signal as in the corrected code below:

Correct Example

module test(a, b, c, clk);

input [3:0] a;

input clk;

input [3:0] b;

output reg [3:0] c;

parameter width_acc = 4 ;

wire [3:0] max_ab ; // added

wire [3:0] max_cd ; // added

assign max_ab = max(a,b); // added

assign max_cd = max(a,b); // added

always @(posedge clk)

begin

c <= max(max_ab, max_cd); // changed

end

function [width_acc-1 : 0] max;

input [width_acc-1 : 0] a;

input [width_acc-1 : 0] b;

reg [width_acc-1 : 0] sub;

begin

sub = a -b;

if (!sub[width_acc - 1])

max = a;

else

max = b;

end

endfunction

endmodule

This is scheduled to be fixed with the release of ISE 9.2i.

AR# 20431
Date Created 11/30/2004
Last Updated 12/15/2012
Status Active
Type General Article