Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II...
Transcript of Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II...
![Page 1: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/1.jpg)
IT-SoC Lab
Nios II software
Truong Quang Vinh
![Page 2: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/2.jpg)
IT-SoC Lab
Truong Quang Vinh
Syllabus
Class content Nios II System Development Flow Avalon-ST interface Conduit interface
Required documents Nios II Hardware Development Tutorial Nios II Processor Reference Handbook
Class time 1 hours
Assignments 10 questions 2 projects
Source folder http://soc.chonnam.ac.kr/~tqvinh/VDP_lecture/PDF/
![Page 3: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/3.jpg)
IT-SoC Lab
Truong Quang Vinh
Nios II Processor System Basics
The Nios II processor is a general-purpose RISC processor core Full 32-bit instruction set,
data path, and address space
Software development environment based on the GNU C/C++ tool chain
Performance up to 250 DMIPS (Dhrystone MIPS)
![Page 4: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/4.jpg)
IT-SoC Lab
Truong Quang Vinh
Example of a Nios II Processor System
![Page 5: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/5.jpg)
IT-SoC Lab
Truong Quang Vinh
Nios II Processor Core Properties
![Page 6: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/6.jpg)
IT-SoC Lab
Truong Quang Vinh
Data Types
![Page 7: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/7.jpg)
IT-SoC Lab
Truong Quang Vinh
Nios II System Development Flow
![Page 8: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/8.jpg)
IT-SoC Lab
Truong Quang Vinh
Tutorial Example design
Nios II system: Nios II processor Onchip memory Timer JTAG UART 8-bit parallel I/O System
identification component
![Page 9: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/9.jpg)
IT-SoC Lab
Truong Quang Vinh
Analyzing System Requirements
Application requirements: What computational performance does the application require? How much bandwidth or throughput does the application require? What types of interfaces does the application require? Does the application require multithreaded software?
System requirements: Which Nios II processor core to use: smaller or faster? What components does the design require? How many of each kind? Which real-time operating system (RTOS) to use, if any? Where can hardware acceleration logic dramatically improve system
performance? For example:• Could adding a DMA component eliminate wasted processor cycles copying data?• Could a custom instruction replace the critical loop of a DSP algorithm?• Could the Nios II C-to-Hardware (C2H) Acceleration Compiler improve performance?
![Page 10: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/10.jpg)
IT-SoC Lab
Truong Quang Vinh
Creating Example Design
1. Install the Design Files2. Analyze System Requirements3. Start the Quartus II Software and Open the Tutorial
Example Design Project4. Create a New SOPC Builder System5. Define the System in SOPC Builder6. Integrate the SOPC Builder System into the Quartus II
Project7. Download Hardware Design to Target FPGA8. Develop Software Using the Nios IDE9. Run Program
![Page 11: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/11.jpg)
IT-SoC Lab
Truong Quang Vinh
Create SOPC Builder System
![Page 12: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/12.jpg)
IT-SoC Lab
Truong Quang Vinh
Define the System in SOPC Builder
1. Specify target FPGA and clock settings.2. Add the Nios II core, on-chip memory, and other
components.3. Specify base addresses and interrupt request
(IRQ) priorities.4. Generate the SOPC Builder system.
![Page 13: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/13.jpg)
IT-SoC Lab
Truong Quang Vinh
On-chip Memory setting
Select On-chip Memory from List of available components
Click Add Select M4K Specify memory size of 20KByte Click Finish
![Page 14: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/14.jpg)
IT-SoC Lab
Truong Quang Vinh
Nios II Processor setting
Nios II Core: Nios II/s Hardware Multiply:
None Hardware Divide: Off Reset Vector: Memory:
onchip_mem Offset: 0x0
Exception Vector: Memory: onchip_memOffset: 0x20
![Page 15: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/15.jpg)
IT-SoC Lab
Truong Quang Vinh
Nios II Processor setting
Instruction Cache: 2 Kbytes
Enable Bursts: Off Include tightly
coupled instruction master port(s): Off
![Page 16: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/16.jpg)
IT-SoC Lab
Truong Quang Vinh
Nios II Processor setting
Check the connection
![Page 17: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/17.jpg)
IT-SoC Lab
Truong Quang Vinh
Add the JTAG UART
Add the JTAG UART Select JTAG UART Click ADD Keep default settings Click Finish
![Page 18: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/18.jpg)
IT-SoC Lab
Truong Quang Vinh
Add Interval Timer
Add Interval Timer Select Interval Timer from
Peripherals list Click Add Select Full-feature for
Presets Click Finish
![Page 19: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/19.jpg)
IT-SoC Lab
Truong Quang Vinh
Add the System ID Peripheral
If the system includes the system ID peripheral, the Nios II IDE prevents you from downloading programs compiled for a different system.
Perform the following steps to add the system ID peripheral: click System ID Peripheral. Click Add Click Finish
![Page 20: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/20.jpg)
IT-SoC Lab
Truong Quang Vinh
Add PIO
Select IPO from Peripherals list
Click AddSelect Output
ports onlyClick Finish
![Page 21: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/21.jpg)
IT-SoC Lab
Truong Quang Vinh
Specify Base Addresses and Interrupt Request Priorities
Click Auto-Assign Base Address Click IRQ Type 16 and press Enter to assign a new IRQ value Turn off Simulation Option
![Page 22: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/22.jpg)
IT-SoC Lab
Truong Quang Vinh
System Generation
![Page 23: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/23.jpg)
IT-SoC Lab
Truong Quang Vinh
Integrate SOPC Builder into the Quartus II Project
Import the SOPC block into block schematic Add input ports, output ports Make names for input/output ports Provide Vcc to reset_n signal
![Page 24: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/24.jpg)
IT-SoC Lab
Truong Quang Vinh
Assigning a Device in the Quartus II
Select the Cyclone III EP3C120F780C7
![Page 25: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/25.jpg)
IT-SoC Lab
Truong Quang Vinh
Pin Assignment
LED7 LED6 LED5 LED4 LED3 LED2 LED1 LED0
Pin AF19 AG19 AC17 AE15 AD19 AF18 AE20 AD15
User LED on Bitec Kit
![Page 26: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/26.jpg)
IT-SoC Lab
Truong Quang Vinh
Download Hardware Design to Target FPGA
Connect the board to the host computer with download cable
In Quartus software, click Programmer Click Hardware Setup, and select USB-Blaster Select .sof file Click Start
![Page 27: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/27.jpg)
IT-SoC Lab
Truong Quang Vinh
Create a New Nios II C/C++ Application Project
Create a new project Select name Select SOPC Builder
system file Select Count Binary Click Next
![Page 28: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/28.jpg)
IT-SoC Lab
Truong Quang Vinh
System Library Properties
Turn on Program never exits.
Turn off Support C++.
Turn off Clean exit (flush buffers).
Turn on Small C library.
![Page 29: Nios II software - hcmut.edu.vntqvinh/Lectures/Training_SOPC/Slide/3_Nios II... · Which Nios II processor core to use: ... Start the Quartus II Software and Open the Tutorial ...](https://reader031.fdocument.pub/reader031/viewer/2022020303/5ae49e2f7f8b9a90138f35d9/html5/thumbnails/29.jpg)
IT-SoC Lab
Truong Quang Vinh
Run the Program
Right-click the count_binary_0 project, point to Run As, and then click Nios II Hardware.
Click Terminate (the red square) on the toolbar at the upper-right hand corner of the Console view to terminate the run session.