Programmable Devices
CPLDs, FPGAs, SoC FPGAs, Configuration, and Transceivers
21593 Discussions

problem in cos funtion

Altera_Forum
Honored Contributor II
1,336 Views

sir/mam, 

i have used ieee math_real ,now 

k1 : bwlmulti port map (a1,f,q1); 

qout <= cos (q1); 

here shows an error that "cos can't have such operand in this context". plz help me out of problem.:cry:
0 Kudos
3 Replies
Altera_Forum
Honored Contributor II
440 Views

You cannot use the math_real package for synthesis. 

In addition, you cannot use real types for synthesis. 

 

They are only suitable for simulation.
0 Kudos
Altera_Forum
Honored Contributor II
440 Views

If I need tackle cos operation, how can I do it

0 Kudos
Altera_Forum
Honored Contributor II
440 Views

For a start, its best to use fixed point rather than floating point. 

There are two main methods for cos function: 

 

Use a lookup table. 

Use the CORDIC algorithm. There are many implementations of this. Or have a look here: 

http://en.wikipedia.org/wiki/cordic
0 Kudos
Reply