Saving and adding the custom instruction, Accessing the custom instruction from software, Accessing the custom instruction from software –5 – Altera Nios II Custom User Manual

Page 35

Advertising
background image

Chapter 4: Implementing a Nios II Custom Instruction in Qsys

4–5

Accessing the Custom Instruction from Software

January 2011

Altera Corporation

Nios II Custom Instruction User Guide

5. Leave the Group field blank.

6. Optionally, set the Description, Created by, and Icon fields as you prefer.

7. If the bottom pane of the dialog box displays something other than the message

Info: No errors or warnings

, review the other tabs to ensure you followed the

instructions correctly.

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. The new custom instruction appears in the Qsys Component

Library.

3. In the Qsys Component Library, under Library, select CRC, the new custom

instruction you created in the design example.

4. Click Add to add the new instruction to the Qsys system.

5. In the Connections panel, connect the new CRC_0 component’s

nios_custom_instruction_slave

interface to the cpu component’s

custom_instruction_master

interface.

Generating the System and Compiling in the Quartus II Software

After you add the custom instruction logic to the system, you can generate the Qsys
system and compile it in the Quartus II software.

To generate the system and compile, follow these steps:

1. In Qsys, on the Generation tab, turn on Create HDL design files for synthesis.

2. Click Generate. System generation may take several seconds to complete.

3. After system generation completes, on the File menu, click Exit.

4. In the Quartus II software, on the Project menu, click Add/Remove Files in

Project

.

5. Ensure that the .qip file in the synthesis subdirectory is added to the project.

6. On the Processing menu, click Start Compilation.

f

For detailed information about Qsys systems and their generation, refer to the

System

Design with Qsys

section in volume 1 of the Quartus II Handbook.

Accessing the Custom Instruction from Software

Adding a custom instruction to a Nios II processor results in a significant change to
the Qsys system. In this section, you create and build a new software project using the
Nios II software build flow, and run the software that accesses the custom instruction.
The software source files are included in the downloadable design files.

Advertising