Forum Discussion
Altera_Forum
Honored Contributor
15 years agoCombining Assembly and C
Hi, I am very new to Hardware Programming, and I am using the NIOS II processor to identify the frequency of a sound that is input into the DE1 Board. My question is, is it possible to combine...
Altera_Forum
Honored Contributor
15 years agoUsually such operations can be done in C.
For actual assembler either write an assembler source file containing C callable code (I think the Altera makefile will put a .S file through cpp and then gas), or use the gcc 'asm' statement to include the required instructions - these will tie C variables to registers as required. There should be some exampler lurking in the .h files or more generally on the web. NB: if you access any memory locations that C variables also access, then add a "memory" qualifier to the asm statement - otherwise gcc might optimise out the C code.