Forum Discussion

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

nios2 custom instruction

Hi,

I know that Nios2 provides custom instruction to implement user functionality. I'd like to know how to use custom instructions with more than 2 inputs. I understand that I can use internal register file. Let's say I want to implement a custom instruction with 4 inputs and 2 outputs. Register r2, r3, r5 and r6 are inputs, and Register r1 and r4 are outputs. How can I write the assembly code? Is the following correct?

mov c1, r2 (copy to internal register)

mov c2, r5 (copy to internal register)

custom 1, r1, r3, r6 (result is r1 and the other internal register, say c3)

mov r4, c3

Regards,

Tim
No RepliesBe the first to reply