Docsity

Altera NIOS II Processor-Embedded Systems Lecture 03, Slides of Embedded Systems

Toggle sidebar
bg1
1
Embedded Systems
The Altera NIOS II Processor
Dr. Jeff Jackson Lecture 3-1Electrical & Computer Engineering – Embedded Systems
Outline
•NIOS II Processor System Basics
•NIOS II Processor Architecture
•
Processor Implementation
•
Processor
Implementation
•Processor Implementation Tradeoffs
•NIOS II Register File
•NIOS II Arithmetic Logic Unit
•Unimplemented Instructions
Ct It ti
Dr. Jeff Jackson Lecture 3-2Electrical & Computer Engineering – Embedded Systems
•
C
us
t
om
I
ns
t
ruc
ti
ons
•Floating Point Instruction Support
•Memory and I/O Organization
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Altera NIOS II Processor-Embedded Systems Lecture 03 and more Slides Embedded Systems in PDF only on Docsity!

Embedded Systems

The Altera NIOS II Processor

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

Outline

  • NIOS II Processor System Basics
  • NIOS II Processor Architecture
  • • Processor ImplementationProcessor Implementation
  • Processor Implementation Tradeoffs
  • NIOS II Register File
  • NIOS II Arithmetic Logic Unit
  • Unimplemented Instructions C t I t ti

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

  • Custom Instructions
  • Floating Point Instruction Support
  • Memory and I/O Organization

NIOS II Processor System Basics

  • A general-purpose RISC processor core
    • 32-bit instruction set, data path, and address space
    • 32 general-purpose registers32 general purpose registers
    • Optional shadow register sets – useful for context switching on multitasking systems
    • 32 interrupt sources
    • External interrupt controller interface for more interrupt sources

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

  • Single-instruction 32 × 32 multiply and divide producing a 32-bit result
  • Dedicated instructions for computing 64-bit and 128-bit products of multiplication

NIOS II Processor System Basics

(continued)

  • A general-purpose RISC processor core
    • Floating-point instructions for single-precision floating- point operationspoint operations
    • Single-instruction barrel shifter
    • Access to a variety of on-chip peripherals, and interfaces to off-chip memories and peripherals
    • Optional memory management unit (MMU) to support operating systems that

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

  • require MMUs
  • Optional memory protection unit (MPU)
  • Instruction set architecture (ISA) compatible across all NIOS II processor systems

NIOS II Processor Architecture

  • The NIOS II architecture defines the following functional units: - Register file - Arithmetic logic unit (ALU)Arithmetic logic unit (ALU) - Interface to custom instruction logic - Exception controller - Internal or external interrupt controller - Instruction bus - Data bus - Memory management unit (MMU)

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

  • Memory protection unit (MPU)
  • Instruction and data cache memories
  • Tightly-coupled memory interfaces for instructions and data
  • JTAG debug module

NIOS II Processor Core Block diagram

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

Processor Implementation

  • The functional units of the NIOS II architecture form the foundation for the NIOS II instruction set - This does not indicate that any unit is implemented in hardware - The NIOS II architecture describes an instruction set, not a particular hardware implementation - A functional unit can be implemented in hardware, emulated in software, or omitted entirely
  • A NIOS II implementation is a set of design choices embodied by a particular NIOS II processor core E h i l t ti hi ifi bj ti h

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

  • Each implementation achieves specific objectives, such as smaller core size or higher performance
  • Allows the NIOS II architecture to adapt to the needs of different target applications

Processor Implementation Tradeoffs

  • Implementation variables generally fit one of three trade-off patterns: - More or less of a feature - • ExampleExample : To fine tune performance you can increase or decrease: To fine-tune performance, you can increase or decrease the amount of instruction cache memory. A larger cache increases execution speed of large programs, while a smaller cache conserves on-chip memory resources. - Inclusion or exclusion of a feature - Example : To reduce cost, you can choose to omit the JTAG debug module. This decision conserves on-chip logic and memory resources, but it eliminates the ability to use a software debugger to debug applications. H d i l t ti ft l ti f f t

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

  • Hardware implementation or software emulation of a feature
    • Example : For applications that rarely perform complex arithmetic, you can choose for the division instruction to be emulated in software. Removing the divide hardware conserves on-chip resources but increases the execution time of division operations.

Unimplemented Instructions

  • Some NIOS II processor core implementations do not provide hardware to support the entire NIOS II instruction setinstruction set - In such a core, instructions without hardware support are known as unimplemented instructions
  • The processor generates an exception whenever it issues an unimplemented instruction so an exception handler can call a routine that emulates

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

p the operation in software

  • Therefore, unimplemented instructions do not affect the programmer’s view of the processor

Custom Instructions

  • The NIOS II architecture supports user-defined custom instructions
  • The NIOS II ALU connects directlThe NIOS II ALU connects directly to custom to c stom instruction logic, enabling you to implement in hardware operations that are accessed and used exactly like native instructions - This custom instruction feature allows for creation of one or more hardware accelerators that can dramatically

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

o o e a d a e acce e ato s t at ca d a at ca y improve the execution performance of a given system

  • Common examples:
    • Complex filter operations in DSP systems
    • Image Processing accelerator cores

