Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

nios2 custom instruction

Altera_Forum
Honored Contributor II
919 Views

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
0 Kudos
0 Replies
Reply