Académique Documents
Professionnel Documents
Culture Documents
Objectives
Students
Agenda
Custom Instructions
Multi-Masters and Direct Memory Access (DMA)
Configuring the Development Board
A-MNL-NIOSII-04
Devices
Mercury Devices
ACEX Devices
FLEX Devices
MAX Devices
Tools
Signal Processing
Communications
Embedded Processors
z
Devices (continued)
Stratix II
Stratix
Stratix GX
Cyclone II
Cyclone
MAX II
Nios, Nios II
Quartus II Software
Quartus II Web Edition
SOPC Builder
DSP Builder
Nios II IDE
Nios II Hardware
Development
Copyright 2005 Altera Corporation
Debug
Cache
Nios II
CPU
On-Chip
ROM
On-Chip
RAM
- Nios
Developed
By Altera
II Plus Internally
All Peripherals
Written In HDL
- Can
Harvard
Architecture
Be Targeted
For All Altera FPGAs
- Synthesis
Royalty-Free
Using Quartus II Integrated Synthesis
UART
GPIO
Timer
SPI
SDRAM
Controller
FPGA
6
A-MNL-NIOSII-04
Flash
I/O
CPU
SDRAM
I/O
I/O
I/O
I/O
I/O
DSP
FPGA
CPU
DSP
Reduce
Cost, Complexity
& Power
Problem:On
System
A Programmable
Chip
(SOPC)
Flash
FPGA
SDRAM
CPU is a Critical
Function
Solution:
ReplaceControl
External
Devices
Required
forProgrammable
System-Level Logic
Integration
with
8
Design Specification
SOPC Builder
RTL Simulation
Functional Simulation (Modelsim,
- Functional
Simulation (Modelsim,
Quartus II)
Quartus II)
Verify Logic Model & Data Flow
- Verify Logic Model & Data Flow
(No Timing Delays)
(No Timing Delays)
LE
M512
M4K
I/O
Synthesis
- Translate Design into Device Specific Primitives
- Optimization to Meet Required Area & Performance Constraints
- Spectrum, Synplify, Quartus II
A-MNL-NIOSII-04
tclk
10
Serial RS-232
Connectors
Power Connector
10/100 Ethernet
MAC/PHY &
RJ-45 Connector
Expansion
Prototype
Connectors
CPU Reset
8 MB Flash
16 MB SDRAM
1MB SRAM
Compact Flash
(Connector Mounted on Back)
11
Buttons
LEDs
7 Segment
Configuration Controller
(MAX 7128AE)
Configuration Control
1MB
SRAM
8MB
FLASH
16MB Compact
FLASH
32MB
SDRAM
Address (32)
Read
Write
Data In (32)
Data Out (32)
IRQ
IRQ #(6)
On-Chip
12
Off-Chip
32-Bit
Nios II
Processor
Tri-State
Bridge
Tri-State
Bridge
Compact
Flash
PIOs
ROM
General
Purpose
Timer
Periodic
Timer
LED PIO
LCD PIO
7-Segment
LED PIO
Button PIO
8 LEDs
Expansion
Header
J12
2 Digit
Display
4
Momentary
buttons
(with Monitor)
SDRAM
Controller
UART
Level Shifter
Nios II Processor
Reconfig
PIO
A-MNL-NIOSII-04
Address
Decoder
Instr.
Nios II
CPU
Data
Interrupt
Controller
On-Chip
Debug Core
UART 0
Timer 0
SPI 0
Wait State
Generation
GPIO 0
Data in
Multiplexer
Off-Chip
Software Trace
Memory
DMA 0
Master
Arbitration
Timer n
SPI n
GPIO n
DMA n
Memory
Interface Memory
Interface
Dynamic
Bus Sizing
UART n
User-Defined
InterfaceUser-Defined
Interface
HardwareAssisted
Debug Module
Program
Controller
&
Address
Generation
General
Purpose
Registers
r0 to r31
Instruction
Master
Port
Instruction
Cache
Exception
Controller
Interrupt
Controller
irq[31..0]
Custom
I/O Signals
14
Custom
Instruction
Logic
Control
Registers
ctl0 to ctl4
Arithmetic
Logic Unit
Data
Cache
Data
Master
Port
15
A-MNL-NIOSII-04
Nios II Versions
Nios
16
Pipeline
Nios II /f
Fast
Nios II /s
Standard
6 Stage
5 Stage
None
1 Cycle
3 Cycle
Emulated
In Software
Branch Prediction
Dynamic
Static
None
Instruction Cache
Configurable
Configurable
None
Data Cache
Configurable
None
None
1400 - 1800
1200 1400
600 700
Logic Usage
(Logic Elements)
Custom
Instructions
17
Nios II /e
Economy
Up to 256
18
250
Standard
MUL in Stratix
Fast
MUL in Stratix
A-MNL-NIOSII-04
Optional LE Implementation
19
Licensing
20
21
A-MNL-NIOSII-04
Performance
(DMIPS)
200
150
Standard
10% Smaller
Over 2X Faster
100
50
Economy
50% Smaller
0
0
500
1000
22
1500
2000
DMIPS
200
150
Standard
100
Economy
50
0
0
500
1000
1500
2000
Logic Elements
Stratix II
23
Stratix
Cyclone
HC-Stratix
Stratix II
200
f
150
Cyclone II
100
50
Cyclone
e
e e
0
$0.00
Stratix
$1.00
$2.00
$3.00
$4.00
$5.00
24
A-MNL-NIOSII-04
Stratix
Cyclone
Nios II/s
Nios II/e
90 DMIPS @ 175MHz
800 LEs
28 DMIPS @ 190MHz
400 LEs
4K Icache, No Dcache
Stratix 2S10-C5
67 DMIPS @ 135MHz
1200 LEs
No Icache, No Dcache
Stratix 2S10-C5
22 DMIPS @ 150MHz
550 LEs
4K Icache, No Dcache
Stratix 1S10-C5
62 DMIPS @ 125MHz
1200 LEs
No Icache, No Dcache
Stratix 1S10-C5
20 DMIPS @ 140MHz
550 LEs
4K Icache, 1K Dcache
Cyclone 1C4-C6
2K Icache, No Dcache
Cyclone 1C4-C6
No Icache, No Dcache
Cyclone 1C4-C6
* FMax Numbers Based Reference Design Running From On-Chip Memory (Nios II/f 1.15 DMIPS / MHz)
25
Over 60
Cores Available
Today
26
Web-Based IP Deployment
Clock-Domain Crossing
New in
4.2
27
A-MNL-NIOSII-04
Nios II Exceptions
All
Supported
Exception Types
z Software
Exceptions
Interrupts
28
29
30
A-MNL-NIOSII-04
10
31
32
33
A-MNL-NIOSII-04
11
34
System ID Peripheral
Memory Interfaces
EPCS Serial Flash
Controller
On-Chip
RAM, ROM
Off-Chip
z
z
SRAM
CFI Flash
LCD Display
35
JTAG UART
Single JTAG
Connection For:
z
z
z
z
z
Device Configuration
Flash Programming
Code Download
Debug
Target STDIO (printing)
Software Supports
z
z
z
Low-Level API
MicroC/OS-II File System
Support
CLinux File System
Support
Supported through
www.niosforum.com
36
A-MNL-NIOSII-04
12
Project Directories
Hardware
HDL Source & Netlist
db - Quartus project
database
Software
Application source code
Library files
Simulation
Testbench
Automatically generated
test memory and vectors
37
Exercise 1
A Basic Nios II Design
35 mins
Copyright 2005 Altera Corporation
Nios II Software
Development
A-MNL-NIOSII-04
13
Configure Processor
Peripheral Library
Hardware Development
Custom Instructions
IP Modules
Software Development
Nios II IDE
Connect Blocks
C Header files
Testbench
Custom Library
Peripheral Drivers
Synthesis &
Fitter
User Design
Other IP Blocks
Generate
Hardware
Configuration
File
Quartus II
40
Executable
Code
Verification
& Debug
JTAG,
Serial, or
Ethernet
Altera
PLD
On-Chip
Debug
Software Trace
Hard Breakpoints
SignalTap II
Compiler,
Linker, Debugger
User Code
Libraries
RTOS
GNU Tools
Advanced Hardware
Debug Features
Software and Hardware
Break Points, Data Triggers,
Trace
Flash Memory
Programming Support
42
A-MNL-NIOSII-04
14
Nios II IDE
File Viewer
Window
List of Open
Projects
(for C code,
C++, and
assembly*)
Terminal
window
43
44
Lists all
open
projects
Displays
source files
associated
with project
List all
open and
closed
projects
Allows you
to drag and
drop new
files into
existing
projects
45
A-MNL-NIOSII-04
15
46
Drivers Directory
- contains all device drivers
DO NOT DELETE !
47
48
A-MNL-NIOSII-04
16
System Library
Only creates system library project
Build C applications upon this later
49
50
Project Properties
51
A-MNL-NIOSII-04
17
52
Software Compilation
53
54
Application Project
A-MNL-NIOSII-04
18
XP
Linux Host Support (RedHat 7.3, 8.0,
Enterprise 3)
Nios II GNU Toolchain (Compiler, Binary Utilities)
Nios II Instruction Set Simulator
Nios II Debugger
Nios II IDE
USB Blaster Linux driver
55
56
device drivers
initialization software
file system
stdio, stderr
57
A-MNL-NIOSII-04
19
58
HAL API
User Program
_exit()
close()
closedir()
fstat()
getpid()
gettimeofday()
ioctl()
isatty()
kill()
lseek()
C
C Standard
Standard Library
Library
HAL API
Device
Driver
Device
Driver
Device
Driver
open()
opendir
read()
readdir()
rewinddir()
sbrk()
settimeofday()
stat()
usleep()
wait()
write()
59
/dev
/dev/jtag_uart0
/mnt
/dev/lcd0
/mnt/rozipfs
/mnt/rozipfs/myfile1
60
/mnt/rozips/myfile21
A-MNL-NIOSII-04
20
C:
UNIX
Style:
Newlib
Existing
system.h
system.h
63
A-MNL-NIOSII-04
21
system.h - example
/*
* system configuration
*
*/
.
.
.
.
.
.
64
/*
* button_pio configuration
*
*/
#define BUTTON_PIO_NAME "/dev/button_pio"
#define BUTTON_PIO_TYPE "altera_avalon_pio"
#define BUTTON_PIO_BASE 0x00920830
#define BUTTON_PIO_IRQ 2
#define BUTTON_PIO_HAS_TRI 0
#define BUTTON_PIO_HAS_OUT 0
#define BUTTON_PIO_HAS_IN 1
#define BUTTON_PIO_CAPTURE 1
#define BUTTON_PIO_EDGE_TYPE "ANY"
#define BUTTON_PIO_IRQ_TYPE "EDGE"
#define BUTTON_PIO_FREQ 50000000
HAL References
65
Each HAL project references library routines and drivers for the
components included in your Nios II system
Volatiles
66
A-MNL-NIOSII-04
22
BASE
REGNUM = 0
BASE+2
REGNUM = 2
REGNUM = 1
REGNUM = 3
IOWR(BASE,REGNUM,DATA)
z Writes DATA to register
REGNUM offset from base
address BASE
67
BASE+4
REGNUM = 4
68
#define IORD_ALTERA_AVALON_UART_RXDATA(base)
IORD(base, 0)
IOWR(base, 0, data)
#define IORD_ALTERA_AVALON_UART_TXDATA(base)
IORD(base, 1)
IOWR(base, 1, data)
#define IORD_ALTERA_AVALON_UART_STATUS(base)
IORD(base, 2)
IOWR(base, 2, data)
Data Cache
Memory
All
69
A-MNL-NIOSII-04
23
Data Cache
70
Interrupts
alt_irq_disable_all()
z
alt_irq_enable_all()
z
alt_irq_interruptible()
z
alt_irq_non_interruptible()
z
71
72
Sample Usage:
alt_irq_register ( 3, &some_data,
sample_isr);
A-MNL-NIOSII-04
24
Keep it simple.
Use ISR to trigger execution of slow processing tasks outside of
interrupt context
Do NOT perform these tasks within ISR
References:
Exception Handling Chapter in Nios II Software Developers
Handbook
Eg. printf()
73
Provider
Micrium
Source
Code
Standards
TCP/IP
Stack
File
System
Yes
RTCA/DO-178B
Opt.
Opt.
* Lightweight IP
TCP/IP Stack
Open Source
Yes
** Nucleus Plus
ATI/Mentor
Yes
CLinux
Open Source
(GPL)
Yes
KROS
KROS
Technologies
Yes
POSIX
GUI
Flash
C/OS-II
Support
Sockets API
IP, ICMP, UDP,
TCP
OSEK
ITRON
Other
Opt.
Opt.
GUI, SNMP
RMON,
SPAN
Incl.
Many,
inc.
FAT
and
JFFS2
Extensive
drivers and
middlewear,
inc USB,
IPSec, etc.
Opt.
Opt.
Provider
Source
Code
Standards
TCP/IP
Stack
File
System
Other
NORTi
MiSPO
Yes
ITRON
Opt.
Opt.
PPP,
SNMP,
HTTP
PrKERNELv4
eSOL
Yes
ITRON
Opt.
Opt.
USB, Mail
HTTP
ThreadX
Express Logic
Yes
Opt.
Opt.
USB
FAT,
JFFS2,
ROMFS,
RAMFS
Extensive
drivers and
middleware
, inc. USB,
IPSec, etc.
eCos
Open Source
(GPL with
excpetion)
Yes
POSIZ, uITRON,
EL/IX
Incl.
A-MNL-NIOSII-04
25
Nios II MicroC/OS-II
76
Nios II MicroC/OS-II
77
Modified BSD License, must keep the copyright notice and display it in the
product documentation
78
A-MNL-NIOSII-04
26
LWIP - Instantiation
Available
79
as a Software Component
LWIP Configuration
80
Must be Ported
81
A-MNL-NIOSII-04
27
Software Support
82
83
Process:
A-MNL-NIOSII-04
28
II Run
Nios II IDE JTAG Debugger
Nios II ISS
Nios II Console
Third Party tools
86
87
A-MNL-NIOSII-04
29
88
89
90
A-MNL-NIOSII-04
30
Requirements
Must have JTAG
Debug Core enabled
in CPU
91
Basic Debug
Run Controls
Stack View
Active Debug
Sessions
DoubleDouble-click to
add breakpoints
Memory View
Variables
Registers
Signals
92
Disconnect
Terminate
Suspend
Resume
Run last Configuration
Debug last Configuration
93
A-MNL-NIOSII-04
31
Standard debug
windows
94
memory
registers
Variables
breakpoints
expressions
signals
96
A-MNL-NIOSII-04
32
97
98
99
A-MNL-NIOSII-04
33
100
101
102
line debugger
A-MNL-NIOSII-04
34
103
Nios II Console
104
Displays C Source,
Assembly, Mixed
Provider
Description
Features
* Nios II IDE
Altera
** code|lab
ATI Mentor
Watchpoint
Sophia
Systems
Debugger
ISA-Nios/T
First Silicon
Solution
(FS2)
JTAG Trace
Probe
A-MNL-NIOSII-04
35
Nios II IDE
FS2 S/W
Upgrade
FS2 H/W
Upgrade
Hardware Execution
Breakpoints
Data Triggers
On-Chip
16 Frames
On-Chip
128 Frames
Off-Chip
128K Frames
No
Yes
Yes
Trace (Timestamp)
No
No
Yes
Target Connection
Altera
USB/B Blaster
Altera
USB/B Blaster
Included
See FS2
See FS2
Trace (PC)
Cost
106
107
Lab 2
Software Flow
45 mins
Copyright 2005 Altera Corporation
A-MNL-NIOSII-04
36
RTL Simulation
RTL Simulation
Simulation TestBench
Ethernet
MAC/PHY
Dev board
SRAM
Dev board
FLASH
Compact FLASH
SDRAM
Nios II Processor
Write
Data In (32)
Data Out (32)
IRQ
Read
IRQ #(6)
Clock
111
Reset
Tri-State
Bridge
Tri-State
Bridge
Compact
Flash
PIOs
On Chip
ROM)
On Chip
RAM
Custom
Instruction
User
Defined
Peripheral
User
Defined
Interface
User Device
User
Peripheral
SDRAM
Controller
UART
User Device
Address (32)
32-Bit
Nios II
Processor
Included
Not Included
A-MNL-NIOSII-04
37
112
113
114
A-MNL-NIOSII-04
38
115
116
Simulation Scripts
w
l
h
117
A-MNL-NIOSII-04
39
118
119
UART Simulation
Text is transmitted to
UART during simulation
Creates and saves txt file
containing UART tx
stream
Creates window to input
text at simulation run time
120
A-MNL-NIOSII-04
40
UART Simulation
121
JTAG_UART Simulation
New
122
Wave Window
123
A-MNL-NIOSII-04
41
Up to 200 MHz
Multi-Analyzer Support
1,024 Channels
128K Samples
10 Trigger Levels
No Probes!
Can be used
simultaneously with the
Nios II IDE debugger and
the FS2 console!
125
Lab 3
RTL Simulation
30 mins
Copyright 2005 Altera Corporation
A-MNL-NIOSII-04
42
Transfer Types
128
Slave Transfers
Master Transfers
Streaming Transfers
Latency-Aware Transfers
Burst Transfers
Switch
PIO
Address (32)
32-Bit
Nios II
Processor
Read
Write
Data In (32)
Data Out (32)
IRQ
IRQ #(6)
ROM
(with Monitor)
UART
Timer
Nios II Processor
LED PIO
7-Segment
LED PIO
PIO-32
UserDefined
Interface
129
Arbitration
Address Decoding
Data Path Multiplexing
Bus Sizing
Wait-State Generation
Interrupts
A-MNL-NIOSII-04
43
130
Transfer Properties
131
Wait States
Latency
Streaming
Burst
0 Setup
Cycles
0 Wait Cycles
clk
address,be_n
address, be_n
readn
chipselect
readdata
132
readdata
A-MNL-NIOSII-04
44
1 Setup Cycle
1 Wait Cycle
B C
clk
address,be_n
address, be_n
chipselect
Tsu
readn
readdata
133
readdata
0 Setup
Cycles
0 Wait Cycles
0 Hold Cycles
clk
address,be_n
address, be_n
writedata
writedata
writen
chipselect
134
1 Setup Cycle
0 Wait Cycles
1 Hold Cycle
B C
clk
address,be_n
writedata
address, be_n
writedata
writen
chipselect
135
A-MNL-NIOSII-04
45
Master
Clock Domain 2
Master
Clock Domain 1
CDX
CDX
CDX
CDX
Arbiter
Arbiter
Slave
Slave
Clock
Clock Domain
Domain 22
Slave
Slave
Clock
Clock Domain
Domain 22
Slave
Slave
Clock
Clock Domain
Domain 22
Master
Clock
Domain 1
Master
Clock
Domain 1
CDX
CDX
CDX
CDX
Arbiter
Arbiter
CDX
CDX
Arbiter
Arbiter
Slave
Slave
Clock
Clock Domain
Domain 33
Master
Clock
Domain 1
Slave
Slave
Clock
Clock Domain
Domain 22
138
A-MNL-NIOSII-04
46
Concentrate Effort on
Peripheral Functionality!
139
140
Creates Interface
I/O
Nios II
CPU
Nios II
CPU
I/O
Nios II System
Module
141
I/O
I/O
I/O
Interface
to User
Logic
I/O
Avalon
Avalon
I/O
External
User
Peripheral
Nios II System
Module
Internal
User
Peripheral
A-MNL-NIOSII-04
47
142
To communicate with
off-chip peripherals
Base interface type
on data sheet
143
Tri-State Peripherals
Interface to
User Logic
Tri-State
Bridge
Nios II
Processor
Avalon
FPGA
144
A-MNL-NIOSII-04
48
145
146
147
32
Avalon
32-Bit
Nios II
Processor
8 Bit
Peripheral
Base
aa
Base + 0x1
bb
Base + 0x2
cc
Base + 0x3
dd
Base + 0x4
ee
A-MNL-NIOSII-04
49
148
Memory Contents
32
Avalon
32-Bit
Nios II
Processor
64
64 Bit
Memory
Base
77 66 55 44 33 22 11 00
Base + 0x8
ff ee dd cc bb aa 99 88
Base + 0x16
?? ?? ?? ?? ?? ?? ?? ??
149
150
A-MNL-NIOSII-04
50
Fill in fields
Add component to
SOPC Builder portfolio
Can add parameterizing
capability to component
151
152
HDL for PWM already exists with standard microprocessor type interface
This will be added to our Nios II system in the next Lab
Avalon
Nios II System
153
A-MNL-NIOSII-04
51
PWM Pre-scale
+ 0x04
PWM On Period
31
154
On Period
Pre-scale
Lab 4
Adding A User Peripheral
30 mins
Copyright 2005 Altera Corporation
Custom Instructions
A-MNL-NIOSII-04
52
Custom Instructions
Application Examples
Data Stream Processing (eg. Network Applications)
Application Specific Processing (eg. MP3 Audio Decode)
Software Inner Loop Optimization
157
Custom Instructions
158
dataa
datab
32
result
Combinatorial
32
clk
32
clk_en
Multi-Cycle
reset
done
start
n
Extended
8
readra
Internal
Register File
readrb
writerc
5
159
A-MNL-NIOSII-04
53
Custom Instructions
160
161
162
VHDL
Verilog HDL
EDIF
Quartus Block Diagram (.bdf)
A-MNL-NIOSII-04
54
Port list
All Custom Instruction Modules need these ports
z
163
164
165
A-MNL-NIOSII-04
55
dataa[31..0]
result[31..0]
Custom
Logic
reada
writec
c[4..0]
a[4..0]
166
Software Interface - C
#include "system.h"
int main (void)
{
int a = 0x12345678;
int a_swap = 0;
a_swap = ALT_CI_BSWAP(a);
return 0;
}
167
Custom
instruction
opcode
number
Destination
register
for result
Operand 2
Two Examples:
custom 0, r6, r7, r8
custom 3, c1, r2, c4
168
Operand 1
r = Nios II processor
register
c = Custom instruction
internal register
A-MNL-NIOSII-04
56
float
float a,
a, b,
b, result_slow,
result_slow, result_fast;
result_fast;
result_slow
/*
result_slow == aa ** b;
b;
/* Takes
Takes 266
266 clock
clock cycles
cycles */
*/
result_fast
result_fast == ALT_CI_fpmult(a,b);
ALT_CI_fpmult(a,b); /*
/* Takes
Takes 66 clock
clock cycles*/
cycles*/
Significantly
SignificantlyFaster!
Faster!
Typical Flow
Profile Code
Identify Critical Inner Loop
Create Custom Instruction Logic
z
169
Custom
Instruction
L0
170
Result
DataB
DataA
Custom
Peripheral
L0
Clock cycles = 3
custom
DataA
DataB
REG
----Next Instr
REG
Custom Instruction
Processor
Result
171
A-MNL-NIOSII-04
57
Clock Cycles = 1
Route start sig to reg clk_en
DataA
REG
custom
Nios Clock Cycles
DataB
Custom Instruction
Result
custom
custom
REG
custom
custom
Next Instr
Result
172
Accelerating CRC
Implementing
173
xor/shift
in(0)
xor/shift
reg
in(14)
xor/shift
in(15)
////reset
resetcrc
crc
ALT_CI_CRC(0xFFFF,1);
ALT_CI_CRC(0xFFFF,1);
////run
runcrc
crc
ALT_CI_CRC(word,0);
ALT_CI_CRC(word,0);
Control
DataA(31-0)
Data in
CRC Reg
DataB(0)
174
CRC
Custom Instruction
Result(15-0)
Init / nRun
A-MNL-NIOSII-04
58
Traditional Multi-Masters
Direct
System CPU
(Master 1)
System
System
Bottleneck
Bottleneck
Control
direction
100Base-T
(Master 2)
Arbiter Determines
Which Master Has
Access To Shared
Bus
DMA
Bus
Arbiter
DMA
Bus
Arbiter
DMA
Arbitor
System Bus
Slaves
176
Program
Memory
I/O
1
I/O
2
Data
Memory
As long as they dont access the same slave in the same bus bycle
Trade-Off
Hardware Resource Usage Increases
Uses Fairness
Arbitration
automatically
generated by
SOPC Builder
CPU
CPU 00
Masters
DMA
DMA
CPU
CPU 11
System
Switch
Fabric
Arbiter
Arbiter
Slaves
177
Program
Program
Memory
Memory 00
I/O
I/O
Data
Data
Memory
Memory 00
Arbiter
Arbiter
Display
Display
Control
Control
Data
Data
Memory
Memory 11
Custom
Custom
Function
Function
Program
Program
Memory
Memory 11
A-MNL-NIOSII-04
59
DMA Peripheral
Master Port
1
Master Port
2
Start Addr
Start Addr
# Bytes
# Bytes
Addr Incr
Addr Incr
Direction
Control Port
178
Master 1
(Nios II CPU)
I
SPI
Avalon
Avalon
Arbiter
Program
Memory
179
I/O
1
I/O
2
Data
Memory
1
Avalon
Switch
Fabric
Program
Memory
180
DMA
DMA
Processor
DMA
DMA
Arbiter
Arbiter
Arbiter
Arbiter
Data
Memory
Data
Memory
Accelerator
A-MNL-NIOSII-04
60
Clock Cycles
20,000,000
15,000,000
10,000,000
27 Times
Faster
5,000,000
530
Times
Faster
0
Software Only
181
Custom
Instruction
Hardware
Accelerator
Example: UART
dataavailable
readyfordata
endofpacket
adress
control
Custom
Streaming
Slave
Peripheral
writedata
readdata
Avalon
Adds
dataavailable
Readyfordata
endofpacket
182
dataavailable
Indicates that the peripheral has data available to be read
by DMA or other master
ie, there is data in the rx buffer or register
readyfordata
Indicates that the peripheral is able to receive data written
by DMA or other master
Ie. the tx buffer or register is not full
endofpacket
Usage not defined
DMA can be optionally set to end transfer
183
A-MNL-NIOSII-04
61
address
writedata
readdata
Avalon
control
Custom
Master
Peripheral
waitrequest
184
185
186
A-MNL-NIOSII-04
62
Burstcount, beginbursttransfer
Several
Automatically Reconciles:
187
188
189
A-MNL-NIOSII-04
PCI DMA
2 shares
63
190
Master B
Master B Shares = 2
Arbiter
Slave
Master A
Master B
191
Lab 5
Custom Instruction and
(optional) DMA Controller
45 mins
Copyright 2005 Altera Corporation
A-MNL-NIOSII-04
64
194
Clock Distribution
PLL
SDRAM
Nios II
PLL
Zero Skew
Buffer
CLK in
(50 MHz)
Zero Skew
Buffer
FPGA
A-MNL-NIOSII-04
65
Flash Configuration
Two FPGA images
z
0x600000
Safe FPGA
Image
Stratix
User FPGA
Image
Data
Address
Safe Image
User Image
0x700000
MAX
0x600000
Safe FPGA
Image & S/W
User FPGA
Image
Data
Stratix
0x500000
Address
0x400000
SRAM
0x300000
User
Software
0x200000
0x100000
0x000000
197
Boot Copier
Use
Data
II IDE Automatically
Prepends Boot Copier to
Program Code
198
Address
Nios
Stratix
User
Software
SRAM
8 MB Flash
Boot Copier
my_sw.flash
my_sw.elf
A-MNL-NIOSII-04
66
Two-step process:
Send Flash Programmer Design
Send Flash Content
Flash Content
199
Nios II CPU
JTAG UART
Active serial memory interface
Tri-state bridge
CFI-compatible flash interface
System ID peripheral on-chip memory for firmware and buffers
200
201
A-MNL-NIOSII-04
67
202
203
Clock frequency
Device family
204
A-MNL-NIOSII-04
68
cd examples/factory_recovery/niosII_cyclone_1c20
./restore_my_flash
205
Daughter Cards
Lab 6
The Flash Programmer
10 mins
Copyright 2005 Altera Corporation
A-MNL-NIOSII-04
69
Summary
Multi-Processor
Hardware Acceleration
Custom Instructions
Greatest
Greatest
Flexibility
Flexibility
Processors
Peripherals
Optimized Interconnect
Most
MostPowerful
Powerful
Design
DesignTools
Tools
Fastest
FastestTime
Time
to
toMarket
Market
209
SOPC Builder
Nios II IDE
On-Chip Processor Debug
SignalTap II Logic Analyzer
210
A-MNL-NIOSII-04
70
On-Line Training
www.altera.com/training
View Training Class Schedule & Register for a Class
211
Thank You
Appendix
A-MNL-NIOSII-04
71
Low-Cost FPGAs
z
CPLDs
z
Nios, Nios II
Configuration Devices
z
214
EPC
Quartus II
z Stratix
version
all features & devices included
MAX+PLUS II
z All
215
Nios II vs Nios
Nios II
216
Nios
A-MNL-NIOSII-04
72
217
135MHz
1.2 DMIPS/MHz
<1800 LEs and <900 ALMs
218
135MHz
0.75 DMIPS/MHz
<1400 LEs and <700 ALMs
219
150 MHz
0.16 DMIPS/MHz
<700 LEs and <350 ALMs
A-MNL-NIOSII-04
73
D2
D3
D4
CLK 1
CLK 2
CLK 1
D2
CLK2 samples D2
while it is changing
CLK 2
D4 is synchronized and valid
D3
D4
220
221
222
A-MNL-NIOSII-04
74
223
224
1. A developers license - Included with every copy of MicroC/OS-II shipped with an Altera development
kit. This enables customers to develop applications using the RTOS which are targeted for the Altera
development board.
2. Annual MicroC/OS-II subscription . Customers writing application code for their own board (or any
board other than Altera development boards) must purchase an annual subscription from which entitles
them to the following:
License for 3 developers to create as many designs as they wish for 1 year using MicroC/OS-II
Perpetual license to support designs created during the subscription period (i.e. fix bugs, minor
modifications).
Additional subscription license seats may be purchased per developer.
225
3. Project License . Customers who require licenses for more than 10 developers should purchase a
Project license which enables an unlimited number of designers to develop for that project using
MicroC/OS-II.
A-MNL-NIOSII-04
75
Master B
Master B Shares = 2
Arbiter
Slave MURL = 3
Slave
Minimum unun-interrupted run length
(hidden feature that is set in .PTF file)
Master A
Master B
226
A-MNL-NIOSII-04
76