Forum Discussion

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

problem in cos funtion

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:

3 Replies

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

    You cannot use the math_real package for synthesis.

    In addition, you cannot use real types for synthesis.

    They are only suitable for simulation.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    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