Forum Discussion

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

Help in CRC custom instructions please.

Hello,

I am a new bie in the custom instruction development for Altera and was looking into the way the CRC method is implemented as

per the link altera.com/support/examples/nios2/exm-custom-instruction.html

I see the main C file which calls the custom instruction as crc_main.c and the custom instruction is crcCI.

That function is defined in the file ci_crc.c. In that function, the macro CRC_CI_MACRO is called with the arguments.

The macro is defined in the same file as:# define CRC_CI_MACRO(n, A) __builtin_custom_ini(ALT_CI_CRC_INST_N + (n & 0x7), (A))

The macro is being assigned to a built in gnu gcc custom function (if my understanding is correct).

My questions are as follows:

Where can I see the gnu built in custom function (I mean, in which file). It should expand like a driver level function I guess.

And where is the macro ALT_CI_CRC_INST_N being defined?

If all the custom gnu gcc functions are in-built, then how is it really a custom instruction?

I am struck at this point of thought, please give me some pointers. That would be a huge help.

29 Replies