Lecture1- Introduction to Programmable Logic

download Lecture1- Introduction to Programmable Logic

of 55

Transcript of Lecture1- Introduction to Programmable Logic

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    1/55

    Introduction to FPGA technology

    and programmable logic

    FYS4220/9220

    Reading: chapter 1 in ZwolinskiJ. K. Bekkeng, 3.7.2011

    Lecture #1

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    2/55

    Plasma and Space Physics

    Lecturer

    Jan Kenneth Bekkeng (Senior Scientist FFI, Ass. prof-IIUIO)

    Email: j.k.bekkeng[at]fys.uio.no

    Sounding rockets

    T&E

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    3/55

    Plasma and Space Physics

    Goals

    Learn digital design using programmable logiccircuits (FPGA and CPLD) Circuits

    Design tools

    Design methods

    Learn VHDL to program hardware (FPGAs andCPLDs) for use in e.g. embedded systems

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    4/55

    Plasma and Space Physics

    Curriculum (VHDL & FPGA part)

    Lectures (and other handout material)

    Laboratory exercises

    Textbook: Digital System Design with VHDL, 2nd Edition (by Mark Zwolinski)

    The textbook readings complementthe lectures!

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    5/55

    Plasma and Space Physics

    Laboratory exercises

    Lab 1:

    Switches, LEDs, counters, debouncer, testbenches

    Lab 2: Use of components and packages, LPMs, FSM (vending machine)

    Lab 3:

    Control of ADC (state machine), timing

    Lab 4: Mandatory for PhD students only

    NIOS II processor in FPGA (other projects may be possible)

    Altera Laboratory Exercises

    http://www.altera.com/education/univ/materials/comp_org/labs/unv-labs.htmlhttp://www.altera.com/education/univ/materials/comp_org/labs/unv-labs.htmlhttp://www.altera.com/education/univ/materials/comp_org/labs/unv-labs.htmlhttp://www.altera.com/education/univ/materials/comp_org/labs/unv-labs.html
  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    6/55

    Plasma and Space Physics

    Laboratory exercises

    Room V442, Physics buildingTeaching assistant available from 10.15 to 14.00 for guidanceon the lab days

    Lab availability (without guidance): The lab at V442 is available Monday - Friday

    Read the lab text and the corresponding manuals, and try tofind solutions before you come to the lab.

    All mandatory labs (3 labs for FYS4220, 4 labs for FYS9220)must be approved in order to take the exam

    All labs must be approved before 1. December

    Note that Quartus II Web Edition andModelsim-Altera Starter Edition softwarecan be downloaded for free from the

    Altera web page: Altera Free software

    http://www.altera.com/products/software/quartus-ii/web-edition/qts-we-index.htmlhttp://www.altera.com/products/software/quartus-ii/web-edition/qts-we-index.htmlhttp://www.altera.com/products/software/quartus-ii/web-edition/qts-we-index.htmlhttp://www.altera.com/products/software/quartus-ii/web-edition/qts-we-index.html
  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    7/55Plasma and Space Physics

    Other Recommended books for

    VHDL

    The Designer's Guide to VHDL, Volume 3, ThirdEdition (by Peter J. Ashenden)

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    8/55Plasma and Space Physics

    What is an embedded system?

    An embedded system is designed to perform oneor a few dedicated functions .

    Often has real-time computing constraints.By contrast, a general-purpose computer, such as apersonal computer (PC), is designed to be flexibleand to meet a wide range of end-user needs.

    Embedded systems are controlled by one or moremain processing cores that are typically eithermicrocontrollers, digital signal processors (DSP) orFPGAs

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    9/55Plasma and Space Physics

    Examples of embedded systems

    MP3 player

    Digital camera

    Washing machine

    GPS mottaker

    Blu-ray / DVD player

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    10/55Plasma and Space Physics

    Examples of FPGA use

    Aerospace

    Defence

    Medicine

    Imaging / Image processing

    Digital signal processingASIC prototyping

    Software defined Radio

    Software defined GPS

    Pico satellite (OBC)

    Air-to-Air missile

    NSM

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    11/55Plasma and Space Physics

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    12/55Plasma and Space Physics

    What is an FPGA?

    FPGA = Field Programmable Gate ArrayLogic Array Blocks (LABs) Each LAB contains a given number of Logic Elements (LE)

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    13/55Plasma and Space Physics

    Cyclone II LE

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    14/55Plasma and Space Physics

    Cyclone II Family Summary

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    15/55Plasma and Space Physics

    Altera circuit families

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    16/55Plasma and Space Physics

    FPGA advantages

    High reliability

    High determinism

    High performance

    True parallelism

    Reconfigurability

    FPGAs in DAQ-systems (intelligent DAQ)DAQ-cards with a programmable FPGA

    Multi-rate sampling

    User defined processing in the FPGA

    FPGA based hardware timing/synchronization

    NI R-series FPGA DAQ

    DAQ = Data Acquisition

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    17/55Plasma and Space Physics

    Examples on use of FPGAs

    High-speed control

    Intelligent DAQ

    Digital communication protocolsSensor simulation

    Onboard processing and data reduction

    Co-processing

    Hardware In the Loop (HIL)-testing

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    18/55Plasma and Space Physics

    Why use FPGA in an embedded

    system?

    Develop a low cost DSP system

    Scalability

    System integration (system on chip)

    True parallelism

    Many I/O (Input/Output) lines

    Note: All Altera IPs can be used free of charge for universities!

    DSP = Digital Signal Processor

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    19/55Plasma and Space Physics

    System Integration System On a

    Chip (SOC)Replace several DSPs with a single chip

    Integrate several different system

    components on a single chipA circuit design demanding e.g.10FPGAs a few years ago can no fit into asingle FPGA

    DSP Processor

    General

    Purpose

    Processor

    FPGA

    Custom

    Interface

    Logic

    DSP LogicNios

    Processor

    Custom

    Interface

    Logic

    Spare gates

    SOPC

    E I ti l R f U it

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    20/55Plasma and Space Physics

    Ex: Inertial Reference Unit(IRU)

    Roll (X)

    Pitch (Y)Yaw (Z)

    Roll

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    21/55Plasma and Space Physics

    IRU PCBs

    Roll PCB Pitch /Yaw PCB

    DAQ PCB Power & I/O PCB

    FPGA

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    22/55Plasma and Space Physics

    Development kit used in the lab

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    23/55

    Plasma and Space Physics

    Programmable logic

    FPGA

    CPLD

    Circuit manufacturers: Altera (www.altera.com)

    Xilinx (www.xilinx.com)

    Tools: QUARTUS II (Altera)

    Modelsim Altera (Mentor VHDL simulator)

    NIOS II Embedded design suite (+ C2H compiler)

    DSP builder (Altera)

    ISE (Xilinx)

    CPLDFPGA

    Flash

    http://www.altera.com/http://www.xilinx.com/http://www.xilinx.com/http://www.altera.com/
  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    24/55

    Plasma and Space Physics

    Design using FPGA/CPLD

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    25/55

    Plasma and Space Physics

    Examples of programming

    languages for programmable logicVHDL

    SystemC

    Handel-CVerilog (mainly used for ASICs, VHDL is better forFPGAs)

    Schematic tools (e.g. in Quartus II)

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    26/55

    Plasma and Space Physics

    Altera System Level Design Tools

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    27/55

    Plasma and Space Physics27

    IP Integration

    Altera System-Level Design Tools

    Software

    Development

    System

    Integration

    DSP AlgorithmDevelopment

    SOPC = System-On-a-Programmable-Chip

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    28/55

    Plasma and Space Physics

    Altera DSP Builder

    Interface between Quartus II (Altera) and

    MATLAB/Simulink (Mathworks)Library Add On to Simulink

    Automatic Generation of VHDL design From aMATLAB/Simulink Representation

    Creates HDL Code

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    29/55

    Plasma and Space Physics

    Automatic code generation

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    30/55

    Plasma and Space Physics

    Automatic code generation

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    31/55

    Plasma and Space Physics

    LabVIEW FPGA

    LabVIEW from National Instrument (NI) can be used to

    program (graphically) NIs RIO (RIO = ReconfigurableI/O) cards

    Requires license on NI LabVIEW and NI FPGA Module

    Can write/import VHDL code

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    32/55

    Plasma and Space Physics

    Circuit technologies

    Programmable logic device (PLD):

    Simple Programmable Logic Device (SPLD)

    Complex Programmable Logic Devices (CPLD)Field Programmable Gate Array (FPGA)

    Application Specific Integrated Circuit (ASICs)

    System On Chip (SoC)

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    33/55

    Plasma and Space Physics

    When to use FPGAs / CPLDs

    Usually the first choice for digital logic, except for: Very simple designs

    Large production volumes (ASIC better)

    Very complex designs e.g. mixed signal (analog and digital on the same chip)

    Very high speed or need for very low powerconsumption

    Can replace microcontrollers in designs with: A demand for many I/O lines

    Need for flexible I/O

    Requirements for parallel processing /fast processing

    High requirements on timing/triggering

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    34/55

    Plasma and Space Physics

    The difference between a

    processor and programmable

    logic

    A processor is programmed with ins t ruc t ions

    A programmable logic circuit is programmed with acircui t descr ipt ion

    A programmable logic circuit contains configurable

    blocks with logics and configurable connection linesbetween these blocks

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    35/55

    Plasma and Space Physics

    Programmable logic

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    36/55

    Plasma and Space Physics

    CPLD - Complex

    Programmable Logic Device

    Programming technology: non-volatile memory, suchas EEPROM or FLASH.

    Configuration stored in the circuit (even without power) High voltage (EEPROM) or logic voltage (FLASH)

    Used in small and medium size designs

    Circuit family example: MAX II from Altera Up to 1270 LE

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    37/55

    Plasma and Space Physics

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    38/55

    Plasma and Space Physics

    FPGA - Field Programmable

    Gate Array

    Typically contains more logic then a CPLD

    Have many flip-flops (memory elements)

    Circuit examples: Virtex-series (Xilinx)

    Cyclone and Stratix-series (Altera)

    Stratix V: 28 nm technologi, > 106 LE

    Programming technology: usually static memory(SRAM)

    Needs an external configuration circuit with a non-volatile memory(based on EEPROM/FLASH) which loads the configuration intothe FPGA at power on.

    SRAM memory inside the FPGA stores the circuit configuration(when the power is on).

    FPGA

    Flash

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    39/55

    Plasma and Space Physics

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    40/55

    Plasma and Space Physics

    Additional support in modern

    FPGAs

    On-chip memory, e.g. RAM blocks dual port RAM -> can read and write the RAM in the same clock

    cycle

    Processor cores (floating point operations possible)

    DSP blocks (floating point operations possible)

    Multiplier blocks

    High speed input/output blocksPLL (Phase locked loop)

    DLL (Delay locked loop)

    Intellectual Property (IP)

    E.g. FFT, UART

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    41/55

    Plasma and Space Physics

    FPGA vs ASIC

    ASIC = Application Specific Integrated Circuit

    circuits that are fabricated in a silicon foundry

    FPGA advantages Dramatically reduce the cost of errors (by reprogramming)

    Much cheaper than an ASIC for small volumes

    FPGA disadvantages (compared to ASICs) Lower performance (due to overhead of programmability)

    Higher power consumption

    Same logic requires a lager chip area

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    42/55

    Plasma and Space Physics

    Fast calculations DSP blocks

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    43/55

    Plasma and Space Physics

    Reduction of power consumption

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    44/55

    Plasma and Space Physics

    Reduction of power consumption

    P i FPGA

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    45/55

    Plasma and Space Physics

    Processor cores in FPGA

    Processor cores inside the FPGAMany designs need a processor, and it is possible toavoid an external processor chip

    Soft core CPU Programmable logic in the FPGA is used to implement a processor

    (when needed) together with other functionality

    Hard core CPU The processor is implemented in the FPGA at the production of the

    circuit

    Xilinx processor cores for FPGA Power PC (hard core processor)

    MicroBlaze (soft core processor)

    Altera processor core for FPGA NIOS II (soft core processor)

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    46/55

    Plasma and Space Physics

    Soft core processor

    Pros:

    Include the processor core only when.

    The number of cores is flexible. Can reuse the design in newer generations ofFPGAs in the future.

    Cons:

    Slower and simpler than hard processor cores.

    Less area efficient compared to hard cores.

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    47/55

    Plasma and Space Physics

    Hardware vs Software

    Hardware (digital logic): Time critical parts

    Software (on the CPU):

    Less time critical parts.

    Interface (Ethernet, RS232, USB, Wi-Fi, etc.)

    Code that normally would have been executed on an externalprocessor.

    Nios II C-to-Hardware Acceleration Compiler (C2H) boosts the performance of yourtime-critical ANSI C functions by

    converting them into hardware accelerators in the FPGA.

    tool for software engineers who need to increase the performance

    of their embedded software applications.

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    48/55

    Plasma and Space Physics

    Intellectual Properties - IPs

    With today's large FPGA designs it is almostimpossible to design everything from scratch.

    Solution: Use already developed blocks for the partsof the design where these are available. They arecalled In tellectual Proper ties (IP).

    IP types:

    made internally available from an FPGA manufacturer

    available from a third part supplier

    Alt E b dd d

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    49/55

    Plasma and Space Physics

    Altera Embedded

    processing

    http://www.altera.com/technology/embedded/emb-index.html

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    50/55

    Plasma and Space Physics

    Embedded development tools

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    51/55

    Plasma and Space Physics

    Some supported I/O standards

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    52/55

    Plasma and Space Physics

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    53/55

    Plasma and Space Physics

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    54/55

    Plasma and Space Physics

    How to simulate VHDL code

    Testbench(stimuli/test input is made using VHDL code)

    Waveforms(make a waveform input stimuligraphically)

    Examples of COTS

  • 8/9/2019 Lecture1- Introduction to Programmable Logic

    55/55

    Examples of COTS

    hardware for embedded systems

    National Instruments PXI rack with FPGA-card(s)and a real-time controller

    CompactRIO from NI

    BeMicro (from Altera) Low cost ($49)

    Altera CycloneIII FPGA

    Altera NiosII embedded processor

    18-slot PXI Express chassisNI R-series FPGA DAQController with

    Windows and/or RT-OS

    Real-time processor

    and FPGA