NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel...

27
NIOS Intro Last updated 10/12/20

Transcript of NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel...

Page 1: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

NIOS Intro

Last updated 10/12/20

Page 2: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

2 © tjEE 3921

NIOS Basic

These slides describe the development of a simple NIOS Processor

Upon completion: You should be able implement your own NIOS processor and write code for it

Page 3: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

3 © tjEE 3921

NIOS

• NIOS II Embedded Design Suite

• Configurable Processor

• Selection of Peripherals

• Eclipse based Board Support Package (BSP) for SW development

Page 4: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

4 © tjEE 3921

Basic NIOS System

• Basic NIOS System• Create a processor system to allow printing to the console

Bus Fabric

CPU JTAGUART

OnchipMemory Timer

SystemID

ClockReset_bar

M(I) M(D) S S

CLK

RST

CLK

RST

SS

Page 5: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

5 © tjEE 3921

Basic NIOS System

• Basic NIOS System

HARDWARE

Page 6: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

6 © tjEE 3921

Basic NIOS System

• Create a new Quartus project• Do not select a Simulation Tool in EDA Tool Settings

• Open Tools → Platform Designer

Page 7: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

7 © tjEE 3921

Basic NIOS System

• Create NIOS System• Double Click on clk_0 - verify clk frequency = 50MHz

Page 8: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

8 © tjEE 3921

Basic NIOS System

• Add NIOS• Processors and Peripherals → Embedded Processors →

NIOS II Processor

• NIOS II/f

• No other changes

for now

• Add On-chip Memory• Basic Functions→ On Chip Memory → On Chip Memory

(RAM or ROM)…RAM

Size = 12,000 bytes

Page 9: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

9 © tjEE 3921

Basic NIOS System

• Add JTAG• Interface Protocols → Serial→ JTAG Uart Intel FPGA IP

• Add Timer• Processors and Peripherals → Peripherals → Interval

Timer Intel FPGA IP

• Add System ID• Basic Functions → Simulation; Debug and Verification →

Debug and Performance → System ID Peripheral Intel FPGA IP

Page 10: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

10 © tjEE 3921

• Connect up basic NIOS system• NIOS Inputs

Basic NIOS System

Page 11: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

11 © tjEE 3921

• Connect up basic NIOS system• On-chip Memory

Basic NIOS System

Connect to data and instruction masters

Page 12: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

12 © tjEE 3921

• Connect up basic NIOS system• JTAG, Timer, SysID

Basic NIOS System

Connect to data master Assign Priorities

Page 13: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

13 © tjEE 3921

• Connect up basic NIOS system• Assign the NIOS II Reset and Exception vectors• Open the NIOS Processor

• Select Vectors

• Select on-chip memory for Reset and Exception

Basic NIOS System

Page 14: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

14 © tjEE 3921

Basic NIOS System

• Complete Basic System• Assign base addresses

• System→ Assign Base Addresses

Assign Base Addresses

Page 15: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

15 © tjEE 3921

Basic NIOS System

• Create Basic System

• Check for errors

Page 16: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

16 © tjEE 3921

• Create Basic System• Save the Platform Designer system

• Generate the Platform Designer system• Generate→ Generate HDL

• The first time you generate you must delete the last directory in the path – don’t use the ‘…’

Basic NIOS System

Should point to your project directory

Page 17: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

17 © tjEE 3921

Basic NIOS System

• Create Basic System• Add the .qip file to the project

Page 18: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

18 © tjEE 3921

Basic NIOS System

• Create DE10 Design• Instantiate into a VHDL file• Open a new VHDL design (nios_basic_de10.vhdl)

• In Platform Designer: Generate → Show Instantiation Template

Page 19: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

19 © tjEE 3921

Basic NIOS System

• Create DE10 Design• Instantiate into a VHDL file

Instantiation template instancemapped to DE10 qsf pin aliases

Instantiation template component

Page 20: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

20 © tjEE 3921

Basic NIOS System

• Create DE10 Design

• Prepare to synthesize• If you did not do these when you created the project be sure to do

them now

• assignments → device → device and Pin options

• Single Uncompressed with memory initialization

• Import the pin aliases (qsf file)

• Setup the SDF file

• Be sure to set your top level entity

• Start Compilation

Page 21: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

21 © tjEE 3921

Basic NIOS System

• Create DE10 Design

Page 22: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

22 © tjEE 3921

Basic NIOS System

• Create DE10 Design• Complete the HW setup• Download the HW project onto the board

• DO NOT CLOSE either of these windows

Page 23: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

23 © tjEE 3921

Basic NIOS System

• Basic NIOS System

SOFTWARE

Page 24: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

24 © tjEE 3921

Basic NIOS System

• Create Eclipse System• Open NIOSII software• Tools → NIOSII Software Build Tools for Eclipse• Select the project directory for the workspace

• Create the BSP• File → New → NIOSII Application and BSP from template• Select the SOPCinfo file in the project directory• Provide a name for the sw project (I use ‘project_name_sw’)• Blank Project

• Edit the BSP• Right click on the BSP, NIOS II → BSP Editor• Change the properties for small systems• Small C library• Reduced device drivers

• Generate the BSP (bottom of window)

Page 25: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

25 © tjEE 3921

Basic NIOS System

• Create Eclipse System• Create program• Right click on the project directory and choose

New→ c source file

be sure to add the xxx.c extensionto the file name

Page 26: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

26 © tjEE 3921

Basic NIOS System

• Create Eclipse System• Create program• Type in the program

Page 27: NIOS Intro - faculty-web.msoe.edu · •Add JTAG •Interface Protocols →Serial→JTAG Uart Intel FPGA IP •Add Timer •Processors and Peripherals →Peripherals →Interval Timer

27 © tjEE 3921

Basic NIOS System

• Create Eclipse System• Compile and run the software• Select the code file (hello_world.c)

• Project→ Build Project

• Right Click on the project→ run as→ Nios II Hardware