Forum Discussion

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

Nios Ii Standard C Function For Resolver Input

Just wondering if anybody has an idea about the following NIOS II codes:

static inline int sinus(int a)

{

return ALT_CI_COSIN_INST(0,a,0);

}

static inline int cosinus(int a)

{

return ALT_CI_COSIN_INST(1,a,0);

}

What do the above functions return? Kindly let me know if you have an idea.

2 Replies

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

    They look like calls to a custom instruction to calculate sine and cosine values.

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

    Yeah look pretty much like sine and cosine calculation.

    I use similar CI.

    Try using the CI with

    y = sinus(int a) a=(0..65535) y=(+32767...-32768)

    y = cosinus(int a) a=(0..65535) y=(+32767...-32768)

    Meaning a=(0..65535) = (0*pi .. 2*pi) and y = (+32767...-32768) = (+0.9999999 ... -1.0)