Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
16 years ago

Use of megafunctions

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

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

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