Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Use of megafunctions

Altera_Forum
Honored Contributor II
1,200 Views

Hello everyone, 

 

I am a beginner in Quartus. I am trying to use the square root megafunction in Quartus. What I am doing is I have instantiated it : 

 

mysqrt_alt_restoring_sqrt_cta mysqrt(.aclr(clear),.clken(clkenable),.clock(CLOCK_50),.rad(vz),.root_result(sqroot)); 

 

 

However, it gives me an error : 

 

"mysqrt"; expecting "<=", or "=" 

 

So, I assumed that may be I need to assign the value returned by this function to some other 

 

so i assigned the return value to x 

x= mysqrt_alt_restoring_sqrt_cta mysqrt(.aclr(clear),.clken(clkenable),.clock(CLOCK_50),.rad(vz),.root_result(sqroot)); 

 

But then it still shows the error as: 

near text "mysqrt"; expecting ";" 

 

I am confused. One more thing is that I need to use the square root function for integers . 

 

Could you guys please help me out. Could you please tell me the way the megafunction needs to be defined?:( 

 

Thanks a lot in advance.  

 

regards, 

Sim
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
550 Views

I guess it's a confusion of instance and component name. I suggest to use the MegaWizard generated instantiation template for a syntactical correct module instantiation example. Also the Verilog templates in Quartus editor should help to learn the correct syntax. 

 

Generally, I think it's better to consult a Verilog text book for first HDL programming steps instead of using a trial and error method.
0 Kudos
Altera_Forum
Honored Contributor II
550 Views

Thanks a lot for your reply. I will try it and go through some book and let you guys know. Thanks again.

0 Kudos
Reply