Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
16737 Discussions

Quartus Prime20.1 can't compile systemverilog syntax

xxerexxaa
Beginner
1,698 Views

我在使用modsim编译成功并且成功仿真以后想使用quartus烧录至FPGA上发现许多类似于class 和数学函数的使用在quartus里无法编译。

我已经修改了quartus prime 20.1 的编译器为SystemVerilog但是还是无法编译class。请问有人遇到类似的情况吗?

据我所知可能是软件本身的问题,但是我的导师希望我最好还是使用quartus,所以请问有什么比较好的不改动代码的方案吗?

 

After compiling and simulating successfully with Modsim and trying to apply to FPGA with quartus, I found that ‘class’ and some maths functions cannot be compiled with quartus.

I have changed the compiler of quartus prime 20.1 to SystemVerilog but it still doesn't compile the classes. Has anyone else encountered a similar situation?

As far as I know it could be a problem with the software itself, but my tutor wants me to use quartus preferably, so is there a better solution that doesn't change the code?

Labels (1)
0 Kudos
10 Replies
sstrell
Honored Contributor III
1,682 Views

It might help to post the code and the exact errors you are getting.

0 Kudos
xxerexxaa
Beginner
1,639 Views

Here is my code:

class iTreeNode;
NodeType ntype;
class ExNode;
int size;

function new();
size = 0; // 设置默认值
endfunction

endclass
class InNode;
iTreeNode left;
iTreeNode right;
int splitAtt;
int splitValue;
function new();
splitAtt = 0; // 设置默认值
splitValue = 0; // 设置默认值
endfunction
endclass
ExNode exNode;
InNode inNode;
function new();
// 初始化联合体成员
exNode = new;
inNode = new;
ntype = EXTERNAL_NODE; // 设置默认值
endfunction
endclass

 

I use classes because I need nested definition. These codes can be compiled and run successfully in Modelsim. I guess maybe the Quartus dosent support the systemverilog in some aspects.

 

0 Kudos
FvM
Valued Contributor III
1,650 Views

Hi,

System Verilog synthesis support is specified in Quartus help. Section 8 Classes isn't supported at all.

Your math functions are possibly not synthesizable, e.g. ieee.math_real functions.

0 Kudos
xxerexxaa
Beginner
1,635 Views

请问有没有办法能让quartus获得支持或者使用能适配SystemVerilog的软件呢?

 

Is there any way to get support from quartus or to use other softwares that can be adapted to SystemVerilog?

 
 
 
 
 
 
 
 
 
 
 
 
0 Kudos
FvM
Valued Contributor III
1,626 Views
Hi,
I don't think it's a matter of the tool. Dynamic data and code definition can't be mapped to logic hardware. Nested (recursive) definitions can be used in generate constructs, but they are translated to parallel logic at compile time. If the recursion count isn't limited somehow, the construct isn't synthesizable.
ShengN_Intel
Employee
1,588 Views

Hi,


Check this link https://www.doulos.com/knowhow/systemverilog/systemverilog-tutorials/systemverilog-classes-tutorial/ and this link https://verificationguide.com/systemverilog/systemverilog-class/, SystemVerilog introduces classes as the foundation of the testbench automation language. That's why classes can be used in simulator but not in compiler tool like Quartus.


Thanks,

Best Regards,

Sheng


0 Kudos
xxerexxaa
Beginner
1,569 Views

Thank you!

Dose it mean that I have to change my code if I want to implement the algoritm to the FPGA? If yes, can recursive functions be used in the compiler tools?

0 Kudos
FvM
Valued Contributor III
1,552 Views
0 Kudos
ShengN_Intel
Employee
1,531 Views

Hi,


Yes, recursive functions can be used in the compiler tools. But just a heads up, if you use the recursive functions like the way below (example):

module factorial_fail (input [7:0] ip, output reg [7:0] we);


function automatic [7:0] factorial;

input [7:0] i_Num;

begin

if (i_Num == 1)

factorial = 1;

else factorial = i_Num * factorial(i_Num-1); end endfunction


always @ ip

begin we = factorial(ip); end


endmodule

You probably will get this Error(14408): Verilog HDL error at factorial_fail.sv(3): stack overflow on recursion via factorial, limit of 900 has exceeded 


So in order to pass the synthesis for recursive functions, have to implement the module with input values to the recursive function as follows:

module factorial (input [7:0] ip, output reg [7:0] we);


function [7:0] factorial1 (input [7:0] i_Num);

if (i_Num == 1)

factorial1 = 1;

else factorial1 = i_Num * factorial1(i_Num-1); endfunction


assign we = factorial1(8'd4);


endmodule


Thanks,

Best Regards,

Sheng


0 Kudos
ShengN_Intel
Employee
1,469 Views

Hi,


Any further concern on this thread?


Thanks,

Best Regards,

Sheng


0 Kudos
Reply