Saving and adding the custom instruction – Altera Nios II Custom User Manual
Page 27

Chapter 3: Implementing a Nios II Custom Instruction in SOPC Builder
3–5
Implementing Custom Instruction Hardware in SOPC Builder
January 2011
Altera Corporation
Nios II Custom Instruction User Guide
Saving and Adding the Custom Instruction
To save the custom instruction and add it to your Nios II processor, follow these steps:
1. Click Finish. A dialog box prompts you to save your changes before exiting.
2. Click Yes, Save. In the Nios II processor parameter editor, on the Custom
Instructions
tab, the new custom instruction appears in the left panel.
3. If the new custom instruction does not appear on the Custom Instructions tab in
the left panel, follow these steps:
a. Click Finish to exit the Nios II processor parameter editor.
b. On the SOPC Builder System Contents tab, double-click cpu to reopen the
Nios II parameter editor.
4. In the left panel of the Custom Instructions tab, select CRC, the new custom
instruction you created in the design example.
5. Click Add to add the new instruction to the Nios II processor. Information about
the new instruction appears in the right panel, listing the name, Clock Cycles
value, N Port information, and Opcode Extension.
If the custom instruction is an extended type instruction, the N Port field specifies
the function select bits in the
N
port. Otherwise, the N Port field contains a dash.
The Opcode Extension field displays the custom instruction index (
N
field) of the
instruction word in both binary and decimal formats. For more information about
the
N
field, refer to
“Custom Instruction Assembly Software Interface” on
.
6. Click Finish to complete the addition of the custom instruction to the SOPC
Builder system and return to SOPC Builder.
Generating the System and Compiling in the Quartus II Software
After you add the custom instruction logic to the system, you can generate the system
and compile it in the Quartus II software. During system generation, SOPC Builder
connects the custom logic to the Nios II processor.
To generate the system and compile, follow these steps:
1. In SOPC Builder, on the System Generation tab, turn on Simulation. Create
project simulator files
if you want to simulate your system.
2. Click Generate. System generation may take several seconds to complete.
3. After system generation completes, click Exit.
4. In the Quartus II software, on the Processing menu, click Start Compilation.
f
For detailed information about SOPC Builder systems and their generation, refer to
the
or the SOPC Builder Help system.