Page 1
Nios II System Architect Design Tutorial Nios II System Architect Design Tutorial 101 Innovation Drive San Jose, CA 95134 www.altera.com TU-01004-2.0 Document last updated for Altera Complete Design S...
Page 2
© 2011 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, HARDCOPY, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are trademarks of Altera Corporation and registered in the U....
Page 3
Contents Chapter 1. Getting Started Hardware and Software Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1–1 Acquire the NEEK . ...
Page 4
iv Contents Additional Information Taking the Next Step . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Info–1 Docum...
Page 5
1. Getting Started This tutorial teaches you how to use the Quartus® II software and the Nios® II Embedded Design Suite (EDS) to implement a digital picture viewer in a Cyclone III FPGA. In this tutor...
Page 6
1–2 Chapter 1: Getting Started Hardware and Software Requirements Install the USB Device Driver After the software is installed, you can connect the NEEK board to the USB port on your PC. If the softw...
Page 7
2. Designing the System To architect a system, you specify the design requirements and develop a suitable design strategy to address each requirement. Design requirements include immediate design goal...
Page 8
2–2 Chapter 2: Designing the System Design Flow Design Flow Figure 2–1 depicts the typical flow for embedded system design. Figure 2–1. System Design Flow Using Qsys In Qsys Define System Select Compo...
Page 9
Chapter 2: Designing the System 2–3 Design Requirements In this tutorial you perform the following steps: 1. Build a Qsys system: a. Open the Quartus II project. b. Start Qsys. c. Select and configure...
Page 10
2–4 Chapter 2: Designing the System Design Strategy Design Strategy Qsys provides standard hardware components that you can add to your system. You can add several instances of each component. The onl...
Page 11
Chapter 2: Designing the System 2–5 Design Strategy Table 2–1 shows how the individual design requirements for this project are implemented by specific design strategies, which in turn dictate the com...
Page 12
2–6 Chapter 2: Designing the System Block Diagram Block Diagram Figure 2–2 shows a high-level block diagram of the system you develop to implement the design. Figure 2–2. High-Level Block Diagram of D...
Page 13
3. Building the Qsys System In this chapter, you add components to the system, make connections where required, assign the clocks, set arbitration priorities, and generate the system. The tutorial com...
Page 14
3–2 Chapter 3: Building the Qsys System Specify Qsys System Components Specify Qsys System Components Table 3–1 shows the components of the completed design, including components in the subsystems. Ta...
Page 15
Chapter 3: Building the Qsys System 3–3 Specify Qsys System Components This section shows you how to perform the following actions: 1. Add a Nios II Processor to Your System. 2. Add a DDR SDRAM Contro...
Page 16
3–4 Chapter 3: Building the Qsys System Specify Qsys System Components 2. Select the Nios II/f processor. Figure 3–1 shows the Nios II Processor parameter editor after you select the Nios II/f core. F...
Page 17
Chapter 3: Building the Qsys System 3–5 Specify Qsys System Components Figure 3–2 shows the connection panel with the data_master port of cpu correctly connected. Figure 3–2. Qsys Connection Panel Add...
Page 18
3–6 Chapter 3: Building the Qsys System Specify Qsys System Components Figure 3–3 shows the Memory Settings tab after you assign these settings. Figure 3–3. Memory Settings for DDR SDRAM Controller wi...
Page 19
Chapter 3: Building the Qsys System 3–7 Specify Qsys System Components 7. In the Export column, click Click to export and set the following ddr_sdram signal rows to the following names: For external_c...
Page 20
3–8 Chapter 3: Building the Qsys System Specify Qsys System Components Figure 3–5 shows the component with the Intel 128P30 preset parameter settings. Figure 3–5. Flash Controller 4. Click Finish. 5. ...
Page 21
Chapter 3: Building the Qsys System 3–9 Complete the System Add a Video Subsystem The video subsystem consists of the video pipeline components. To add a video subsystem to your system, perform the fo...
Page 22
3–10 Chapter 3: Building the Qsys System Complete the System 5. Specify the Nios II Processor Boot Configuration. Specify the External Clocks and Clock Connections In this section, you connect each co...
Page 23
Chapter 3: Building the Qsys System 3–11 Complete the System 2. Select the desired clock name according to Table 3–2. Table 3–2 lists the clocks for the different component ports. For each clock, comp...
Page 24
3–12 Chapter 3: Building the Qsys System Complete the System 2. Reassign the following base addresses to the Avalon Memory-Mapped (Avalon-MM) slave ports of the following components: For the jtag_debu...
Page 25
Chapter 3: Building the Qsys System 3–13 Complete the System Table 3–3. Interrupt Priority Assignments (Part 2 of 2) Component Port Interrupt Priority Value peripheral_subsystem touch_panel_pen_irq_n ...
Page 26
3–14 Chapter 3: Building the Qsys System Complete the System Figure 3–11 shows the arbitration values after you make the assignments. Figure 3–11. Arbitration Priorities in Digital Picture Viewer Qsys...
Page 27
Chapter 3: Building the Qsys System 3–15 Complete the System 5. In the Exception Vector Offset box, type 0x20. Figure 3–12 shows the Nios II Processor parameter editor after you perform these steps. F...
Page 28
3–16 Chapter 3: Building the Qsys System Generate the System Figure 3–13 shows the finalized Qsys system. Figure 3–13. Final Digital Picture Viewer Qsys System Generate the System After you verify tha...
Page 29
Chapter 3: Building the Qsys System 3–17 Generate the System 1. On the Generation tab, click the Generate button. The Generate dialog box appears, displaying generation messages as generation proceeds...
Page 30
3–18 Chapter 3: Building the Qsys System Generate the System Nios II System Architect Design June 2011 Altera Corporation Tutorial
Page 31
4. Completing the Quartus II Project In this chapter, you complete the Quartus II project by adding the top-level HDL file, which instantiates the Qsys system, adding the timing constraints file, and ...
Page 32
4–2 Chapter 4: Completing the Quartus II Project Complete the Quartus II Project Figure 4–1 shows the files included in the project. Figure 4–1. Quartus II Project Files Add the Pin Assignments To add...
Page 33
Chapter 4: Completing the Quartus II Project 4–3 Configure the FPGA 2. When compilation completes, click OK to close the Full Compilation was successful message. Compilation produces the .sof file, &l...
Page 34
4–4 Chapter 4: Completing the Quartus II Project Configure the FPGA 10. If your .sof does not appear in the Quartus II Programmer, perform the following steps: a. Click Add File. b. Browse to locate &...
Page 35
5. Creating the Software Application In this chapter, you use the Nios II SBT for Eclipse to develop the software application that runs on your system. You create a new software application project, a...
Page 36
5–2 Chapter 5: Creating the Software Application Create a New Software Project Figure 5–1 shows the Nios II Board Support Package project wizard. Figure 5–1. Nios II Board Support Package Project Wiza...
Page 37
Chapter 5: Creating the Software Application 5–3 Add Source Code Files to the Project Figure 5–2 shows the New Project dialog box after you perform these steps. Figure 5–2. New Application Project Wiz...
Page 38
5–4 Chapter 5: Creating the Software Application Configure the BSP Properties 4. Right-click the picture_viewer folder, and click Refresh. The files copy to the software project directory, and their n...
Page 39
Chapter 5: Creating the Software Application 5–5 Configure the BSP Properties 3. For sys_clk_timer, select peripheral_subsystem_sys_clk_timer. Figure 5–4 shows the settings for the Nios II BSP Editor ...
Page 40
5–6 Chapter 5: Creating the Software Application Specify the Zip File System Settings 4. On the Linker Script tab, for each enabled row in the Linker Section Mappings table, select ddr_sdram in the Li...