cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ross@bitbybitsp.com
Contributor
Contributor
357 Views
Registered: ‎02-22-2018

Vivado 2019.2 recursion bug: ERROR: [Synth 8-316] illegal module recursion detected

Is this the right place to post about Vivado Synthesis bugs? 

I've found that Vivado has a bug handling recursive code.  I've simplified it down to a simple test case, where some code sythesizes and identical code throws a synthesis error.  I say "identical" code because all the statements are exactly the same.  They're just given in a different order.  Apparently when Vivado 2019.2 handles recursion it matters what *order* System Verilog statements are given in.

This code synthesizes without errors in Vivado 2019.2:


`timescale 1ps / 1ps

`define w assign

module recursion_test_1
#(
parameter LEVEL = 2
)
(
output [31:0] y
);

generate
if(LEVEL==0)
begin
`w y = 0;
end
else
begin
wire [31:0] y_inner;
recursion_test_1 #(.LEVEL(LEVEL-1)) inner_rec_1 (.y(y_inner));
`w y = y_inner + 1;
end


if(LEVEL==2)
begin
initial $display("y at LEVEL %d is %d", LEVEL, y);
end
endgenerate

endmodule // recursion_test_1

This code does not synthesize in Vivado 2019.2 with an "illegal module recursion detected" error:

`timescale 1ps / 1ps

`define w assign

module recursion_test_2
#(
parameter LEVEL = 2
)
(
output [31:0] y
);

generate

if(LEVEL==2)
begin
initial $display("y at LEVEL %d is %d", LEVEL, y);
end

if(LEVEL==0)
begin
`w y = 0;
end
else
begin
wire [31:0] y_inner;
recursion_test_2 #(.LEVEL(LEVEL-1)) inner_rec_2 (.y(y_inner));
`w y = y_inner + 1;
end

endgenerate

endmodule // recursion_test_2

What's different about the two pieces of code is whether the "if(LEVEL==2)" block of code is before or after the "if(LEVEL==0)" block.  My best guess is that Vivado requires recursion to occur in the first conditional block in the first generate statement, or else it throws an indecipherable error.

It would be nice if this is fixed, or at least if the error message is changed to say it's a Vivado limitation rather than an error in the Verilog code, with perhaps a pointer to the correct documentation that describes how to implement recursion in a way that Vivado supports.

 

2 Replies
pulim
Xilinx Employee
Xilinx Employee
336 Views
Registered: ‎02-16-2014

Hi ross@bitbybitsp.com 

 

Thanks for reporting this issue. I am looking into this. will update you.

 

Regards,

Manusha

0 Kudos
pulim
Xilinx Employee
Xilinx Employee
224 Views
Registered: ‎02-16-2014

Hi ross@bitbybitsp.com 

I filed a CR to get this issue fixed in upcoming releases.

Thanks,

Manusha