Floating Point Instructions

  • The NIOS II architecture supports single precision floating-point instructions - Conforms to the IEEE STD 754-
  • ThThe basic set of floating-point custom instructions b i t f fl ti i t t i t ti includes single precision floating-point addition, subtraction, and multiplication
  • Floating-point division is available as an extension to the basic instruction set - Hardware support for floating point division is optionally included because it requires more hardware resources than other operations

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

other operations

  • Double precision arithmetic is implemented only in software - Be highly aware of this as it can impact performance significantly

Floating Point Software Development

Considerations

  • The best choice for hardware design depends on a balance among - Floating-point usageFloating point usage - Hardware resource usage, and - Performance
  • While the floating-point custom instructions speed up floating-point arithmetic, they substantially add to the size of a hardware design

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

the size of a hardware design

Memory and I/O Organization

  • The flexible nature of the NIOS II memory and I/O organization are the most notable difference between NIOS II processor systems and traditionalbetween NIOS II processor systems and traditional microcontrollers
  • Because NIOS II processor systems are configurable, the memories and peripherals vary from system to system - As a result the memory and I/O organization varies from

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

As a result, the memory and I/O organization varies from system to system

Memory and I/O Organization (continued)

  • A NIOS II core uses one or more of the following to provide memory and I/O access: - Instruction master port - An Avalon Memory-Mapped (Avalon-MM) master port that connects to instruction memory(Avalon-MM) master port that connects to instruction memory via system interconnect fabric - Instruction cache - Fast cache memory internal to the NIOS II core - Data master port - An Avalon-MM master port that connects to data memory and peripherals via system interconnect fabric - Data cache - Fast cache memory internal to the NIOS II core - Tightly-coupled instruction or data memory port - Interface

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

to fast on-chip memory outside the NIOS II core

  • The NIOS II architecture hides the hardware details from the programmer, so programmers can (usually) develop applications without specific knowledge of the hardware implementation

NIOS II Memory and I/O Organization

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

Instruction and Data Buses

  • The NIOS II architecture supports separate instruction and data buses, classifying it as a Harvard architectureHarvard architecture - Both the instruction and data buses are implemented as Avalon-MM master ports that adhere to the Avalon-MM interface specification - The data master port connects to both memory and peripheral components, while the instruction master port t l t t

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

connects only to memory components

Data Master Port

  • The NIOS II data bus is implemented as a 32-bit Avalon-MM master port. The data master port performs two functions:performs two functions: - Read data from memory or a peripheral when the processor executes a load instruction - Write data to memory or a peripheral when the processor executes a store instruction
  • Byte-enable signals on the master port specify

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

y g p p y which of the four byte-lane(s) to write during store operations

Shared Memory for Instructions and Data

  • Usually the instruction and data master ports share a single memory that contains both instructions and datadata
  • While the processor core has separate instruction and data buses, the overall NIOS II processor system might present a single, shared instruction/data bus to the outside world
  • The outside view of the NIOS II processor system

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

  • The outside view of the NIOS II processor system depends on the memory and peripherals in the system and the structure of the system interconnect fabric

Cache Memory

  • The NIOS II architecture supports cache memories on both the instruction master port (instruction cache) and the data master port (data cache)cache) and the data master port (data cache)
  • Cache memory resides on-chip as an integral part of the NIOS II processor core
  • The cache memories can improve the average memory access time for NIOS II processor systems that use slow off chip memory such as SDRAM for

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

that use slow off-chip memory such as SDRAM for program and data storage

Configurable Cache Memory Options

  • The cache memories are optional. The need for higher memory performance (and by association, the need for cache memory) is application dependent
  • ManMany applications require the smallest possible applications req ire the smallest possible processor core, and can trade-off performance for size
  • A NIOS II processor core might include one, both, or neither of the cache memories
  • Furthermore, for cores that provide data and/or instruction cache, the sizes of the cache memories are user-configurable

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

g

  • The inclusion of cache memory does not affect the functionality of programs, but it does affect the speed at which the processor fetches instructions and reads/writes data

Tightly-Coupled Memory (continued)

  • Physically, a tightly-coupled memory port is a separate master port on the NIOS II processor core, similar to the instruction or data master portp - A NIOS II core can have zero, one, or multiple tightly- coupled memories - The NIOS II architecture supports tightly-coupled memories for both instruction and data access
  • Each tightly-coupled memory port connects directly to exactly one memory with guaranteed low, fixed

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

to exactly one memory with guaranteed low, fixed latency

  • The memory is external to the NIOS II core and is usually located on chip.

Accessing Tightly-Coupled Memory

  • Tightly-coupled memories occupy normal address space, the same as other memory devices connected via system interconnect fabricconnected via system interconnect fabric
  • The address ranges for tightly-coupled memories (if any) are determined at system generation time
  • Software accesses tightly-coupled memory using regular load and store instructions F th ft ’ ti th i

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

  • From the software’s perspective, there is no difference accessing tightly-coupled memory compared to other memory

Effective Use of Tightly-Coupled Memory

  • A system can use tightly-coupled memory to achieve maximum performance for accessing a specific section of code or dataspecific section of code or data
  • For example:
    • Interrupt-intensive applications can place exception handler code into a tightly-coupled memory to minimize interrupt latency
    • Compute-intensive digital signal processing (DSP)

Electrical & Computer Engineering – Embedded Systems Dr. Jeff Jackson Lecture 3-

p g g p g ( ) applications can place data buffers into tightly-coupled memory for the fastest possible data access