SlideShare ist ein Scribd-Unternehmen logo
1 von 145
Downloaden Sie, um offline zu lesen
EDK Training at
University of Toronto
Processor IP Team
November 2003
Table of Contents
Introduction and Overview                                   Page 3
PowerPC and MicroBlaze                                      Page 11
Processor IP                                                Page 19
Creating a Simple MicroBlaze System with
   XPS with Base System Builder                             Page 49
Creating a Simple MicroBlaze System with
   XPS without Base System Builder                          Page 79
Adding I/O Peripherals to a System                          Page 96
Software Development with the EDK and XPS                   Page 110
Device Drivers & Software Infrastructure                    Page 119


  Implementing Processor Systems on Xilinx FPGAs   Page 2
Introduction and
Overview
Programmable Logic Evolution
                        XC2000-XC3000                XC4000, Virtex®                Virtex-II            Virtex-II Pro™
                                                                                                             System Platform

                                                                                     Platform



                                                         Block Logic                                     •     FPGA Fabric
Device Complexity




                                                                                                         •     Block RAM
                                                                                •   FPGA Fabric          •     SelectIO
                                                                                •   Block RAM            •     XCITE
                            Glue Logic                                                                         Technology
                                                                                •   SelectIO
                                                                                                         •     DCM
                                                                                •   XCITE
                                                                                    Technology           •     Embedded
                                                                                                               Multipliers
                                                                                •   DCM
                                                                                                         •     PowerPC
                                                                                •   Embedded
                                                    •    FPGA Fabric                Multipliers          •     RocketIO
                       •    FPGA Fabric             •    Block RAM


             1985                             1992                     2000                       2002                       2004

                    Implementing Processor Systems on Xilinx FPGAs     Page 4
Xilinx Virtex-II Pro FPGA
 Setting the Standard in Programmable Logic


                                                                                           Advanced FPGA Logic -
                             High performance true                                         125,000 logic cells
                             dual-port RAM - 10 Mb   SelectIO™- Ultra
                                                     Technology - 1200 I/O

                                                                                                 Embedded XtremeDSP
                                                                                                 Functionality - 556 multipliers



                                                                                               RocketIO™ High-speed
                                                                                               Serial Transceivers - 24

                                                                             PowerPC™ Processors
                                                                             400+ MHz Clock Rate - 4

                                                         XCITE Digitally Controlled
                                                         Impedance - Any I/O
                                          DCM™ Digital Clock
                                          Management - 12
                    130 nm, 9 layer copper in 300 mm wafer technology

Implementing Processor Systems on Xilinx FPGAs          Page 5
Virtex-II Pro Revolution
                                                                                           TM



                                                            • Up to 24 Serial Transceivers
                                                                – 622 Mbps to 3.125 Gbps



                                                            • Up to 4 PowerPC 405 Processors
                                                                – Industry standard
                                                                – 420 DMIPS at 300 MHz




Built on the Success of Virtex-II Fabric
  Implementing Processor Systems on Xilinx FPGAs   Page 6
RocketIO™ SerDes
               Leading-Edge High-Speed Serial
                                                                             • Multi-Rate
                                                                                – 3.125, 2.5, 2.0, 1.25, 1.0 Gbps
            8B/10B                                                              – 2 - 24 transceivers
 TXDATA
  TXDATA                                        Transmit
                   FIFO           Serializer                        Serial   • Multi-Protocol
            Encode
8-32b Wide                                       Buffer              Out
 8-32b Wide                                                                     –   1G, 10 G Ethernet (XAUI)
                            TX Clock Generator
              Transmitter                                                       –   PCI Express
                                                                                –   Serial ATA
 On-Chip
Reference                                                                       –   InfiniBand
  Clock
               Receiver                                                         –   FibreChannel
                           RX Clock Generator                                   –   Serial RapidIO
 RXDATA        Elastic   10B/8B       De-       Receive         Serial          –   Serial backplanes…
  RXDATA                                                         In
 8-32b Wide Buffer
  8-32b Wide
                         Decode
                                   Serializer
                                                 Buffer                      • Key Features
                                                                                –   Embedded 8B/10B Coding
                                                                                –   4-Level Pre-Emphasis
                                                                                –   Programmable Output Swing
                                                                                –   AC & DC Coupling
                                                                                –   Channel bonding

     Implementing Processor Systems on Xilinx FPGAs        Page 7
Virtex-II Pro Device Family
Covers the Entire Design Spectrum




Implementing Processor Systems on Xilinx FPGAs   Page 8
Embedded Development Kit (EDK)

 • All encompassing design environment
   for Virtex-II Pro PowerPCTM and MicroBlaze
   based embedded systems in Xilinx FPGAs
 • Integration of mature FPGA and
   embedded tools with innovative
   IP generation and customization
   tools
 • Delivery vehicle for Processor IP


 Implementing Processor Systems on Xilinx FPGAs   Page 9
EDK System Design
                  Comprehensive Tool Chain
Standard Embedded SW                                                            Standard FPGA HW
   Development Flow                                                             Development Flow

            C/C++ Code                                Xilinx Platform         VHDL/Verilog
                                                       Studio (XPS)
         Compiler/Linker                                                       Synthesizer

            (Simulator)                                                         Simulator

           Object Code                                                        Place & Route
                                                      Data2BlockRAM
                    ?                                                              ?
   code                     code                        Bitstream
   in off-chip              in on-chip
   memory                   memory                         Download to FPGA
  Download to Board & FPGA

                 Debugger                       RTOS, Board Support Package
                                                                              ChipScope Tools



     Implementing Processor Systems on Xilinx FPGAs       Page 10
PowerPC and
MicroBlaze
PowerPC 405
                               I-Side On-Chip
                               Memory (OCM)                                                      •   5-stage data path pipeline
                                                                                                 •   16KB D and I Caches
Processor Local Bus (PLB)




                                                                                                 •   Embedded Memory
                                    I-Cache                         Fetch &                          Management Unit
                                    (16KB)                          Decode
                                                                                     Timers      •   Execution Unit
                                                                                       and
                                                                                     Debug
                                                                                                      – Multiply / divide unit
                                                    MMU
                                               (64 Entry TLB)                         Logic           – 32 x 32-bit GPR
                                                                                                 •   Dedicated on-chip memory
                                                                Execution Unit                       interfaces
                                   D-Cache                                         JTAG
                                   (16KB)
                                                                   (32x32 GPR,
                                                                    ALU, MAC)      Instruction   •   Timers: PIT, FIT, Watchdog
                                                                                      Trace      •   Debug and trace support
                                                                                                 •   Performance:
                               D-Side On-Chip                                                         – 450 DMIPS at 300 MHz
                               Memory (OCM)                                                           – 0.9mW/MHz Typical Power



                            Implementing Processor Systems on Xilinx FPGAs       Page 12
What is MicroBlaze?
                                                    Machine Status                 r3
                                                                                    1
        Address                                         Reg                              Register



                       Instruction Bus Controller
         side                                                                              File                                     Data Side




                                                                                                              Data Bus Controller
                                                      Program
         LMB                                                                            32 x 32bit                                    LMB
                                                      Counter
                                                                                   r1
                                                    Control Unit                   r0


                                                     Instruction                  Shift / Add / Multip
                                                                                                   Multi
                                                                                  Logical Subtract Multiply
                                                       Buffer                                        ly
                                                                                                    ply



                                                                     Processor

    •    It’s a soft processor, around 900 LUTs
    •    RISC Architecture
    •    32-bit, 32 x 32 general purpose registers
    •    Supported in Virtex/E/II/IIPro, Spartan-III/II/E
Implementing Processor Systems on Xilinx FPGAs                          Page 13
More on MicroBlaze ...
• Harvard Architecture
• Configurable instruction cache, data cache
• Non-intrusive JTAG debug
• Support for 2 buses:
   – LMB (Local Memory Bus) - 1 clock cycle latency, connects to
     BRAM
   – OPB (On-chip Peripheral Bus) - part of the IBM
     CoreConnectTM standard, connects to other peripheral
     “Portable” IP between PPC and MB
• Big endian, same as PowerPC PPC405

    Implementing Processor Systems on Xilinx FPGAs   Page 14
MicroBlaze Interrupts and
            Exceptions
   • Interrupt handling
          – 1 Interrupt port
                 • 32+ interrupts and masking supported through interrupt
                   controller(s)
   • Exception handling
          – No exceptions generated in Virtex-II versions
          – One in Virtex/E and Spartan-II versions for MUL
            instruction


Implementing Processor Systems on Xilinx FPGAs   Page 15
Software Tools
• GNU tool chain
• GCC - GNU Compiler Collection
• GDB - The GNU debugger
   – Source code debugging
   – Debug either C or assembly code
• XMD - Xilinx Microprocessor Debug utility
   – Separate Process
   – Provides cycle accurate program execution data
   – Supported targets: simulator, hardware board

Implementing Processor Systems on Xilinx FPGAs   Page 16
Software - XMD
• Interfaces GDB to a “target”
• Allows hardware debug without a ROM monitor or reduces
  debug logic by using xmd-stub (ROM monitor)
• Offers a variety of simulation targets
   – Cycle accurate simulator
   – Real hardware board interface via UART or MDM
• Includes remote debugging capability
                                                             UART
 GDB                                XMD                             MDM
                                                             SIM

  Implementing Processor Systems on Xilinx FPGAs   Page 17
MicroBlaze Debug Module
   •    JTAG debug using BSCAN
   •    Supports multiple MicroBlazes
   •    Software non-intrusive debugging
   •    Read/Write access to internal registers
   •    Access to all addressable memory
   •    Hardware single-stepping
   •    Hardware breakpoints - configurable (max 16)
   •    Hardware read/write address/data watchpoints
         – configurable (max 8)

Implementing Processor Systems on Xilinx FPGAs   Page 18
Processor IP

Hardware and Software
Example MicroBlaze System
                   LMB_BRAM                 BRAM              LMB_BRAM
                    IF_CNTLR                BLOCK              IF_CNTLR



                   LMB_V10                                    LMB_V10           DDR
                                                                               SDRAM
                            I-Side LMB                   D-Side LMB
                                          MicroBlaze                        External to FPGA

   SYS_Clk /                    I-Side OPB          D-Side OPB
   SYS_Rst
                                             OPB_V20                          OPB_DDR


  JTAG Debug OPB_MDM               OPB_INTC      OPB_TIMER       OPB_EMC



     Serial Port                                                             P160
                         OPB_UART                                            SRAM
                                           OPB_GPIO
                           LITE

      User LED                                           OPB_ETHERNET          P160
                                                                           Ethernet PHY

                                                                           External to FPGA


Implementing Processor Systems on Xilinx FPGAs      Page 20
Example PPC405 System
                                                  PPC405                             DCR_V29
           JTAG

Jtag
                                                                              DCR_INTC       DCR_INTC
                                                  PLB_V34                      (critical)   (non-critical)


                              PLB2OPB                           OPB2PLB
                                              PLB_DDR            BRIDGE
                               BRIDGE
Ref_Clk
               DCM
                                                      PLB_BRAM
                                                       IF_CNTLR                             SYS_Rst_n
                                                                          PROC_SYS
                                                                            RESET
                                                       BRAM
                                                       BLOCK



                                                   OPB_V20


 Serial Port         OPB_UART          OPB_GPIO             OPB_ETHERNET
                       16550
                                                                                            External PHY
User Input/Output



 Implementing Processor Systems on Xilinx FPGAs       Page 21
Processor IP (HW/SW)
Infrastructure (includes Device Drivers)                   OPB IPIF Modules (includes Device Drivers)
                                                           •   PLB IPIF
•    MicroBlaze CPU                                             –   OPB IPIF-Slave Attachment
•    LMB2OPB Bridge                                             –   OPB IPIF-Master Attachment
                                                                –   IPIF-Address Decode
•    PLB Arbiter & Bus Structure (PLB_V34)                      –   IPIF-Interrupt Control
•    OPB Arbiter & Bus Structure (OPB_V20)                      –   IPIF-Read Packet FIFOs
                                                                –   IPIF-Write Packet FIFOs
•    DCR Bus Structure (DCR_V29)                                –   IPIF-DMA
•    PLB2OPB Bridge                                             –   IPIF-Scatter Gather
                                                                –   IPIF-FIFOLink
•    OPB2PLB Bridge                                        •   PLB IPIF
•    OPB2OPB Bridge - Lite                                      –   PLB IPIF-Slave Attachment
                                                                –   PLB IPIF-Master Attachment
•    OPB2DCR Bridge                                             –   IPIF-Address Decode
•    System Reset Module                                        –   IPIF-Interrupt Control
                                                                –   IPIF-Read Packet FIFOs
•    BSP Generator (SW only)                                    –   IPIF-Write Packet FIFOs
•    ML3 VxWorks BSP (SW only)                                  –   IPIF-DMA
                                                                –   IPIF-Scatter Gather
•    Memory Test Utility (SW only)                              –   IPIF-FIFOLink




Implementing Processor Systems on Xilinx FPGAs   Page 22
Processor IP (HW/SW)
           Memory Interfaces (includes Device Drivers &        Peripherals (continued)
              Memory Tests)                                    •   OPB IIC Master & Slave
           •    PLB EMC (Flash, SRAM, and ZBT)                 •   OPB SPI Master & Slave
           •    PLB BRAM Controller                            •   OPB UART-16550
           •    PLB DDR Controller                             •   OPB UART-16450
           •    PLB SDRAM Controller                           •   OPB UART - Lite
           •    OPB EMC (Flash, SRAM, and ZBT)                 •   OPB JTAG UART
           •    OPB BRAM Controller                            •   OPB Interrupt Controller
           •    OPB DDR Controller                             •   OPB TimeBase/Watch Dog Timer
           •    OPB SDRAM Controller                           •   OPB Timer/Counter
           •    OPB SystemACE                                  •   OPB GPIO
           •    LMB BRAM Controller                            •   PLB 1G Ethernet
           Peripherals (includes Device Drivers & RTOS         •   PLB RapidIO
               Adapt. Layers)                                  •   PLB UART-16550
           •    OPB Single Channel HDLC Controller             •   PLB UART-16450
           •    OPB<->PCI Full Bridge                          •   PLB ATM Utopia Level 2 Slave
           •    OPB 10/100M Ethernet                           •   PLB ATM Utopia Level 2 Master
           •    OPB 10/100M Ethernet - Lite                    •   PLB ATM Utopia Level 3 Slave
           •    OPB ATM Utopia Level 2 Slave                   •   PLB ATM Utopia Level 3 Master
           •    OPB ATM Utopia Level 2 Master                  •   DCR Interrupt Controller


Implementing Processor Systems on Xilinx FPGAs       Page 23
System Infrastructure
     • Hardware IP
            –   Common PowerPC and MicroBlaze peripherals
            –   Peripherals are common across bus types
            –   Parameterize for optimal functionality, optimal FPGA usage
            –   IP Interface (IPIF) provides common hardware blocks
     • Software IP (Device Drivers)
            – Common across processors and operating systems




Implementing Processor Systems on Xilinx FPGAs   Page 24
The Benefits of Parameterization
Example: OPB Arbiter
                            Parameter Values              Resources F MAX
NUM_MASTERS PROC_INTERFACE DYNAM_PRIORITY PARK REG_GRANTS   LUTs    MHz
     1             N             N         N       N             11 295
     2             N             N         N       N             18 223
     4             N             N         N       N             34 193
     4             Y             N         N       N             59 156
     4             N             Y         N       N             54 169
     4             N             N         Y       N             83 159     Difference:
     4             N             N         N       Y             34 201     >4x in size
     4             Y             Y         Y       Y            146 145
     8             Y             Y         Y       Y            388 112
                                                                            >30% in speed


• Significantly increases performance or saves area
• Only include what you need
• This can only be accomplished in a programmable system

   Implementing Processor Systems on Xilinx FPGAs   Page 25
Full IP Interface (IPIF)
                                                                                IPIC
                                                                                                                    • Consists of 8 modules
                                                   Interrupt
                                                                                                                        – Each module is selectable and




                                                                                    Xilinx, 3rd party or customer
                                                   Controller
                                                                                                                           parameterizable
Processor Bus (OPB or PLB)




                                    Slave                         Addr Decode
                                 Attachment                                                                         • Automatically configures a core
                                                                                                                      to the processor bus




                                                                                             IP Core from
                                                       MUX



                                                                  Write FIFO
                                                                                                                        – Xilinx IP Cores
                                                                                                                        – 3rd Party IP Cores
                                   Master                          Read FIFO
                                                                                                                        – Customer proprietary cores and
                                 Attachment
                                                     DMA                                                                   external devices
                                                                                                                    • OPB & PLB supported
                                                                 Bus/Core HW
                                                                                                                        – Bus independent IP Cores and
                              Bus Attachment       Scatter                                                                 associated Device Drivers
                                                                 Independent
                                  Layer            Gather
                                                                    Layer
                                                                                                                    • IPIF will be added to other
                                                                                                                      LogiCOREs

                             Implementing Processor Systems on Xilinx FPGAs      Page 26
Buses and Arbiters
     • PLB
            – Arbitration for up to 16 masters
            – 64-bit and 32-bit masters and slaves
            – IBM PLB compliant
     • OPB
            – Includes arbiter with dynamic or fixed priorities and bus parking
            – Parameterized I/O for any number of masters or slaves
            – IBM OPB compliant
     • DCR
            – Supports one master and multiple slaves
            – Daisy chain connections for the DCR data bus
            – Required OR function of the DCR slaves’ acknowledge signal
     • LMB
            – MicroBlaze single-master Local Memory Bus

Implementing Processor Systems on Xilinx FPGAs   Page 27
Bridges
     • PLB to OPB
            – Decode up to 4 different address ranges
            – 32-bit or 64-bit PLB slave, 32-bit OPB master
            – Burst and non-burst transfers, cache-line transactions
     • OPB to PLB
            – 64-bit PLB master, 32-bit OPB slave
            – Burst and non-burst transfers, cache-line transactions
            – BESR and BEAR
     • OPB (slave) to DCR (master)
            – Memory mapped DCR control
     • OPB to OPB
            – Allows further OPB partitioning



Implementing Processor Systems on Xilinx FPGAs   Page 28
More System Cores
     • Processor System Reset
            –   Asynchronous external reset input is synchronized with clock
            –   Selectable active high or active low reset
            –   DCM Locked input
            –   Sequencing of reset signals coming out of reset:
                  • First - bus structures come out of reset
                  • Second - Peripheral(s) come out of reset 16 clocks later
                  • Third - the CPU(s) come out of reset 16 clocks after the peripherals
     • JTAG Controller
            – Wrapper for the JTAGPPC primitive.
            – Enables the PowerPC’s debug port to be connected to the FPGA JTAG chain
     • IPIF User Core Templates
            – Convenient way to add user core to OPB or PLB



Implementing Processor Systems on Xilinx FPGAs    Page 29
Timer / Counter
    • Supports 32-bit OPB v2.0 bus interface
    • Two programmable interval timers with interrupt,
      compare, and capture capabilities
    • Programmable counter width
    • One Pulse Width Modulation (PWM) output




Implementing Processor Systems on Xilinx FPGAs   Page 30
Watchdog Timer / Timebase
      • Supports 32-bit bus interfaces
      • Watchdog timer (WDT) with selectable timeout period
        and interrupt
      • Two-phase WDT expiration scheme
      • Configurable WDT enable: enable-once or enable-
        disable
      • WDT Reset Status (was the last reset caused by the
        WDT?)
      • One 32-bit free-running timebase counter with rollover
        interrupt
Implementing Processor Systems on Xilinx FPGAs   Page 31
Interrupt Controller
 • Number of interrupt inputs is configurable up to the width
   of the data bus width
 • Interrupt controllers can be easily cascaded to provide
   additional interrupt inputs
 • Master Enable Register for disabling the interrupt request
   output
 • Each input is configurable for edge or level sensitivity
    – rising or falling, active high or active low
 • Output interrupt request pin is configurable for edge or
   level generation

Implementing Processor Systems on Xilinx FPGAs   Page 32
UART 16550 / 16450 / Lite
      • Register compatible with industry standard 16550/16450
      • 5, 6, 7 or 8 bits per character
      • Odd, even or no parity detection and generation
      • 1, 1.5 or 2 stop bit detection and generation
      • Internal baud rate generator and separate RX clock input
      • Modem control functions
      • Prioritized transmit, receive, line status & modem control
        interrupts
      • Internal loop back diagnostic functionality
      • Independent 16 word transmit and receive FIFOs
Implementing Processor Systems on Xilinx FPGAs   Page 33
IIC
      • 2-wire (SDA and SCL) serial interface
      • Master/Slave protocol
      • Multi-master operation with collision detection and
        arbitration
      • Bus busy detection
      • Fast Mode 400 KHz or Standard Mode 100 KHz operation
      • 7 Bit, 10 Bit, and General Call addressing
      • Transmit and Receive FIFOs - 16 bytes deep
      • Bus throttling

Implementing Processor Systems on Xilinx FPGAs   Page 34
SPI
      • 4-wire serial interface (MOSI, MISO, SCK, and SS)
      • Master or slave modes supported
      • Multi-master environment supported (requires tri-state
        drivers and software arbitration for possible conflict)
      • Multi-slave environment supported (requires additional
        decoding and slave select signals)
      • Programmable clock phase and polarity
      • Optional transmit and receive FIFOs
      • Local loopback capability for testing

Implementing Processor Systems on Xilinx FPGAs   Page 35
Ethernet 10/100 MAC
    • 32-bit OPB master and slave interfaces
    • Media Independent Interface (MII) for connection to
      external 10/100 Mbps PHY Transceivers
    • Full and half duplex modes of operation
    • Supports unicast, multicast, broadcast, and promiscuous
      addressing
    • Provides auto or manual source address, pad, and
      Frame Check Sequence



Implementing Processor Systems on Xilinx FPGAs   Page 36
Ethernet 10/100 MAC (cont)
    • Simple DMA and Scatter/Gather DMA architecture for
      low processor and bus utilization, as well as a simple
      memory-mapped direct I/O interface
    • Independent 2K to 32K transmit and receive FIFOs
    • Supports MII management control writes and reads with
      MII PHYs
    • Supports VLAN and Pause frames
    • Internal loopback mode



Implementing Processor Systems on Xilinx FPGAs   Page 37
1 Gigabit MAC
     • 64-bit PLB master and slave interfaces
     • GMII for connection to external PHY Transceivers
     • Optional PCS function with Ten Bit Interface (TBI) to
       external PHY devices
     • Option PCS/PMA functions with SerDes interface to
       external transceiver devices for reduced signal count
     • Full duplex only
     • Provides auto or manual source address, pad, and
       Frame Check Sequence

Implementing Processor Systems on Xilinx FPGAs   Page 38
1 Gigabit MAC (cont)
     • Simple DMA and Scatter/Gather DMA architecture for
       low processor and bus utilization, as well as a simple
       memory-mapped direct I/O interface
     • Independent, depth-configurable TX and RX FIFOs
     • Supports MII management control writes and reads with
       MII PHYs
     • Jumbo frame and VLAN frame support
     • Internal loopback mode



Implementing Processor Systems on Xilinx FPGAs   Page 39
Single Channel HDLC
     • Support for a single full duplex HDLC channel
     • Selectable 8/16 bit address receive address detection,
       receive frame address discard, and broadcast address
       detection
     • Selectable 16 bit (CRC-CCITT) or 32 bit (CRC-32) frame
       check sequence
     • Flag sharing between back to back frames
     • Data rates up to OPB_Clk frequency



Implementing Processor Systems on Xilinx FPGAs   Page 40
Single Channel HDLC (cont)
     • Simple DMA and Scatter/Gather DMA architecture for
       low processor and bus utilization, as well as a simple
       memory-mapped direct I/O interface
     • Independent, depth-configurable TX and RX FIFOs
     • Selectable broadcast address detection and receive
       frame address discard
     • Independent RX and TX data rates




Implementing Processor Systems on Xilinx FPGAs   Page 41
ATM Utopia Level 2
     • UTOPIA Level 2 master or slave interface
     • UTOPIA interface data path of 8 or 16 bits
     • Single channel VPI/VCI service and checking in received
       cells
     • Header error check (HEC) generation and checking
     • Parity generation and checking
     • Selectively prepend headers to transmit cells, pass entire
       received cells or payloads only, and transfer 48 byte
       ATM payloads only

Implementing Processor Systems on Xilinx FPGAs   Page 42
ATM Utopia Level 2 (cont)
     • Simple DMA and Scatter/Gather DMA architecture for
       low processor and bus utilization, as well as a simple
       memory-mapped direct I/O interface
     • Independent, depth-configurable TX and RX FIFOs
     • Interface throughput up to 622 Mbps (OC12)
     • Internal loopback mode




Implementing Processor Systems on Xilinx FPGAs   Page 43
OPB-PCI Bridge
     • 33/66 MHz, 32-bit PCI buses
     • Full bridge functionality
            – OPB Master read/write of a remote PCI target (both single and burst)
            – PCI Initiator read/write of a remote OPB slave (both single and multiple)
     • Supports up to 3 PCI devices with unique memory PCI
       memory space
     • Supports up to 6 OPB devices with unique memory OPB
       memory space
     • PCI and OPB clocks can be totally independent


Implementing Processor Systems on Xilinx FPGAs   Page 44
System ACE Controller
     • Used in conjunction with System ACE CompactFlash
       Solution to provide a System ACE memory solution.
     • System ACE Microprocessor Interface (MPU)
            – Read/Write from or to a CompactFlash device
            – MPU provides a clock for proper synchronization
     • ACE Flash (Xilinx-supplied Flash Cards)
            – Densities of 128 MBits and 256 Mbits
            – CompactFlash Type 1 form factor
                  • Supports any standard CompactFlash module, or IBM microdrives up to 8
                      Gbits, all with the same form factor.

     • Handles byte, half-word, and word transfers

Implementing Processor Systems on Xilinx FPGAs   Page 45
GPIO
     • OPB V2.0 bus interface with byte-enable support
     • Supports 32-bit bus interface
     • Each GPIO bit dynamically programmable as input or
       output
     • Number of GPIO bits configurable up to size of data bus
       interface
     • Can be configured as inputs-only to reduce resource
       utilization



Implementing Processor Systems on Xilinx FPGAs    Page 46
Memory Controllers
   • PLB and OPB interfaces
   • External Memory Controller
      – Synchronous Memory (ZBT)
      – Asynchronous Memory (SRAM, Flash)
   • Internal Block Memory (BRAM) Controllers
   • DDR and SDRAM




Implementing Processor Systems on Xilinx FPGAs   Page 47
Device Drivers and Board
                      Support Packages (BSPs)
                  Board Support
                  Package (BSP)                                                                 • Device drivers are provided for each
                                                                                                  hardware device
RTOS Adaptation Layer
                                                                                                • Device drivers are written in C and are
                                                                           Peripheral n, n+1…
                                                       ATM Utopia Device
                                  IIC Master & Slave




                                                                                                  designed to be portable across
Ethernet 10/100




                                                                             Device Drivers
                                     Device Driver
 Device Driver

                  Device Driver
                  UART 16550




                                                                                                  processors
                                                            Driver




                                                                                                • Device drivers allow the user to select
                                                                                                  the desired functionality to minimize the
                                                                                                  required memory
           Initialization Code                                                                  • BSPs are automatically generated by
                Boot Code                                                                         EDK tools

          Implementing Processor Systems on Xilinx FPGAs                                          Page 48
Creating a Simple
MicroBlaze System
with XPS
with Base System Builder Wizard
Design Flow

• Design Entry with Xilinx Platform Studio using the
  Base System Builder Wizard
• Generate system netlist with XPS
• Generate hardware bitstream with XPS
• Download and sanity check design with XPS and
  XMD



Implementing Processor Systems on Xilinx FPGAs   Page 50
Simple MicroBlaze System
              Block Diagram
                               LMB_BRAM                 BRAM            LMB_BRAM
                                IF_CNTLR                BLOCK            IF_CNTLR



                               LMB_V10                                 LMB_V10

                                         I-Side LMB                 D-Side LMB
                                                      MicroBlaze

                SYS_Clk /                    I-Side OPB         D-Side OPB
                SYS_Rst
                                                          OPB_V20


                JTAG Debug                                      OPB_UART         Serial Port
                                      OPB_MDM
                                                                  LITE




                                                                                 External to FPGA


Implementing Processor Systems on Xilinx FPGAs        Page 51
Start Xilinx Platform Studio




Implementing Processor Systems on Xilinx FPGAs   Page 52
Create A New Project
                                                     • Select File from the Tools
                                                       menu
                                                     • Select the New Project
                                                       submenu and the Base
                                                       System Builder submenu
                                                     • Browse to the location where
                                                       the project is to be located
                                                     • Click OK to start creating the
                                                       project

Implementing Processor Systems on Xilinx FPGAs   Page 53
Selecting The Board
                                                     • Select Xilinx as the Board
                                                       Vendor
                                                     • Select Virtex-II Multimedia
                                                       FF896 Development Board as
                                                       the Board Name
                                                     • Select Board Revision 1
                                                     • Click Next to continue to the
                                                       next step


Implementing Processor Systems on Xilinx FPGAs   Page 54
Select the Processor


                                                     • This board has a Virtex-II
                                                       FPGA which does not contain
                                                       a PowerPC processor
                                                     • Click Next to continue to the
                                                       next step




Implementing Processor Systems on Xilinx FPGAs   Page 55
Configuring The Processor
                                                  • Select On-chip H/W debug
                                                    module such that a ROM
                                                    monitor is not required
                                                  • Select 64KB of Local Data and
                                                    Instruction Memory (BRAM)
                                                  • There is no need to select
                                                    caches when using internal
                                                    BRAM
                                                  • Click Next to continue to the
                                                    next step
Implementing Processor Systems on Xilinx FPGAs   Page 56
Configuring I/O Interfaces
                                                     • The board has a serial port
                                                       and it is default behavior to
                                                       build the hardware with it
                                                     • Since it is used as standard
                                                       I/O it is not necessary to be
                                                       interrupt driven
                                                     • Click Next to continue to the
                                                       next step


Implementing Processor Systems on Xilinx FPGAs   Page 57
Adding Internal Peripherals


                                                     • Other peripherals can be
                                                       added at this point, such as a
                                                       timer counter.
                                                     • Click Next to continue to the
                                                       next step




Implementing Processor Systems on Xilinx FPGAs   Page 58
System Summary

                                                     • The system has been created
                                                       and is ready to be generated
                                                     • Review the details of the
                                                       system and backup if
                                                       necessary to make changes
                                                     • Click the Generate button to
                                                       create the data files for XPS



Implementing Processor Systems on Xilinx FPGAs   Page 59
Base System Builder
                    Finished
                                                 • The Base System Builder
                                                   Wizard in XPS has completed
                                                 • The data files for XPS have
                                                   been generated such that the
                                                   system will be contained in an
                                                   XPS project
                                                 • Click the Finish button to exit
                                                   the wizard & return to XPS


Implementing Processor Systems on Xilinx FPGAs   Page 60
Generating Hardware NetList

                                                           • Select the Tools
                                                             menu
                                                           • Select the Generate
                                                             Netlist submenu
                                                           • Wait for the
                                                             generation to
                                                             complete




Implementing Processor Systems on Xilinx FPGAs   Page 61
Generating Hardware Bitstream
                                                           • Select the Tools
                                                             menu
                                                           • Select the
                                                             Generate
                                                             Bitstream
                                                             submenu
                                                           • Wait for the
                                                             bitstream
                                                             generation to
                                                             complete

Implementing Processor Systems on Xilinx FPGAs   Page 62
Adding Software Source Files

                                                           • Select processor in
                                                             System tab
                                                           • Select the Tools menu
                                                           • Select the Add Program
                                                             Sources submenu
                                                           • Navigate to the source
                                                             file and select it.




Implementing Processor Systems on Xilinx FPGAs   Page 63
Setting Compile Options

                                                     • Select the Options menu
                                                     • Select the Compiler
                                                       Options submenu
                                                     • Set the optimization to
                                                       none
                                                     • Set the debug options to
                                                       create symbols for
                                                       debugging


Implementing Processor Systems on Xilinx FPGAs   Page 64
Setting Up Standard I/O
                                                     • Select the System tab
                                                     • Double click on the
                                                       microblaze_0
                                                     • The dialog box illustrated
                                                       is displayed
                                                     • Select the opb_uartlite_0
                                                       for the STDIN and
                                                       STDOUT peripheral and
                                                       click the OK button


Implementing Processor Systems on Xilinx FPGAs   Page 65
Assigning Drivers To Devices
                                                           • Assigning a driver to a device
                                                             causes the driver to be compiled
                                                             into the library & linked with the
                                                             application
                                                           • Double click on the device in
                                                             the System tab of the XPS
                                                             project
                                                           • The latest version of the driver is
                                                             displayed by default
                                                           • Choose the appropriate
                                                             Interface Level of the driver



Implementing Processor Systems on Xilinx FPGAs   Page 66
Setting Memory Options
                                                   • Double click on the
                                                     processor instance in the
                                                     System tab
                                                   • Select the Details tab
                                                   • Change the program start
                                                     address or stack size
                                                   • Add other options to the
                                                     preprocessor, assembler,
                                                     or linker


Implementing Processor Systems on Xilinx FPGAs   Page 67
Setting Library Options
                                                       • Double click on the
                                                         processor instance in the
                                                         System tab
                                                       • Select the Others tab
                                                       • Add or change options for
                                                         library compilation
                                                       • Add other options for
                                                         application compilation



Implementing Processor Systems on Xilinx FPGAs   Page 68
Generating Libraries In XPS
                                                       • A Library containing the device
                                                         drivers and the startup code is
                                                         built for an application to be
                                                         linked against
                                                       • The Library helps separate
                                                         Board Support Package
                                                         development from application
                                                         development
                                                       • Libraries will automatically be
                                                         built if they don’t exist when the
                                                         application is built



Implementing Processor Systems on Xilinx FPGAs   Page 69
Compiling The Software


                                                           • Select the Tools menu
                                                           • Select the Compile
                                                             Program Sources
                                                             submenu
                                                           • Wait for the compile to
                                                             complete




Implementing Processor Systems on Xilinx FPGAs   Page 70
Updating the Bitstream
                                                           • Select the Tools menu
                                                           • Select the Update
                                                             Bitstream submenu
                                                           • The hardware bitstream
                                                             is updated to contain
                                                             the contents of the
                                                             software elf file




Implementing Processor Systems on Xilinx FPGAs   Page 71
Downloading The Hardware
                                                           • Make sure that the
                                                             board power is on
                                                             and the parallel pod
                                                             is connected
                                                           • Select the Tools
                                                             menu
                                                           • Select the Download
                                                             submenu
                                                           • Wait for the download
                                                             to complete

Implementing Processor Systems on Xilinx FPGAs   Page 72
Running XMD
                                                           • Select the Tools
                                                             menu
                                                           • Select the XMD
                                                             submenu
                                                           • Type “mbconnect
                                                             mdm” to connect
                                                             XMD to the
                                                             MicroBlaze
                                                             processor.



Implementing Processor Systems on Xilinx FPGAs   Page 73
Testing Memory
                                                 • Type “mrd 0x1000 2” to read 2
                                                   memory locations starting at
                                                   address 0x1000
                                                 • Type “mwr 0x1000
                                                   0x12345678” to write to
                                                   memory location 0x1000
                                                 • Perform writes to location
                                                   0x1004 also
                                                 • Type “mrd x1000 2” to read 2
                                                   memory locations and verify
                                                   the values that were written
Implementing Processor Systems on Xilinx FPGAs   Page 74
Starting The GNU Debugger
             (GDB)


                                                     • Select the Tools menu
                                                     • Select the Software
                                                       Debugger submenu




Implementing Processor Systems on Xilinx FPGAs   Page 75
Target Selection & Download
                                                           • In GDB, select the
                                                             Run menu and
                                                             choose the Run
                                                             menu item
                                                           • Wait for the Target
                                                             Selection dialog box
                                                             to be displayed
                                                           • Enter the data in the
                                                             dialog box and click
                                                             OK

Implementing Processor Systems on Xilinx FPGAs   Page 76
Stepping in GDB
                                                           • The debugger is
                                                             ready, the program
                                                             counter is at a
                                                             breakpoint at line 5 of
                                                             the source file
                                                           • Select the Control
                                                             menu
                                                           • Select the Step
                                                             submenu


Implementing Processor Systems on Xilinx FPGAs   Page 77
Watching A Variable With GDB
                                                     • Double click on the
                                                       variable count such that it
                                                       is selected
                                                     • Right click and select in
                                                       the submenu to Add
                                                       count to Watch
                                                     • A dialog box is displayed
                                                       which contains the
                                                       variable count and it’s
                                                       contents

Implementing Processor Systems on Xilinx FPGAs   Page 78
Creating a Simple
MicroBlaze System
with XPS
without Base System Builder Wizard
Design Flow

•    Design Entry with Xilinx Platform Studio
•    Generate system netlist with XPS
•    Generate hardware bitstream with XPS
•    Download and sanity check design with XPS and
     XMD




Implementing Processor Systems on Xilinx FPGAs   Page 80
Start Xilinx Platform Studio




Implementing Processor Systems on Xilinx FPGAs   Page 81
Create A New Project
                                                     • Select New Project from the
                                                       Tools menu
                                                     • Enter all the project
                                                       information
                                                     • Click OK
                                                       on this dialog box.
                                                     • Click Yes on the next dialog
                                                       box to start with an empty
                                                       MHS file
Implementing Processor Systems on Xilinx FPGAs   Page 82
Adding New Cores
                                                           • Select the
                                                             Project
                                                             menu
                                                           • Select the
                                                             Add/Edit
                                                             Cores
                                                             submenu




Implementing Processor Systems on Xilinx FPGAs   Page 83
Adding Bus Structures
                                                     • Select the Bus Connections
                                                       Tab
                                                     • Select the
                                                       lmb_v10_v1_00_a bus &
                                                       opb_v20_v1_10_b bus and
                                                       click the Add button
                                                     • Select the
                                                       lmb_v10_v1_00_a bus and
                                                       click the Add button


Implementing Processor Systems on Xilinx FPGAs   Page 84
Adding Basic Peripherals
                                                           • Select the Peripherals
                                                             tab
                                                           • Select the bram_block,
                                                             lmb_bram_if_cntlr,
                                                             microblaze, and
                                                             opb_mdm and click the
                                                             Add button.
                                                           • Select the
                                                             lmb_bram_if_cntlr and
                                                             click the Add button.

Implementing Processor Systems on Xilinx FPGAs   Page 85
Change The Memory Map

                                                           • Edit the Base
                                                             Address and High
                                                             Address for the
                                                             lmb_bram_if_cntlr
                                                             and opb_mdm
                                                             peripherals




Implementing Processor Systems on Xilinx FPGAs   Page 86
Setting Bus Masters & Slaves
                                                           • Select the Bus
                                                             Connections
                                                             tab
                                                           • Set the masters
                                                             and slaves on
                                                             the buses by
                                                             clicking on the
                                                             boxes with an
                                                             ‘s’ and ‘M’


Implementing Processor Systems on Xilinx FPGAs   Page 87
Setting MicroBlaze Parameters
                                                           • Select the Parameters
                                                             tab
                                                           • Select microblaze_0 IP
                                                             instance
                                                           • Select the
                                                             C_DEBUG_ENABLED and
                                                             C_NUMBER_OF_PC_BRK
                                                             parameters and click
                                                             the Add button
                                                           • Edit the parameter
                                                             values
Implementing Processor Systems on Xilinx FPGAs   Page 88
Setting MDM Parameters
                                                           • Select the
                                                             opb_mdm_0 IP
                                                             instance
                                                           • Select the
                                                             C_USE_UART
                                                             parameter and
                                                             click the Add
                                                             button
                                                           • Edit the parameter
                                                             value

Implementing Processor Systems on Xilinx FPGAs   Page 89
Setting LMB Parameters
                                                           • Select the lmb_v10_0
                                                             IP instance
                                                           • Select the
                                                             C_EXT_RESET_HIGH
                                                             parameter and click the
                                                             Add button
                                                           • Edit the parameter
                                                             value
                                                           • Repeat for lmb_v10_1
                                                             IP instance

Implementing Processor Systems on Xilinx FPGAs   Page 90
Setting OPB Parameters

                                                           • Select the opb_v20_0
                                                             IP instance
                                                           • Select the
                                                             C_EXT_RESET_HIGH
                                                             parameter and click the
                                                             Add button
                                                           • Edit the parameter
                                                             value


Implementing Processor Systems on Xilinx FPGAs   Page 91
Connecting The Clock

                                                           • Select the Ports tab
                                                           • Select the LBM_Clk
                                                             and OPB_Clk ports on
                                                             the lmb_v10_0,
                                                             lmb_v10_0 and
                                                             opb_v20_0 IP
                                                             instances and click
                                                             the Add button


Implementing Processor Systems on Xilinx FPGAs   Page 92
Connecting The Reset
                                                           • Select the SYS_Rst
                                                             ports of the
                                                             lmb_v10_0,
                                                             lmb_v10_1, and
                                                             opb_v20_0 IP
                                                             instances and click
                                                             the Add button




Implementing Processor Systems on Xilinx FPGAs   Page 93
Connecting The Reset (2)
                                                           • Select the
                                                             lmb_v10_0,
                                                             lmb_v10_1, and
                                                             opb_v20_0 instances
                                                             on the left side and
                                                             click the Connect
                                                             button
                                                           • Enter sys_rst for the
                                                             net name in the
                                                             dialog box and click
                                                             the OK button
Implementing Processor Systems on Xilinx FPGAs   Page 94
Completing the Add/Edit
          • Click the OK button to set all the items
            changed in the Add/Edit Cores dialog box




Implementing Processor Systems on Xilinx FPGAs   Page 95
Adding I/O
Peripherals to a
System
Adding A UartLite
                                                           • Select the Project
                                                             menu
                                                           • Select the Add/Edit
                                                             Cores submenu
                                                           • Select the opb_uartlite
                                                             and click Add
                                                           • Edit the Base Address
                                                             and High Address of
                                                             the uartlite


Implementing Processor Systems on Xilinx FPGAs   Page 97
Setting UartLite Parameters

                                                           • Select the Parameters
                                                             tab
                                                           • Select the C_CLK_FREQ
                                                             and C_USE_PARITY
                                                             parameters and click the
                                                             Add button
                                                           • Edit the parameter values



Implementing Processor Systems on Xilinx FPGAs   Page 98
Put UartLite On the OPB


                                                           • Select the Bus
                                                             Connections tab
                                                           • Click on the box to mark
                                                             the UartLite as a slave on
                                                             the OPB bus




Implementing Processor Systems on Xilinx FPGAs   Page 99
Connecting UartLite I/O
                                                            • Select the Ports tab
                                                            • Select the RX and
                                                              TX ports of
                                                              opb_uartlite_0 and
                                                              click the Add button
                                                            • Edit the net names
                                                              to be tx and rx for
                                                              the opb_uartlite_0
                                                            • Click OK on the
                                                              dialog box

Implementing Processor Systems on Xilinx FPGAs   Page 100
Adding A Timer
                                                            • Select the Project
                                                              menu
                                                            • Select the Add/Edit
                                                              Cores submenu
                                                            • Select the opb_timer
                                                              and click Add
                                                            • Edit the Base Address
                                                              and High Address of
                                                              the timer


Implementing Processor Systems on Xilinx FPGAs   Page 101
Setting Timer Parameters

                                                            • Select the Parameters
                                                              tab
                                                            • Select the
                                                              C_ONE_TIMER_ONLY
                                                              parameters and click the
                                                              Add button
                                                            • Edit the parameter value



Implementing Processor Systems on Xilinx FPGAs   Page 102
Put Timer On the OPB

                                                            • Select the Bus
                                                              Connections tab
                                                            • Click on the box to mark
                                                              the Timer as a slave on
                                                              the OPB bus




Implementing Processor Systems on Xilinx FPGAs   Page 103
Adding an Interrupt
                      Controller
                                                            • Select the Project
                                                              menu
                                                            • Select the Add/Edit
                                                              Cores submenu
                                                            • Select the opb_intc
                                                              and click Add
                                                            • Edit the Base Address
                                                              and High Address of
                                                              the intc


Implementing Processor Systems on Xilinx FPGAs   Page 104
Put Intc On the OPB

                                                            • Select the Bus
                                                              Connections tab
                                                            • Click on the box to mark
                                                              the Intc as a slave on the
                                                              OPB bus




Implementing Processor Systems on Xilinx FPGAs   Page 105
Connect Intc to MicroBlaze
                                                            • Select Ports tab
                                                            • Add Interrupt input
                                                              of MicroBlaze and
                                                              Irq output of Intc
                                                            • Highlight both of
                                                              these and press
                                                              Connect
                                                            • Name the net,
                                                              select Internal,
                                                              and press OK

Implementing Processor Systems on Xilinx FPGAs   Page 106
Connect Intc to MicroBlaze




Implementing Processor Systems on Xilinx FPGAs   Page 107
Connect Timer to Intc
                                                            • Select Ports tab
                                                            • Add Interrupt
                                                              output of Timer
                                                              and Intr input of
                                                              Intc
                                                            • Highlight both of
                                                              these and press
                                                              Connect
                                                            • Name the net,
                                                              select Internal,
                                                              and press OK
Implementing Processor Systems on Xilinx FPGAs   Page 108
Connect Timer to Intc




Implementing Processor Systems on Xilinx FPGAs   Page 109
Software
Development with
the EDK and XPS
EDK System Design
                        Comprehensive Tool Chain
Standard Embedded SW                                                            Standard FPGA HW
   Development Flow                                                             Development Flow

            C/C++ Code                                Xilinx Platform         VHDL/Verilog
                                                       Studio (XPS)
         Compiler/Linker                                                       Synthesizer

            (Simulator)                                                         Simulator

           Object Code                                                        Place & Route
                                                      Data2BlockRAM
                    ?                                                              ?
   code                     code                        Bitstream
   in off-chip              in on-chip
   memory                   memory                         Download to FPGA
  Download to Board & FPGA

                 Debugger                       RTOS, Board Support Package
                                                                              ChipScope Tools



     Implementing Processor Systems on Xilinx FPGAs       Page 111
Building Software in XPS
   • XPS is an Integrated Development Environment
     (IDE) similar to other products with the primary
     difference being it allows the user to build
     hardware and software.
   • The GNU tools (compiler, linker, etc.) including
     GDB are used by XPS for software development.
   • The GNU tools are not native Windows tools such
     that they execute within a Xygwin (Xilinx Cygwin)
     environment.

Implementing Processor Systems on Xilinx FPGAs   Page 112
XPS Project Directory
                    Structure
     • A project within XPS is a directory that contains
       multiple subdirectories.
     • The code subdirectory is created by the user and
       contains application source code.
     • The include files, drivers, and libraries are located
       in a directory based on the instance name of the
       microprocessor in the project.


Implementing Processor Systems on Xilinx FPGAs   Page 113
XPS Example Project
                     Directory




Implementing Processor Systems on Xilinx FPGAs   Page 114
Library Generation

• XPS compiles device drivers and C run-time CRT
  into a single library that is then linked with a user
  application program.
• Libgen is the tool executed from within XPS or
  from a command line, that copies the library
  source files and device driver source files to the
  project directory to build the library.


Implementing Processor Systems on Xilinx FPGAs   Page 115
Command Line Builds

    • XPS generates a single make file, system.make,
      that can be used to build the hardware or software
      from the command line of a Xygwin window.
    • This make file could be used to create a build
      environment for software development groups that
      build from the command line.



Implementing Processor Systems on Xilinx FPGAs   Page 116
Xilinx Microprocessor
                    Debugger (XMD)
• Interfaces GDB to a “target”
• Supports script interface for built-in commands
• Allows debug with or without a ROM monitor
   – MDM target for true JTAG
   – UART target for ROM monitor (xmd-stub)
   – SIM target for instruction set simulator

                                                                UART
   GDB                                XMD                              MDM
                                                                SIM

    Implementing Processor Systems on Xilinx FPGAs   Page 117
Microprocessor Debug
                Module (MDM)
   •    JTAG debug using BSCAN
   •    Software non-intrusive debugging
   •    Read/Write access to internal registers
   •    Access to all addressable memory
   •    Hardware single-stepping
   •    Hardware breakpoints - configurable (max 16)
   •    Hardware read/write address/data watchpoints
         – configurable (max 8)


Implementing Processor Systems on Xilinx FPGAs   Page 118
Device Drivers &
Software
Infrastructure
Device Drivers for FPGA
                 Designs
  • Hardware is parameterizable
         – Capabilities and features may change every build
  • FPGA space is limited
         – User needs flexible driver architecture
         – Internal memory solution as well as external memory solution
  • Processor may change
         – Portability of driver is key




Implementing Processor Systems on Xilinx FPGAs   Page 120
Device Driver Goals

• Portability/Reusability
      – Drivers are to be portable across many different
        RTOSs, microprocessors, and toolsets
      – Minimize development effort
• Out-of-the-box solution for customers




Implementing Processor Systems on Xilinx FPGAs   Page 121
Driver Design
                            Considerations
Programming Languages
• Assembly Language
      – Minimized to allow maximum portability between microprocessors
      – Only boot code, which executes prior to the C/C++ runtime system, is
        typically necessary to be assembly language
      – Located in separate source files to help isolate it, as opposed to in-line
        assembly language in the C source code
• C Programming Language
      – The C programming language is the most utilized language for embedded
        systems
      – In order to support the largest number of customers, the first
        implementation utilizes the C programming language

Implementing Processor Systems on Xilinx FPGAs   Page 122
Driver Design
                            Considerations
• Object Oriented Design
      – Emphasize data abstraction, data hiding, and encapsulation in
        addition to greater potential for code reuse and ease of
        maintenance
      – Provides an easier transition from non-object oriented
        languages such as C to more object oriented languages such
        as C++ and Java
• Delivery Format
      – Delivered to customers in source code format, allowing it to be
        built and optimized for a wide range of microprocessors using
        customer selected tools

Implementing Processor Systems on Xilinx FPGAs   Page 123
Device Driver Architecture
• Component based object
                                                                  Layer 2 Drivers
  oriented design implemented
                                                                 (RTOS Adapters)
  in ANSI C
• A device driver supports                                      Layer 1 (High Level)
  multiple instances of a device                                      Drivers
• Layered device driver                                         Layer 0 (Low Level)
  architecture to allow user                                         Drivers
  selectable features and size



    Implementing Processor Systems on Xilinx FPGAs   Page 124
Device Driver Architecture
                                          (continued)

  • Source code is provided
  • Layer 0 and Layer 1 are OS-independent
  • Device drivers in all layers have common characteristics
  • Primitive data types for portability (Xuint8, Xuint16,
    Xuint32, etc.), in xbasic_types.h
  • Isolation of I/O accesses for portability (XIo_In8(),
    XIo_Out8(), etc.), in xio.h
  • Coding and documentation conventions


Implementing Processor Systems on Xilinx FPGAs   Page 125
Layer 0, Low Level Drivers
• Interface contained in <driver>_l.h file
• Designed for a small system, typically for internal memory
  of an FPGA.
• Small memory footprint
• No error checking performed
• Supports primary device features only, not comprehensive
• Polled I/O, blocking functions




Implementing Processor Systems on Xilinx FPGAs   Page 126
Layer 1, High Level Drivers
• Interface contained in <driver>.h file
• Designed to allow a developer to utilize all features of a
  device
• Larger memory footprint
• Robust error checking such as asserting input arguments
• Supports configuration parameters in <driver>_g.c
• Interrupt driven I/O, non-blocking functions
   – Interrupt service routines are provided


Implementing Processor Systems on Xilinx FPGAs   Page 127
Layer 2 Drivers,
                            RTOS Adapters
 • Interface contained in <driver>_adapter.h file.
 • Converts the Layer 1 device driver interface to an
   interface that matches the device driver scheme of the
   RTOS.
 • Contains calls specific to the RTOS
 • Can use RTOS features such as memory management,
   threading, inter-task communication, etc.



Implementing Processor Systems on Xilinx FPGAs   Page 128
RTOS Independent
                    Device Drivers
• Driver
      – Responsible for interfacing to the device (peripheral).
        It encapsulates communication to the device
      – Designed to be portable across processor
        architectures and operating systems
• Adapter
      – Integrates the driver into an operating system
      – Satisfies the "plug-in" requirements of the operating
        system
      – Needs to be rewritten for each OS
Implementing Processor Systems on Xilinx FPGAs   Page 129
RTOS Support
 • Xilinx supports VxWorks 5.4/5.5 for PowerPC in-house
 • 3rd party support includes MontaVista Linux (PPC), ATI
   Nucleus, uCos, ucLinux
 • VxWorks integration:
       – All device drivers can be used directly by the application
       – Some device drivers tightly integrated into VxWorks
              •   UARTs to standard and file I/O
              •   Ethernet to network stack (Enhanced Network Driver)
              •   Interrupt controller
              •   System ACE into VxWorks filesystem interface
 • Automatic Tornado BSP generation using EDK


Implementing Processor Systems on Xilinx FPGAs   Page 130
Naming Conventions
• A common name is used for all external identifiers of the
  device driver
   – <driver_name>_FunctionName();
   – <driver_name>_DataType;
• A common name is used for all source files of the device
  driver for ease of use
   –   <driver_name>_l.h       low level driver interface definition
   –   <driver_name>.h high level driver interface definition
   –   <driver_name>.c primary source file
   –   <driver_name>_g.c       configuration table source file
   –   <driver_name>_intr.c    interrupt processing source file

  Implementing Processor Systems on Xilinx FPGAs   Page 131
Multiple Instance Details

• Multiple instances of a single device (such as an Ethernet
  MAC) typically exist in a system
• A single device driver handles all instances of the device
• A layer 1 device driver uses a data type that is passed as
  the first argument to each function of the driver. The data
  type contains information about each device instance
  such as the base address



 Implementing Processor Systems on Xilinx FPGAs   Page 132
Example Layer 0 Device
                     Driver API
• Each function of Layer 0 uses the base address of the
  device as the first argument
• No state information is kept by the driver and the user
  must manage multiple instances of the device
• void XEmac_mSetControlReg(Xuint32 BaseAddress, Xuint32 Mask)
• void XEmac_SendFrame(Xuint32 BaseAddress, Xuint8 *FramePtr, int Size)
• int XEmac_RecvFrame(Xuint32 BaseAddress, Xuint8 *FramePtr)



    Implementing Processor Systems on Xilinx FPGAs   Page 133
Example Layer 1 Device
              Driver API
• Each function of Layer 1 uses an instance pointer as
     the first argument
•    XStatus XEmac_Initialize(XEmac *InstancePtr, Xuint16 DeviceId)
•    XStatus XEmac_Start(XEmac *InstancePtr)
•    XStatus XEmac_Stop(XEmac *InstancePtr)
•    void XEmac_Reset(XEmac *InstancePtr)
•    XStatus XEmac_SelfTest(XEmac *InstancePtr)




Implementing Processor Systems on Xilinx FPGAs   Page 134
Example Layer 1 Device Driver
   API For FIFO Interrupt Support
• XStatus XEmac_FifoSend(XEmac *InstancePtr, Xuint8 *BufPtr, Xuint32
  ByteCount);
• XStatus XEmac_FifoRecv(XEmac *InstancePtr, Xuint8 *BufPtr, Xuint32
  *ByteCountPtr);
• void XEmac_SetFifoRecvHandler(XEmac *InstancePtr, void *CallBackRef,
  XEmac_FifoHandler FuncPtr);
• void XEmac_SetFifoSendHandler(XEmac *InstancePtr, void *CallBackRef,
  XEmac_FifoHandler FuncPtr);
• void XEmac_IntrHandlerFifo(void *InstancePtr); /* interrupt handler */



     Implementing Processor Systems on Xilinx FPGAs   Page 135
Device Driver & System
               Configuration
 • xparameters.h contains important system parameters
   used by the drivers & the BSP
 • Parameters for each device may include a device ID, a
   base address, an interrupt identifier, and any device
   unique parameters
 • This file is the best place to start when trying to
   understand a system
 • Libgen automatically generates xparameters.h


Implementing Processor Systems on Xilinx FPGAs   Page 136
Example xparameters.h File
 • The following example is for a system that has an
   Ethernet MAC device at address 0x60000000. The name
   of the hardware instance is opb_ethernet.

      #define XPAR_XEMAC_NUM_INSTANCES 1
      #define XPAR_OPB_ETHERNET_BASEADDR 0x60000000
      #define XPAR_OPB_ETHERNET_HIGHADDR 0x60003FFF
      #define XPAR_OPB_ETHERNET_DEVICE_ID 0
      #define XPAR_OPB_ETHERNET_ERR_COUNT_EXIST 1
      #define XPAR_OPB_ETHERNET_DMA_PRESENT 3
      #define XPAR_OPB_ETHERNET_MII_EXIST 1

Implementing Processor Systems on Xilinx FPGAs   Page 137
Device Driver Configuration
            Specifics
• Constants describing each device instance are contained in
  xparameters.h
• These constants are also inserted into a configuration table for
  each device driver contained in the <driver_name>_g.c
• The device driver looks up information for the specific instance
  of the device when it is initialized
• The data type definition for the configuration data is contained
  in the <driver_name>.h file
• Libgen generates the <driver_name>_g.c file for each device
  driver

  Implementing Processor Systems on Xilinx FPGAs   Page 138
Device Driver Configuration
             Example
                     • typedef struct
From                       {
                                    Xuint16 DeviceId;
xemac.h                             Xuint32 BaseAddress;
source file                         Xboolean HasCounters;
                                    Xuint8 IpIfDmaConfig;
                                    Xboolean HasMii;
                           } XEmac_Config;
                     • XEmac_Config XEmac_ConfigTable[] =
                           {
From                                {
xemac_g.c                                        XPAR_OPB_ETHERNET_DEVICE_ID,
                                                 XPAR_OPB_ETHERNET_BASEADDR,
source file                                      XPAR_OPB_ETHERNET_ERR_COUNT_EXIST,
                                                 XPAR_OPB_ETHERNET_DMA_PRESENT,
                                                 XPAR_OPB_ETHERNET_MII_EXIST
                                    }
  Implementing Processor Systems on Xilinx FPGAs     Page 139
                           };
Training Lecture
Training Lecture
Training Lecture
Training Lecture
Training Lecture
Training Lecture

Weitere ähnliche Inhalte

Was ist angesagt?

Processors used in System on chip
Processors used in System on chip Processors used in System on chip
Processors used in System on chip A B Shinde
 
SOC Processors Used in SOC
SOC Processors Used in SOCSOC Processors Used in SOC
SOC Processors Used in SOCA B Shinde
 
SOC Application Studies: Image Compression
SOC Application Studies: Image CompressionSOC Application Studies: Image Compression
SOC Application Studies: Image CompressionA B Shinde
 
Developing an embedded video application on dual Linux + FPGA architecture
Developing an embedded video application on dual Linux + FPGA architectureDeveloping an embedded video application on dual Linux + FPGA architecture
Developing an embedded video application on dual Linux + FPGA architectureChristian Charreyre
 
Open Hardware and Future Computing
Open Hardware and Future ComputingOpen Hardware and Future Computing
Open Hardware and Future ComputingGanesan Narayanasamy
 
SOC System Design Approach
SOC System Design ApproachSOC System Design Approach
SOC System Design ApproachA B Shinde
 
System on chip architectures
System on chip architecturesSystem on chip architectures
System on chip architecturesA B Shinde
 
System On Chip
System On ChipSystem On Chip
System On ChipA B Shinde
 
System On Chip (SOC)
System On Chip (SOC)System On Chip (SOC)
System On Chip (SOC)Shivam Gupta
 
A Perspective on the Future of Computer Architecture
A Perspective on the  Future of Computer ArchitectureA Perspective on the  Future of Computer Architecture
A Perspective on the Future of Computer ArchitectureARCCN
 
CFD acceleration with FPGA (byteLAKE's presentation from PPAM 2019)
CFD acceleration with FPGA (byteLAKE's presentation from PPAM 2019)CFD acceleration with FPGA (byteLAKE's presentation from PPAM 2019)
CFD acceleration with FPGA (byteLAKE's presentation from PPAM 2019)byteLAKE
 
Security issues in FPGA based systems.
Security issues in FPGA based systems.Security issues in FPGA based systems.
Security issues in FPGA based systems.Rajeev Verma
 
SOC Chip Basics
SOC Chip BasicsSOC Chip Basics
SOC Chip BasicsA B Shinde
 

Was ist angesagt? (20)

Processors used in System on chip
Processors used in System on chip Processors used in System on chip
Processors used in System on chip
 
SOC Processors Used in SOC
SOC Processors Used in SOCSOC Processors Used in SOC
SOC Processors Used in SOC
 
SOC Application Studies: Image Compression
SOC Application Studies: Image CompressionSOC Application Studies: Image Compression
SOC Application Studies: Image Compression
 
Developing an embedded video application on dual Linux + FPGA architecture
Developing an embedded video application on dual Linux + FPGA architectureDeveloping an embedded video application on dual Linux + FPGA architecture
Developing an embedded video application on dual Linux + FPGA architecture
 
Open Hardware and Future Computing
Open Hardware and Future ComputingOpen Hardware and Future Computing
Open Hardware and Future Computing
 
System on Chip (SoC)
System on Chip (SoC)System on Chip (SoC)
System on Chip (SoC)
 
SOC System Design Approach
SOC System Design ApproachSOC System Design Approach
SOC System Design Approach
 
14 284-291
14 284-29114 284-291
14 284-291
 
System on chip architectures
System on chip architecturesSystem on chip architectures
System on chip architectures
 
System-on-Chip
System-on-ChipSystem-on-Chip
System-on-Chip
 
System On Chip
System On ChipSystem On Chip
System On Chip
 
A2O Core implementation on FPGA
A2O Core implementation on FPGAA2O Core implementation on FPGA
A2O Core implementation on FPGA
 
System On Chip (SOC)
System On Chip (SOC)System On Chip (SOC)
System On Chip (SOC)
 
A Perspective on the Future of Computer Architecture
A Perspective on the  Future of Computer ArchitectureA Perspective on the  Future of Computer Architecture
A Perspective on the Future of Computer Architecture
 
CFD acceleration with FPGA (byteLAKE's presentation from PPAM 2019)
CFD acceleration with FPGA (byteLAKE's presentation from PPAM 2019)CFD acceleration with FPGA (byteLAKE's presentation from PPAM 2019)
CFD acceleration with FPGA (byteLAKE's presentation from PPAM 2019)
 
Asic
AsicAsic
Asic
 
27 multicore
27 multicore27 multicore
27 multicore
 
Security issues in FPGA based systems.
Security issues in FPGA based systems.Security issues in FPGA based systems.
Security issues in FPGA based systems.
 
SOC Chip Basics
SOC Chip BasicsSOC Chip Basics
SOC Chip Basics
 
FPGA Introduction
FPGA IntroductionFPGA Introduction
FPGA Introduction
 

Andere mochten auch

Romain Rogister DSP ppt V2003
Romain  Rogister  DSP  ppt V2003Romain  Rogister  DSP  ppt V2003
Romain Rogister DSP ppt V2003Romain Rogister
 
Central Processing Unit CUP by madridista ujjwal
Central Processing Unit CUP by madridista ujjwalCentral Processing Unit CUP by madridista ujjwal
Central Processing Unit CUP by madridista ujjwalUjwal Limbu
 
Data transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorData transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorvishalgohel12195
 
Microprocessors and controllers
Microprocessors and controllersMicroprocessors and controllers
Microprocessors and controllersWendy Hemo
 
Cpu scheduling(suresh)
Cpu scheduling(suresh)Cpu scheduling(suresh)
Cpu scheduling(suresh)Nagarajan
 
Intel Roadmap 2010
Intel Roadmap 2010Intel Roadmap 2010
Intel Roadmap 2010Umair Mohsin
 
Chapter 4 Microprocessor CPU
Chapter 4 Microprocessor CPUChapter 4 Microprocessor CPU
Chapter 4 Microprocessor CPUaskme
 
Digital signal processing
Digital signal processingDigital signal processing
Digital signal processingVedavyas PBurli
 
Internal components of PC
Internal components of PCInternal components of PC
Internal components of PCTushar B Kute
 
How To Write Your Research Dissertation
How To Write Your Research DissertationHow To Write Your Research Dissertation
How To Write Your Research DissertationChris Jobling
 
St Valentine’S Day
St Valentine’S DaySt Valentine’S Day
St Valentine’S DayJulia R
 
A tradução especializada: Um motor de desenvolvimento
A tradução especializada: Um motor de desenvolvimentoA tradução especializada: Um motor de desenvolvimento
A tradução especializada: Um motor de desenvolvimentoRosário Durão
 

Andere mochten auch (20)

Intel
IntelIntel
Intel
 
Cpu spec
Cpu specCpu spec
Cpu spec
 
Romain Rogister DSP ppt V2003
Romain  Rogister  DSP  ppt V2003Romain  Rogister  DSP  ppt V2003
Romain Rogister DSP ppt V2003
 
Introduction of cpu
Introduction of cpuIntroduction of cpu
Introduction of cpu
 
Central Processing Unit CUP by madridista ujjwal
Central Processing Unit CUP by madridista ujjwalCentral Processing Unit CUP by madridista ujjwal
Central Processing Unit CUP by madridista ujjwal
 
Data transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processorData transfer instruction set of 8085 micro processor
Data transfer instruction set of 8085 micro processor
 
Arrandale presentation1
Arrandale presentation1Arrandale presentation1
Arrandale presentation1
 
Intel i7
Intel i7Intel i7
Intel i7
 
Microprocessors and controllers
Microprocessors and controllersMicroprocessors and controllers
Microprocessors and controllers
 
Cpu scheduling(suresh)
Cpu scheduling(suresh)Cpu scheduling(suresh)
Cpu scheduling(suresh)
 
Processor types
Processor typesProcessor types
Processor types
 
Cpu
CpuCpu
Cpu
 
Intel Roadmap 2010
Intel Roadmap 2010Intel Roadmap 2010
Intel Roadmap 2010
 
Chapter 4 Microprocessor CPU
Chapter 4 Microprocessor CPUChapter 4 Microprocessor CPU
Chapter 4 Microprocessor CPU
 
Digital signal processing
Digital signal processingDigital signal processing
Digital signal processing
 
Internal components of PC
Internal components of PCInternal components of PC
Internal components of PC
 
Crusoe processor
Crusoe    processorCrusoe    processor
Crusoe processor
 
How To Write Your Research Dissertation
How To Write Your Research DissertationHow To Write Your Research Dissertation
How To Write Your Research Dissertation
 
St Valentine’S Day
St Valentine’S DaySt Valentine’S Day
St Valentine’S Day
 
A tradução especializada: Um motor de desenvolvimento
A tradução especializada: Um motor de desenvolvimentoA tradução especializada: Um motor de desenvolvimento
A tradução especializada: Um motor de desenvolvimento
 

Ähnlich wie Training Lecture

Int 1010 Tcp Offload
Int 1010 Tcp OffloadInt 1010 Tcp Offload
Int 1010 Tcp Offloadshari323
 
15.00 hr van Hilten
15.00 hr van Hilten15.00 hr van Hilten
15.00 hr van HiltenThemadagen
 
Introducing the ADSP BF609 Blackfin Processors
Introducing the ADSP BF609 Blackfin ProcessorsIntroducing the ADSP BF609 Blackfin Processors
Introducing the ADSP BF609 Blackfin ProcessorsAnalog Devices, Inc.
 
Programmable logic device (PLD)
Programmable logic device (PLD)Programmable logic device (PLD)
Programmable logic device (PLD)Sɐɐp ɐɥɯǝp
 
QsNetIII, An HPC Interconnect For Peta Scale Systems
QsNetIII, An HPC Interconnect For Peta Scale SystemsQsNetIII, An HPC Interconnect For Peta Scale Systems
QsNetIII, An HPC Interconnect For Peta Scale SystemsFederica Pisani
 
FPGA Camp - National Instruments Presentation
FPGA Camp - National Instruments PresentationFPGA Camp - National Instruments Presentation
FPGA Camp - National Instruments PresentationFPGA Central
 
SoC~FPGA~ASIC~Embedded
SoC~FPGA~ASIC~EmbeddedSoC~FPGA~ASIC~Embedded
SoC~FPGA~ASIC~EmbeddedChili.CHIPS
 
Building Network Elements Using Intel Network Processors and ATCA
Building Network Elements Using Intel Network Processors and ATCABuilding Network Elements Using Intel Network Processors and ATCA
Building Network Elements Using Intel Network Processors and ATCAJoe Buzzanga
 
1 emc vs_compellent
1 emc vs_compellent1 emc vs_compellent
1 emc vs_compellentjyoti_j2
 
Polyteda: Power DRC/LVS, October 2016
Polyteda: Power DRC/LVS, October 2016Polyteda: Power DRC/LVS, October 2016
Polyteda: Power DRC/LVS, October 2016Oleksandra Nazola
 
POLYTEDA: Power DRC/LVS, June 2017
POLYTEDA: Power DRC/LVS, June 2017POLYTEDA: Power DRC/LVS, June 2017
POLYTEDA: Power DRC/LVS, June 2017Oleksandra Nazola
 
Q40 - Quad Core Sealed Server
Q40 - Quad Core Sealed ServerQ40 - Quad Core Sealed Server
Q40 - Quad Core Sealed ServerAPMLinked_In
 
Nextserver Evo
Nextserver EvoNextserver Evo
Nextserver Evodellarocco
 
Polyteda Power DRC/LVS July 2016
Polyteda Power DRC/LVS July 2016Polyteda Power DRC/LVS July 2016
Polyteda Power DRC/LVS July 2016Oleksandra Nazola
 

Ähnlich wie Training Lecture (20)

Int 1010 Tcp Offload
Int 1010 Tcp OffloadInt 1010 Tcp Offload
Int 1010 Tcp Offload
 
15.00 hr van Hilten
15.00 hr van Hilten15.00 hr van Hilten
15.00 hr van Hilten
 
Cyclone iii
Cyclone iiiCyclone iii
Cyclone iii
 
Introducing the ADSP BF609 Blackfin Processors
Introducing the ADSP BF609 Blackfin ProcessorsIntroducing the ADSP BF609 Blackfin Processors
Introducing the ADSP BF609 Blackfin Processors
 
Programmable logic device (PLD)
Programmable logic device (PLD)Programmable logic device (PLD)
Programmable logic device (PLD)
 
QsNetIII, An HPC Interconnect For Peta Scale Systems
QsNetIII, An HPC Interconnect For Peta Scale SystemsQsNetIII, An HPC Interconnect For Peta Scale Systems
QsNetIII, An HPC Interconnect For Peta Scale Systems
 
FPGA Camp - National Instruments Presentation
FPGA Camp - National Instruments PresentationFPGA Camp - National Instruments Presentation
FPGA Camp - National Instruments Presentation
 
SoC~FPGA~ASIC~Embedded
SoC~FPGA~ASIC~EmbeddedSoC~FPGA~ASIC~Embedded
SoC~FPGA~ASIC~Embedded
 
nios.ppt
nios.pptnios.ppt
nios.ppt
 
To Infiniband and Beyond
To Infiniband and BeyondTo Infiniband and Beyond
To Infiniband and Beyond
 
Building Network Elements Using Intel Network Processors and ATCA
Building Network Elements Using Intel Network Processors and ATCABuilding Network Elements Using Intel Network Processors and ATCA
Building Network Elements Using Intel Network Processors and ATCA
 
1 emc vs_compellent
1 emc vs_compellent1 emc vs_compellent
1 emc vs_compellent
 
Rp 70 Xrt Ds
Rp 70 Xrt DsRp 70 Xrt Ds
Rp 70 Xrt Ds
 
Fpga technology
Fpga technologyFpga technology
Fpga technology
 
Polyteda: Power DRC/LVS, October 2016
Polyteda: Power DRC/LVS, October 2016Polyteda: Power DRC/LVS, October 2016
Polyteda: Power DRC/LVS, October 2016
 
POLYTEDA: Power DRC/LVS, June 2017
POLYTEDA: Power DRC/LVS, June 2017POLYTEDA: Power DRC/LVS, June 2017
POLYTEDA: Power DRC/LVS, June 2017
 
Q40 - Quad Core Sealed Server
Q40 - Quad Core Sealed ServerQ40 - Quad Core Sealed Server
Q40 - Quad Core Sealed Server
 
Nextserver Evo
Nextserver EvoNextserver Evo
Nextserver Evo
 
Nextserver Evo
Nextserver EvoNextserver Evo
Nextserver Evo
 
Polyteda Power DRC/LVS July 2016
Polyteda Power DRC/LVS July 2016Polyteda Power DRC/LVS July 2016
Polyteda Power DRC/LVS July 2016
 

Mehr von iuui

The C Preprocessor
The C PreprocessorThe C Preprocessor
The C Preprocessoriuui
 
Expanding The Micro Blaze System
Expanding  The Micro Blaze  SystemExpanding  The Micro Blaze  System
Expanding The Micro Blaze Systemiuui
 
L C D Demo Cho Microblaze
L C D Demo Cho MicroblazeL C D Demo Cho Microblaze
L C D Demo Cho Microblazeiuui
 
Ht N Hung
Ht N HungHt N Hung
Ht N Hungiuui
 
Micro Blaze C Reference
Micro Blaze C ReferenceMicro Blaze C Reference
Micro Blaze C Referenceiuui
 
Tao Rom S3 Starter Kit Flash
Tao Rom S3 Starter Kit FlashTao Rom S3 Starter Kit Flash
Tao Rom S3 Starter Kit Flashiuui
 

Mehr von iuui (6)

The C Preprocessor
The C PreprocessorThe C Preprocessor
The C Preprocessor
 
Expanding The Micro Blaze System
Expanding  The Micro Blaze  SystemExpanding  The Micro Blaze  System
Expanding The Micro Blaze System
 
L C D Demo Cho Microblaze
L C D Demo Cho MicroblazeL C D Demo Cho Microblaze
L C D Demo Cho Microblaze
 
Ht N Hung
Ht N HungHt N Hung
Ht N Hung
 
Micro Blaze C Reference
Micro Blaze C ReferenceMicro Blaze C Reference
Micro Blaze C Reference
 
Tao Rom S3 Starter Kit Flash
Tao Rom S3 Starter Kit FlashTao Rom S3 Starter Kit Flash
Tao Rom S3 Starter Kit Flash
 

Kürzlich hochgeladen

ARCHITECTURAL PORTFOLIO CRISTOBAL HERAUD 2024.pdf
ARCHITECTURAL PORTFOLIO CRISTOBAL HERAUD 2024.pdfARCHITECTURAL PORTFOLIO CRISTOBAL HERAUD 2024.pdf
ARCHITECTURAL PORTFOLIO CRISTOBAL HERAUD 2024.pdfCristobalHeraud
 
10 must-have Chrome extensions for designers
10 must-have Chrome extensions for designers10 must-have Chrome extensions for designers
10 must-have Chrome extensions for designersPixeldarts
 
Sharif's 9-BOX Monitoring Model for Adaptive Programme Management
Sharif's 9-BOX Monitoring Model for Adaptive Programme ManagementSharif's 9-BOX Monitoring Model for Adaptive Programme Management
Sharif's 9-BOX Monitoring Model for Adaptive Programme ManagementMd. Shariful Hoque
 
STITCH: HOW MIGHT WE PROMOTE AN EQUITABLE AND INCLUSIVE URBAN LIFESTYLE PRIOR...
STITCH: HOW MIGHT WE PROMOTE AN EQUITABLE AND INCLUSIVE URBAN LIFESTYLE PRIOR...STITCH: HOW MIGHT WE PROMOTE AN EQUITABLE AND INCLUSIVE URBAN LIFESTYLE PRIOR...
STITCH: HOW MIGHT WE PROMOTE AN EQUITABLE AND INCLUSIVE URBAN LIFESTYLE PRIOR...Pranav Subramanian
 
guest bathroom white and blue ssssssssss
guest bathroom white and blue ssssssssssguest bathroom white and blue ssssssssss
guest bathroom white and blue ssssssssssNadaMohammed714321
 
PORTFOLIO 2024_ANASTASIYA KUDINOVA / EXTENDED VERSION
PORTFOLIO 2024_ANASTASIYA KUDINOVA / EXTENDED VERSIONPORTFOLIO 2024_ANASTASIYA KUDINOVA / EXTENDED VERSION
PORTFOLIO 2024_ANASTASIYA KUDINOVA / EXTENDED VERSIONAnastasiya Kudinova
 
CAPITAL GATE CASE STUDY -regional case study.pdf
CAPITAL GATE CASE STUDY -regional case study.pdfCAPITAL GATE CASE STUDY -regional case study.pdf
CAPITAL GATE CASE STUDY -regional case study.pdfAlasAlthaher
 
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...Associazione Digital Days
 
FW25-26 Knit Cut & Sew Trend Book Peclers Paris
FW25-26 Knit Cut & Sew Trend Book Peclers ParisFW25-26 Knit Cut & Sew Trend Book Peclers Paris
FW25-26 Knit Cut & Sew Trend Book Peclers ParisPeclers Paris
 
Exploring Tehran's Architectural Marvels: A Glimpse into Vilaas Studio's Dyna...
Exploring Tehran's Architectural Marvels: A Glimpse into Vilaas Studio's Dyna...Exploring Tehran's Architectural Marvels: A Glimpse into Vilaas Studio's Dyna...
Exploring Tehran's Architectural Marvels: A Glimpse into Vilaas Studio's Dyna...Yantram Animation Studio Corporation
 
Imagist3D Architectural and Interior Rendering Portfolio
Imagist3D Architectural and Interior Rendering PortfolioImagist3D Architectural and Interior Rendering Portfolio
Imagist3D Architectural and Interior Rendering PortfolioAlinaLau2
 
How Apple strives for the perfect sky and revives cities
How Apple strives for the perfect sky and revives citiesHow Apple strives for the perfect sky and revives cities
How Apple strives for the perfect sky and revives citiesThomas Schielke
 
PORTFOLIO 2024 ANASTASIYA KUDINOVA
PORTFOLIO 2024       ANASTASIYA KUDINOVAPORTFOLIO 2024       ANASTASIYA KUDINOVA
PORTFOLIO 2024 ANASTASIYA KUDINOVAAnastasiya Kudinova
 
Karim apartment ideas 02 ppppppppppppppp
Karim apartment ideas 02 pppppppppppppppKarim apartment ideas 02 ppppppppppppppp
Karim apartment ideas 02 pppppppppppppppNadaMohammed714321
 
ArtWaves 2024 - embracing Curves in Modern Homes
ArtWaves 2024 - embracing Curves in Modern HomesArtWaves 2024 - embracing Curves in Modern Homes
ArtWaves 2024 - embracing Curves in Modern HomesVellyslav Petrov
 
The spirit of digital place - game worlds and architectural phenomenology
The spirit of digital place - game worlds and architectural phenomenologyThe spirit of digital place - game worlds and architectural phenomenology
The spirit of digital place - game worlds and architectural phenomenologyChristopher Totten
 
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.ppt
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.pptMaking and Unmaking of Chandigarh - A City of Two Plans2-4-24.ppt
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.pptJIT KUMAR GUPTA
 
Piece by Piece Magazine
Piece by Piece Magazine                      Piece by Piece Magazine
Piece by Piece Magazine CharlottePulte
 
ALISIA: HOW MIGHT WE ACHIEVE HIGH ENVIRONMENTAL PERFORMANCE WHILE MAINTAINING...
ALISIA: HOW MIGHT WE ACHIEVE HIGH ENVIRONMENTAL PERFORMANCE WHILE MAINTAINING...ALISIA: HOW MIGHT WE ACHIEVE HIGH ENVIRONMENTAL PERFORMANCE WHILE MAINTAINING...
ALISIA: HOW MIGHT WE ACHIEVE HIGH ENVIRONMENTAL PERFORMANCE WHILE MAINTAINING...Pranav Subramanian
 

Kürzlich hochgeladen (20)

ARCHITECTURAL PORTFOLIO CRISTOBAL HERAUD 2024.pdf
ARCHITECTURAL PORTFOLIO CRISTOBAL HERAUD 2024.pdfARCHITECTURAL PORTFOLIO CRISTOBAL HERAUD 2024.pdf
ARCHITECTURAL PORTFOLIO CRISTOBAL HERAUD 2024.pdf
 
10 must-have Chrome extensions for designers
10 must-have Chrome extensions for designers10 must-have Chrome extensions for designers
10 must-have Chrome extensions for designers
 
Sharif's 9-BOX Monitoring Model for Adaptive Programme Management
Sharif's 9-BOX Monitoring Model for Adaptive Programme ManagementSharif's 9-BOX Monitoring Model for Adaptive Programme Management
Sharif's 9-BOX Monitoring Model for Adaptive Programme Management
 
STITCH: HOW MIGHT WE PROMOTE AN EQUITABLE AND INCLUSIVE URBAN LIFESTYLE PRIOR...
STITCH: HOW MIGHT WE PROMOTE AN EQUITABLE AND INCLUSIVE URBAN LIFESTYLE PRIOR...STITCH: HOW MIGHT WE PROMOTE AN EQUITABLE AND INCLUSIVE URBAN LIFESTYLE PRIOR...
STITCH: HOW MIGHT WE PROMOTE AN EQUITABLE AND INCLUSIVE URBAN LIFESTYLE PRIOR...
 
guest bathroom white and blue ssssssssss
guest bathroom white and blue ssssssssssguest bathroom white and blue ssssssssss
guest bathroom white and blue ssssssssss
 
PORTFOLIO 2024_ANASTASIYA KUDINOVA / EXTENDED VERSION
PORTFOLIO 2024_ANASTASIYA KUDINOVA / EXTENDED VERSIONPORTFOLIO 2024_ANASTASIYA KUDINOVA / EXTENDED VERSION
PORTFOLIO 2024_ANASTASIYA KUDINOVA / EXTENDED VERSION
 
CAPITAL GATE CASE STUDY -regional case study.pdf
CAPITAL GATE CASE STUDY -regional case study.pdfCAPITAL GATE CASE STUDY -regional case study.pdf
CAPITAL GATE CASE STUDY -regional case study.pdf
 
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...
Giulio Michelon, Founder di @Belka – “Oltre le Stime: Sviluppare una Mentalit...
 
FW25-26 Knit Cut & Sew Trend Book Peclers Paris
FW25-26 Knit Cut & Sew Trend Book Peclers ParisFW25-26 Knit Cut & Sew Trend Book Peclers Paris
FW25-26 Knit Cut & Sew Trend Book Peclers Paris
 
Exploring Tehran's Architectural Marvels: A Glimpse into Vilaas Studio's Dyna...
Exploring Tehran's Architectural Marvels: A Glimpse into Vilaas Studio's Dyna...Exploring Tehran's Architectural Marvels: A Glimpse into Vilaas Studio's Dyna...
Exploring Tehran's Architectural Marvels: A Glimpse into Vilaas Studio's Dyna...
 
Imagist3D Architectural and Interior Rendering Portfolio
Imagist3D Architectural and Interior Rendering PortfolioImagist3D Architectural and Interior Rendering Portfolio
Imagist3D Architectural and Interior Rendering Portfolio
 
How Apple strives for the perfect sky and revives cities
How Apple strives for the perfect sky and revives citiesHow Apple strives for the perfect sky and revives cities
How Apple strives for the perfect sky and revives cities
 
PORTFOLIO 2024 ANASTASIYA KUDINOVA
PORTFOLIO 2024       ANASTASIYA KUDINOVAPORTFOLIO 2024       ANASTASIYA KUDINOVA
PORTFOLIO 2024 ANASTASIYA KUDINOVA
 
Karim apartment ideas 02 ppppppppppppppp
Karim apartment ideas 02 pppppppppppppppKarim apartment ideas 02 ppppppppppppppp
Karim apartment ideas 02 ppppppppppppppp
 
ArtWaves 2024 - embracing Curves in Modern Homes
ArtWaves 2024 - embracing Curves in Modern HomesArtWaves 2024 - embracing Curves in Modern Homes
ArtWaves 2024 - embracing Curves in Modern Homes
 
The spirit of digital place - game worlds and architectural phenomenology
The spirit of digital place - game worlds and architectural phenomenologyThe spirit of digital place - game worlds and architectural phenomenology
The spirit of digital place - game worlds and architectural phenomenology
 
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.ppt
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.pptMaking and Unmaking of Chandigarh - A City of Two Plans2-4-24.ppt
Making and Unmaking of Chandigarh - A City of Two Plans2-4-24.ppt
 
Piece by Piece Magazine
Piece by Piece Magazine                      Piece by Piece Magazine
Piece by Piece Magazine
 
ALISIA: HOW MIGHT WE ACHIEVE HIGH ENVIRONMENTAL PERFORMANCE WHILE MAINTAINING...
ALISIA: HOW MIGHT WE ACHIEVE HIGH ENVIRONMENTAL PERFORMANCE WHILE MAINTAINING...ALISIA: HOW MIGHT WE ACHIEVE HIGH ENVIRONMENTAL PERFORMANCE WHILE MAINTAINING...
ALISIA: HOW MIGHT WE ACHIEVE HIGH ENVIRONMENTAL PERFORMANCE WHILE MAINTAINING...
 
ASME B31.4-2022 estandar ductos año 2022
ASME B31.4-2022 estandar ductos año 2022ASME B31.4-2022 estandar ductos año 2022
ASME B31.4-2022 estandar ductos año 2022
 

Training Lecture

  • 1. EDK Training at University of Toronto Processor IP Team November 2003
  • 2. Table of Contents Introduction and Overview Page 3 PowerPC and MicroBlaze Page 11 Processor IP Page 19 Creating a Simple MicroBlaze System with XPS with Base System Builder Page 49 Creating a Simple MicroBlaze System with XPS without Base System Builder Page 79 Adding I/O Peripherals to a System Page 96 Software Development with the EDK and XPS Page 110 Device Drivers & Software Infrastructure Page 119 Implementing Processor Systems on Xilinx FPGAs Page 2
  • 4. Programmable Logic Evolution XC2000-XC3000 XC4000, Virtex® Virtex-II Virtex-II Pro™ System Platform Platform Block Logic • FPGA Fabric Device Complexity • Block RAM • FPGA Fabric • SelectIO • Block RAM • XCITE Glue Logic Technology • SelectIO • DCM • XCITE Technology • Embedded Multipliers • DCM • PowerPC • Embedded • FPGA Fabric Multipliers • RocketIO • FPGA Fabric • Block RAM 1985 1992 2000 2002 2004 Implementing Processor Systems on Xilinx FPGAs Page 4
  • 5. Xilinx Virtex-II Pro FPGA Setting the Standard in Programmable Logic Advanced FPGA Logic - High performance true 125,000 logic cells dual-port RAM - 10 Mb SelectIO™- Ultra Technology - 1200 I/O Embedded XtremeDSP Functionality - 556 multipliers RocketIO™ High-speed Serial Transceivers - 24 PowerPC™ Processors 400+ MHz Clock Rate - 4 XCITE Digitally Controlled Impedance - Any I/O DCM™ Digital Clock Management - 12 130 nm, 9 layer copper in 300 mm wafer technology Implementing Processor Systems on Xilinx FPGAs Page 5
  • 6. Virtex-II Pro Revolution TM • Up to 24 Serial Transceivers – 622 Mbps to 3.125 Gbps • Up to 4 PowerPC 405 Processors – Industry standard – 420 DMIPS at 300 MHz Built on the Success of Virtex-II Fabric Implementing Processor Systems on Xilinx FPGAs Page 6
  • 7. RocketIO™ SerDes Leading-Edge High-Speed Serial • Multi-Rate – 3.125, 2.5, 2.0, 1.25, 1.0 Gbps 8B/10B – 2 - 24 transceivers TXDATA TXDATA Transmit FIFO Serializer Serial • Multi-Protocol Encode 8-32b Wide Buffer Out 8-32b Wide – 1G, 10 G Ethernet (XAUI) TX Clock Generator Transmitter – PCI Express – Serial ATA On-Chip Reference – InfiniBand Clock Receiver – FibreChannel RX Clock Generator – Serial RapidIO RXDATA Elastic 10B/8B De- Receive Serial – Serial backplanes… RXDATA In 8-32b Wide Buffer 8-32b Wide Decode Serializer Buffer • Key Features – Embedded 8B/10B Coding – 4-Level Pre-Emphasis – Programmable Output Swing – AC & DC Coupling – Channel bonding Implementing Processor Systems on Xilinx FPGAs Page 7
  • 8. Virtex-II Pro Device Family Covers the Entire Design Spectrum Implementing Processor Systems on Xilinx FPGAs Page 8
  • 9. Embedded Development Kit (EDK) • All encompassing design environment for Virtex-II Pro PowerPCTM and MicroBlaze based embedded systems in Xilinx FPGAs • Integration of mature FPGA and embedded tools with innovative IP generation and customization tools • Delivery vehicle for Processor IP Implementing Processor Systems on Xilinx FPGAs Page 9
  • 10. EDK System Design Comprehensive Tool Chain Standard Embedded SW Standard FPGA HW Development Flow Development Flow C/C++ Code Xilinx Platform VHDL/Verilog Studio (XPS) Compiler/Linker Synthesizer (Simulator) Simulator Object Code Place & Route Data2BlockRAM ? ? code code Bitstream in off-chip in on-chip memory memory Download to FPGA Download to Board & FPGA Debugger RTOS, Board Support Package ChipScope Tools Implementing Processor Systems on Xilinx FPGAs Page 10
  • 12. PowerPC 405 I-Side On-Chip Memory (OCM) • 5-stage data path pipeline • 16KB D and I Caches Processor Local Bus (PLB) • Embedded Memory I-Cache Fetch & Management Unit (16KB) Decode Timers • Execution Unit and Debug – Multiply / divide unit MMU (64 Entry TLB) Logic – 32 x 32-bit GPR • Dedicated on-chip memory Execution Unit interfaces D-Cache JTAG (16KB) (32x32 GPR, ALU, MAC) Instruction • Timers: PIT, FIT, Watchdog Trace • Debug and trace support • Performance: D-Side On-Chip – 450 DMIPS at 300 MHz Memory (OCM) – 0.9mW/MHz Typical Power Implementing Processor Systems on Xilinx FPGAs Page 12
  • 13. What is MicroBlaze? Machine Status r3 1 Address Reg Register Instruction Bus Controller side File Data Side Data Bus Controller Program LMB 32 x 32bit LMB Counter r1 Control Unit r0 Instruction Shift / Add / Multip Multi Logical Subtract Multiply Buffer ly ply Processor • It’s a soft processor, around 900 LUTs • RISC Architecture • 32-bit, 32 x 32 general purpose registers • Supported in Virtex/E/II/IIPro, Spartan-III/II/E Implementing Processor Systems on Xilinx FPGAs Page 13
  • 14. More on MicroBlaze ... • Harvard Architecture • Configurable instruction cache, data cache • Non-intrusive JTAG debug • Support for 2 buses: – LMB (Local Memory Bus) - 1 clock cycle latency, connects to BRAM – OPB (On-chip Peripheral Bus) - part of the IBM CoreConnectTM standard, connects to other peripheral “Portable” IP between PPC and MB • Big endian, same as PowerPC PPC405 Implementing Processor Systems on Xilinx FPGAs Page 14
  • 15. MicroBlaze Interrupts and Exceptions • Interrupt handling – 1 Interrupt port • 32+ interrupts and masking supported through interrupt controller(s) • Exception handling – No exceptions generated in Virtex-II versions – One in Virtex/E and Spartan-II versions for MUL instruction Implementing Processor Systems on Xilinx FPGAs Page 15
  • 16. Software Tools • GNU tool chain • GCC - GNU Compiler Collection • GDB - The GNU debugger – Source code debugging – Debug either C or assembly code • XMD - Xilinx Microprocessor Debug utility – Separate Process – Provides cycle accurate program execution data – Supported targets: simulator, hardware board Implementing Processor Systems on Xilinx FPGAs Page 16
  • 17. Software - XMD • Interfaces GDB to a “target” • Allows hardware debug without a ROM monitor or reduces debug logic by using xmd-stub (ROM monitor) • Offers a variety of simulation targets – Cycle accurate simulator – Real hardware board interface via UART or MDM • Includes remote debugging capability UART GDB XMD MDM SIM Implementing Processor Systems on Xilinx FPGAs Page 17
  • 18. MicroBlaze Debug Module • JTAG debug using BSCAN • Supports multiple MicroBlazes • Software non-intrusive debugging • Read/Write access to internal registers • Access to all addressable memory • Hardware single-stepping • Hardware breakpoints - configurable (max 16) • Hardware read/write address/data watchpoints – configurable (max 8) Implementing Processor Systems on Xilinx FPGAs Page 18
  • 20. Example MicroBlaze System LMB_BRAM BRAM LMB_BRAM IF_CNTLR BLOCK IF_CNTLR LMB_V10 LMB_V10 DDR SDRAM I-Side LMB D-Side LMB MicroBlaze External to FPGA SYS_Clk / I-Side OPB D-Side OPB SYS_Rst OPB_V20 OPB_DDR JTAG Debug OPB_MDM OPB_INTC OPB_TIMER OPB_EMC Serial Port P160 OPB_UART SRAM OPB_GPIO LITE User LED OPB_ETHERNET P160 Ethernet PHY External to FPGA Implementing Processor Systems on Xilinx FPGAs Page 20
  • 21. Example PPC405 System PPC405 DCR_V29 JTAG Jtag DCR_INTC DCR_INTC PLB_V34 (critical) (non-critical) PLB2OPB OPB2PLB PLB_DDR BRIDGE BRIDGE Ref_Clk DCM PLB_BRAM IF_CNTLR SYS_Rst_n PROC_SYS RESET BRAM BLOCK OPB_V20 Serial Port OPB_UART OPB_GPIO OPB_ETHERNET 16550 External PHY User Input/Output Implementing Processor Systems on Xilinx FPGAs Page 21
  • 22. Processor IP (HW/SW) Infrastructure (includes Device Drivers) OPB IPIF Modules (includes Device Drivers) • PLB IPIF • MicroBlaze CPU – OPB IPIF-Slave Attachment • LMB2OPB Bridge – OPB IPIF-Master Attachment – IPIF-Address Decode • PLB Arbiter & Bus Structure (PLB_V34) – IPIF-Interrupt Control • OPB Arbiter & Bus Structure (OPB_V20) – IPIF-Read Packet FIFOs – IPIF-Write Packet FIFOs • DCR Bus Structure (DCR_V29) – IPIF-DMA • PLB2OPB Bridge – IPIF-Scatter Gather – IPIF-FIFOLink • OPB2PLB Bridge • PLB IPIF • OPB2OPB Bridge - Lite – PLB IPIF-Slave Attachment – PLB IPIF-Master Attachment • OPB2DCR Bridge – IPIF-Address Decode • System Reset Module – IPIF-Interrupt Control – IPIF-Read Packet FIFOs • BSP Generator (SW only) – IPIF-Write Packet FIFOs • ML3 VxWorks BSP (SW only) – IPIF-DMA – IPIF-Scatter Gather • Memory Test Utility (SW only) – IPIF-FIFOLink Implementing Processor Systems on Xilinx FPGAs Page 22
  • 23. Processor IP (HW/SW) Memory Interfaces (includes Device Drivers & Peripherals (continued) Memory Tests) • OPB IIC Master & Slave • PLB EMC (Flash, SRAM, and ZBT) • OPB SPI Master & Slave • PLB BRAM Controller • OPB UART-16550 • PLB DDR Controller • OPB UART-16450 • PLB SDRAM Controller • OPB UART - Lite • OPB EMC (Flash, SRAM, and ZBT) • OPB JTAG UART • OPB BRAM Controller • OPB Interrupt Controller • OPB DDR Controller • OPB TimeBase/Watch Dog Timer • OPB SDRAM Controller • OPB Timer/Counter • OPB SystemACE • OPB GPIO • LMB BRAM Controller • PLB 1G Ethernet Peripherals (includes Device Drivers & RTOS • PLB RapidIO Adapt. Layers) • PLB UART-16550 • OPB Single Channel HDLC Controller • PLB UART-16450 • OPB<->PCI Full Bridge • PLB ATM Utopia Level 2 Slave • OPB 10/100M Ethernet • PLB ATM Utopia Level 2 Master • OPB 10/100M Ethernet - Lite • PLB ATM Utopia Level 3 Slave • OPB ATM Utopia Level 2 Slave • PLB ATM Utopia Level 3 Master • OPB ATM Utopia Level 2 Master • DCR Interrupt Controller Implementing Processor Systems on Xilinx FPGAs Page 23
  • 24. System Infrastructure • Hardware IP – Common PowerPC and MicroBlaze peripherals – Peripherals are common across bus types – Parameterize for optimal functionality, optimal FPGA usage – IP Interface (IPIF) provides common hardware blocks • Software IP (Device Drivers) – Common across processors and operating systems Implementing Processor Systems on Xilinx FPGAs Page 24
  • 25. The Benefits of Parameterization Example: OPB Arbiter Parameter Values Resources F MAX NUM_MASTERS PROC_INTERFACE DYNAM_PRIORITY PARK REG_GRANTS LUTs MHz 1 N N N N 11 295 2 N N N N 18 223 4 N N N N 34 193 4 Y N N N 59 156 4 N Y N N 54 169 4 N N Y N 83 159 Difference: 4 N N N Y 34 201 >4x in size 4 Y Y Y Y 146 145 8 Y Y Y Y 388 112 >30% in speed • Significantly increases performance or saves area • Only include what you need • This can only be accomplished in a programmable system Implementing Processor Systems on Xilinx FPGAs Page 25
  • 26. Full IP Interface (IPIF) IPIC • Consists of 8 modules Interrupt – Each module is selectable and Xilinx, 3rd party or customer Controller parameterizable Processor Bus (OPB or PLB) Slave Addr Decode Attachment • Automatically configures a core to the processor bus IP Core from MUX Write FIFO – Xilinx IP Cores – 3rd Party IP Cores Master Read FIFO – Customer proprietary cores and Attachment DMA external devices • OPB & PLB supported Bus/Core HW – Bus independent IP Cores and Bus Attachment Scatter associated Device Drivers Independent Layer Gather Layer • IPIF will be added to other LogiCOREs Implementing Processor Systems on Xilinx FPGAs Page 26
  • 27. Buses and Arbiters • PLB – Arbitration for up to 16 masters – 64-bit and 32-bit masters and slaves – IBM PLB compliant • OPB – Includes arbiter with dynamic or fixed priorities and bus parking – Parameterized I/O for any number of masters or slaves – IBM OPB compliant • DCR – Supports one master and multiple slaves – Daisy chain connections for the DCR data bus – Required OR function of the DCR slaves’ acknowledge signal • LMB – MicroBlaze single-master Local Memory Bus Implementing Processor Systems on Xilinx FPGAs Page 27
  • 28. Bridges • PLB to OPB – Decode up to 4 different address ranges – 32-bit or 64-bit PLB slave, 32-bit OPB master – Burst and non-burst transfers, cache-line transactions • OPB to PLB – 64-bit PLB master, 32-bit OPB slave – Burst and non-burst transfers, cache-line transactions – BESR and BEAR • OPB (slave) to DCR (master) – Memory mapped DCR control • OPB to OPB – Allows further OPB partitioning Implementing Processor Systems on Xilinx FPGAs Page 28
  • 29. More System Cores • Processor System Reset – Asynchronous external reset input is synchronized with clock – Selectable active high or active low reset – DCM Locked input – Sequencing of reset signals coming out of reset: • First - bus structures come out of reset • Second - Peripheral(s) come out of reset 16 clocks later • Third - the CPU(s) come out of reset 16 clocks after the peripherals • JTAG Controller – Wrapper for the JTAGPPC primitive. – Enables the PowerPC’s debug port to be connected to the FPGA JTAG chain • IPIF User Core Templates – Convenient way to add user core to OPB or PLB Implementing Processor Systems on Xilinx FPGAs Page 29
  • 30. Timer / Counter • Supports 32-bit OPB v2.0 bus interface • Two programmable interval timers with interrupt, compare, and capture capabilities • Programmable counter width • One Pulse Width Modulation (PWM) output Implementing Processor Systems on Xilinx FPGAs Page 30
  • 31. Watchdog Timer / Timebase • Supports 32-bit bus interfaces • Watchdog timer (WDT) with selectable timeout period and interrupt • Two-phase WDT expiration scheme • Configurable WDT enable: enable-once or enable- disable • WDT Reset Status (was the last reset caused by the WDT?) • One 32-bit free-running timebase counter with rollover interrupt Implementing Processor Systems on Xilinx FPGAs Page 31
  • 32. Interrupt Controller • Number of interrupt inputs is configurable up to the width of the data bus width • Interrupt controllers can be easily cascaded to provide additional interrupt inputs • Master Enable Register for disabling the interrupt request output • Each input is configurable for edge or level sensitivity – rising or falling, active high or active low • Output interrupt request pin is configurable for edge or level generation Implementing Processor Systems on Xilinx FPGAs Page 32
  • 33. UART 16550 / 16450 / Lite • Register compatible with industry standard 16550/16450 • 5, 6, 7 or 8 bits per character • Odd, even or no parity detection and generation • 1, 1.5 or 2 stop bit detection and generation • Internal baud rate generator and separate RX clock input • Modem control functions • Prioritized transmit, receive, line status & modem control interrupts • Internal loop back diagnostic functionality • Independent 16 word transmit and receive FIFOs Implementing Processor Systems on Xilinx FPGAs Page 33
  • 34. IIC • 2-wire (SDA and SCL) serial interface • Master/Slave protocol • Multi-master operation with collision detection and arbitration • Bus busy detection • Fast Mode 400 KHz or Standard Mode 100 KHz operation • 7 Bit, 10 Bit, and General Call addressing • Transmit and Receive FIFOs - 16 bytes deep • Bus throttling Implementing Processor Systems on Xilinx FPGAs Page 34
  • 35. SPI • 4-wire serial interface (MOSI, MISO, SCK, and SS) • Master or slave modes supported • Multi-master environment supported (requires tri-state drivers and software arbitration for possible conflict) • Multi-slave environment supported (requires additional decoding and slave select signals) • Programmable clock phase and polarity • Optional transmit and receive FIFOs • Local loopback capability for testing Implementing Processor Systems on Xilinx FPGAs Page 35
  • 36. Ethernet 10/100 MAC • 32-bit OPB master and slave interfaces • Media Independent Interface (MII) for connection to external 10/100 Mbps PHY Transceivers • Full and half duplex modes of operation • Supports unicast, multicast, broadcast, and promiscuous addressing • Provides auto or manual source address, pad, and Frame Check Sequence Implementing Processor Systems on Xilinx FPGAs Page 36
  • 37. Ethernet 10/100 MAC (cont) • Simple DMA and Scatter/Gather DMA architecture for low processor and bus utilization, as well as a simple memory-mapped direct I/O interface • Independent 2K to 32K transmit and receive FIFOs • Supports MII management control writes and reads with MII PHYs • Supports VLAN and Pause frames • Internal loopback mode Implementing Processor Systems on Xilinx FPGAs Page 37
  • 38. 1 Gigabit MAC • 64-bit PLB master and slave interfaces • GMII for connection to external PHY Transceivers • Optional PCS function with Ten Bit Interface (TBI) to external PHY devices • Option PCS/PMA functions with SerDes interface to external transceiver devices for reduced signal count • Full duplex only • Provides auto or manual source address, pad, and Frame Check Sequence Implementing Processor Systems on Xilinx FPGAs Page 38
  • 39. 1 Gigabit MAC (cont) • Simple DMA and Scatter/Gather DMA architecture for low processor and bus utilization, as well as a simple memory-mapped direct I/O interface • Independent, depth-configurable TX and RX FIFOs • Supports MII management control writes and reads with MII PHYs • Jumbo frame and VLAN frame support • Internal loopback mode Implementing Processor Systems on Xilinx FPGAs Page 39
  • 40. Single Channel HDLC • Support for a single full duplex HDLC channel • Selectable 8/16 bit address receive address detection, receive frame address discard, and broadcast address detection • Selectable 16 bit (CRC-CCITT) or 32 bit (CRC-32) frame check sequence • Flag sharing between back to back frames • Data rates up to OPB_Clk frequency Implementing Processor Systems on Xilinx FPGAs Page 40
  • 41. Single Channel HDLC (cont) • Simple DMA and Scatter/Gather DMA architecture for low processor and bus utilization, as well as a simple memory-mapped direct I/O interface • Independent, depth-configurable TX and RX FIFOs • Selectable broadcast address detection and receive frame address discard • Independent RX and TX data rates Implementing Processor Systems on Xilinx FPGAs Page 41
  • 42. ATM Utopia Level 2 • UTOPIA Level 2 master or slave interface • UTOPIA interface data path of 8 or 16 bits • Single channel VPI/VCI service and checking in received cells • Header error check (HEC) generation and checking • Parity generation and checking • Selectively prepend headers to transmit cells, pass entire received cells or payloads only, and transfer 48 byte ATM payloads only Implementing Processor Systems on Xilinx FPGAs Page 42
  • 43. ATM Utopia Level 2 (cont) • Simple DMA and Scatter/Gather DMA architecture for low processor and bus utilization, as well as a simple memory-mapped direct I/O interface • Independent, depth-configurable TX and RX FIFOs • Interface throughput up to 622 Mbps (OC12) • Internal loopback mode Implementing Processor Systems on Xilinx FPGAs Page 43
  • 44. OPB-PCI Bridge • 33/66 MHz, 32-bit PCI buses • Full bridge functionality – OPB Master read/write of a remote PCI target (both single and burst) – PCI Initiator read/write of a remote OPB slave (both single and multiple) • Supports up to 3 PCI devices with unique memory PCI memory space • Supports up to 6 OPB devices with unique memory OPB memory space • PCI and OPB clocks can be totally independent Implementing Processor Systems on Xilinx FPGAs Page 44
  • 45. System ACE Controller • Used in conjunction with System ACE CompactFlash Solution to provide a System ACE memory solution. • System ACE Microprocessor Interface (MPU) – Read/Write from or to a CompactFlash device – MPU provides a clock for proper synchronization • ACE Flash (Xilinx-supplied Flash Cards) – Densities of 128 MBits and 256 Mbits – CompactFlash Type 1 form factor • Supports any standard CompactFlash module, or IBM microdrives up to 8 Gbits, all with the same form factor. • Handles byte, half-word, and word transfers Implementing Processor Systems on Xilinx FPGAs Page 45
  • 46. GPIO • OPB V2.0 bus interface with byte-enable support • Supports 32-bit bus interface • Each GPIO bit dynamically programmable as input or output • Number of GPIO bits configurable up to size of data bus interface • Can be configured as inputs-only to reduce resource utilization Implementing Processor Systems on Xilinx FPGAs Page 46
  • 47. Memory Controllers • PLB and OPB interfaces • External Memory Controller – Synchronous Memory (ZBT) – Asynchronous Memory (SRAM, Flash) • Internal Block Memory (BRAM) Controllers • DDR and SDRAM Implementing Processor Systems on Xilinx FPGAs Page 47
  • 48. Device Drivers and Board Support Packages (BSPs) Board Support Package (BSP) • Device drivers are provided for each hardware device RTOS Adaptation Layer • Device drivers are written in C and are Peripheral n, n+1… ATM Utopia Device IIC Master & Slave designed to be portable across Ethernet 10/100 Device Drivers Device Driver Device Driver Device Driver UART 16550 processors Driver • Device drivers allow the user to select the desired functionality to minimize the required memory Initialization Code • BSPs are automatically generated by Boot Code EDK tools Implementing Processor Systems on Xilinx FPGAs Page 48
  • 49. Creating a Simple MicroBlaze System with XPS with Base System Builder Wizard
  • 50. Design Flow • Design Entry with Xilinx Platform Studio using the Base System Builder Wizard • Generate system netlist with XPS • Generate hardware bitstream with XPS • Download and sanity check design with XPS and XMD Implementing Processor Systems on Xilinx FPGAs Page 50
  • 51. Simple MicroBlaze System Block Diagram LMB_BRAM BRAM LMB_BRAM IF_CNTLR BLOCK IF_CNTLR LMB_V10 LMB_V10 I-Side LMB D-Side LMB MicroBlaze SYS_Clk / I-Side OPB D-Side OPB SYS_Rst OPB_V20 JTAG Debug OPB_UART Serial Port OPB_MDM LITE External to FPGA Implementing Processor Systems on Xilinx FPGAs Page 51
  • 52. Start Xilinx Platform Studio Implementing Processor Systems on Xilinx FPGAs Page 52
  • 53. Create A New Project • Select File from the Tools menu • Select the New Project submenu and the Base System Builder submenu • Browse to the location where the project is to be located • Click OK to start creating the project Implementing Processor Systems on Xilinx FPGAs Page 53
  • 54. Selecting The Board • Select Xilinx as the Board Vendor • Select Virtex-II Multimedia FF896 Development Board as the Board Name • Select Board Revision 1 • Click Next to continue to the next step Implementing Processor Systems on Xilinx FPGAs Page 54
  • 55. Select the Processor • This board has a Virtex-II FPGA which does not contain a PowerPC processor • Click Next to continue to the next step Implementing Processor Systems on Xilinx FPGAs Page 55
  • 56. Configuring The Processor • Select On-chip H/W debug module such that a ROM monitor is not required • Select 64KB of Local Data and Instruction Memory (BRAM) • There is no need to select caches when using internal BRAM • Click Next to continue to the next step Implementing Processor Systems on Xilinx FPGAs Page 56
  • 57. Configuring I/O Interfaces • The board has a serial port and it is default behavior to build the hardware with it • Since it is used as standard I/O it is not necessary to be interrupt driven • Click Next to continue to the next step Implementing Processor Systems on Xilinx FPGAs Page 57
  • 58. Adding Internal Peripherals • Other peripherals can be added at this point, such as a timer counter. • Click Next to continue to the next step Implementing Processor Systems on Xilinx FPGAs Page 58
  • 59. System Summary • The system has been created and is ready to be generated • Review the details of the system and backup if necessary to make changes • Click the Generate button to create the data files for XPS Implementing Processor Systems on Xilinx FPGAs Page 59
  • 60. Base System Builder Finished • The Base System Builder Wizard in XPS has completed • The data files for XPS have been generated such that the system will be contained in an XPS project • Click the Finish button to exit the wizard & return to XPS Implementing Processor Systems on Xilinx FPGAs Page 60
  • 61. Generating Hardware NetList • Select the Tools menu • Select the Generate Netlist submenu • Wait for the generation to complete Implementing Processor Systems on Xilinx FPGAs Page 61
  • 62. Generating Hardware Bitstream • Select the Tools menu • Select the Generate Bitstream submenu • Wait for the bitstream generation to complete Implementing Processor Systems on Xilinx FPGAs Page 62
  • 63. Adding Software Source Files • Select processor in System tab • Select the Tools menu • Select the Add Program Sources submenu • Navigate to the source file and select it. Implementing Processor Systems on Xilinx FPGAs Page 63
  • 64. Setting Compile Options • Select the Options menu • Select the Compiler Options submenu • Set the optimization to none • Set the debug options to create symbols for debugging Implementing Processor Systems on Xilinx FPGAs Page 64
  • 65. Setting Up Standard I/O • Select the System tab • Double click on the microblaze_0 • The dialog box illustrated is displayed • Select the opb_uartlite_0 for the STDIN and STDOUT peripheral and click the OK button Implementing Processor Systems on Xilinx FPGAs Page 65
  • 66. Assigning Drivers To Devices • Assigning a driver to a device causes the driver to be compiled into the library & linked with the application • Double click on the device in the System tab of the XPS project • The latest version of the driver is displayed by default • Choose the appropriate Interface Level of the driver Implementing Processor Systems on Xilinx FPGAs Page 66
  • 67. Setting Memory Options • Double click on the processor instance in the System tab • Select the Details tab • Change the program start address or stack size • Add other options to the preprocessor, assembler, or linker Implementing Processor Systems on Xilinx FPGAs Page 67
  • 68. Setting Library Options • Double click on the processor instance in the System tab • Select the Others tab • Add or change options for library compilation • Add other options for application compilation Implementing Processor Systems on Xilinx FPGAs Page 68
  • 69. Generating Libraries In XPS • A Library containing the device drivers and the startup code is built for an application to be linked against • The Library helps separate Board Support Package development from application development • Libraries will automatically be built if they don’t exist when the application is built Implementing Processor Systems on Xilinx FPGAs Page 69
  • 70. Compiling The Software • Select the Tools menu • Select the Compile Program Sources submenu • Wait for the compile to complete Implementing Processor Systems on Xilinx FPGAs Page 70
  • 71. Updating the Bitstream • Select the Tools menu • Select the Update Bitstream submenu • The hardware bitstream is updated to contain the contents of the software elf file Implementing Processor Systems on Xilinx FPGAs Page 71
  • 72. Downloading The Hardware • Make sure that the board power is on and the parallel pod is connected • Select the Tools menu • Select the Download submenu • Wait for the download to complete Implementing Processor Systems on Xilinx FPGAs Page 72
  • 73. Running XMD • Select the Tools menu • Select the XMD submenu • Type “mbconnect mdm” to connect XMD to the MicroBlaze processor. Implementing Processor Systems on Xilinx FPGAs Page 73
  • 74. Testing Memory • Type “mrd 0x1000 2” to read 2 memory locations starting at address 0x1000 • Type “mwr 0x1000 0x12345678” to write to memory location 0x1000 • Perform writes to location 0x1004 also • Type “mrd x1000 2” to read 2 memory locations and verify the values that were written Implementing Processor Systems on Xilinx FPGAs Page 74
  • 75. Starting The GNU Debugger (GDB) • Select the Tools menu • Select the Software Debugger submenu Implementing Processor Systems on Xilinx FPGAs Page 75
  • 76. Target Selection & Download • In GDB, select the Run menu and choose the Run menu item • Wait for the Target Selection dialog box to be displayed • Enter the data in the dialog box and click OK Implementing Processor Systems on Xilinx FPGAs Page 76
  • 77. Stepping in GDB • The debugger is ready, the program counter is at a breakpoint at line 5 of the source file • Select the Control menu • Select the Step submenu Implementing Processor Systems on Xilinx FPGAs Page 77
  • 78. Watching A Variable With GDB • Double click on the variable count such that it is selected • Right click and select in the submenu to Add count to Watch • A dialog box is displayed which contains the variable count and it’s contents Implementing Processor Systems on Xilinx FPGAs Page 78
  • 79. Creating a Simple MicroBlaze System with XPS without Base System Builder Wizard
  • 80. Design Flow • Design Entry with Xilinx Platform Studio • Generate system netlist with XPS • Generate hardware bitstream with XPS • Download and sanity check design with XPS and XMD Implementing Processor Systems on Xilinx FPGAs Page 80
  • 81. Start Xilinx Platform Studio Implementing Processor Systems on Xilinx FPGAs Page 81
  • 82. Create A New Project • Select New Project from the Tools menu • Enter all the project information • Click OK on this dialog box. • Click Yes on the next dialog box to start with an empty MHS file Implementing Processor Systems on Xilinx FPGAs Page 82
  • 83. Adding New Cores • Select the Project menu • Select the Add/Edit Cores submenu Implementing Processor Systems on Xilinx FPGAs Page 83
  • 84. Adding Bus Structures • Select the Bus Connections Tab • Select the lmb_v10_v1_00_a bus & opb_v20_v1_10_b bus and click the Add button • Select the lmb_v10_v1_00_a bus and click the Add button Implementing Processor Systems on Xilinx FPGAs Page 84
  • 85. Adding Basic Peripherals • Select the Peripherals tab • Select the bram_block, lmb_bram_if_cntlr, microblaze, and opb_mdm and click the Add button. • Select the lmb_bram_if_cntlr and click the Add button. Implementing Processor Systems on Xilinx FPGAs Page 85
  • 86. Change The Memory Map • Edit the Base Address and High Address for the lmb_bram_if_cntlr and opb_mdm peripherals Implementing Processor Systems on Xilinx FPGAs Page 86
  • 87. Setting Bus Masters & Slaves • Select the Bus Connections tab • Set the masters and slaves on the buses by clicking on the boxes with an ‘s’ and ‘M’ Implementing Processor Systems on Xilinx FPGAs Page 87
  • 88. Setting MicroBlaze Parameters • Select the Parameters tab • Select microblaze_0 IP instance • Select the C_DEBUG_ENABLED and C_NUMBER_OF_PC_BRK parameters and click the Add button • Edit the parameter values Implementing Processor Systems on Xilinx FPGAs Page 88
  • 89. Setting MDM Parameters • Select the opb_mdm_0 IP instance • Select the C_USE_UART parameter and click the Add button • Edit the parameter value Implementing Processor Systems on Xilinx FPGAs Page 89
  • 90. Setting LMB Parameters • Select the lmb_v10_0 IP instance • Select the C_EXT_RESET_HIGH parameter and click the Add button • Edit the parameter value • Repeat for lmb_v10_1 IP instance Implementing Processor Systems on Xilinx FPGAs Page 90
  • 91. Setting OPB Parameters • Select the opb_v20_0 IP instance • Select the C_EXT_RESET_HIGH parameter and click the Add button • Edit the parameter value Implementing Processor Systems on Xilinx FPGAs Page 91
  • 92. Connecting The Clock • Select the Ports tab • Select the LBM_Clk and OPB_Clk ports on the lmb_v10_0, lmb_v10_0 and opb_v20_0 IP instances and click the Add button Implementing Processor Systems on Xilinx FPGAs Page 92
  • 93. Connecting The Reset • Select the SYS_Rst ports of the lmb_v10_0, lmb_v10_1, and opb_v20_0 IP instances and click the Add button Implementing Processor Systems on Xilinx FPGAs Page 93
  • 94. Connecting The Reset (2) • Select the lmb_v10_0, lmb_v10_1, and opb_v20_0 instances on the left side and click the Connect button • Enter sys_rst for the net name in the dialog box and click the OK button Implementing Processor Systems on Xilinx FPGAs Page 94
  • 95. Completing the Add/Edit • Click the OK button to set all the items changed in the Add/Edit Cores dialog box Implementing Processor Systems on Xilinx FPGAs Page 95
  • 97. Adding A UartLite • Select the Project menu • Select the Add/Edit Cores submenu • Select the opb_uartlite and click Add • Edit the Base Address and High Address of the uartlite Implementing Processor Systems on Xilinx FPGAs Page 97
  • 98. Setting UartLite Parameters • Select the Parameters tab • Select the C_CLK_FREQ and C_USE_PARITY parameters and click the Add button • Edit the parameter values Implementing Processor Systems on Xilinx FPGAs Page 98
  • 99. Put UartLite On the OPB • Select the Bus Connections tab • Click on the box to mark the UartLite as a slave on the OPB bus Implementing Processor Systems on Xilinx FPGAs Page 99
  • 100. Connecting UartLite I/O • Select the Ports tab • Select the RX and TX ports of opb_uartlite_0 and click the Add button • Edit the net names to be tx and rx for the opb_uartlite_0 • Click OK on the dialog box Implementing Processor Systems on Xilinx FPGAs Page 100
  • 101. Adding A Timer • Select the Project menu • Select the Add/Edit Cores submenu • Select the opb_timer and click Add • Edit the Base Address and High Address of the timer Implementing Processor Systems on Xilinx FPGAs Page 101
  • 102. Setting Timer Parameters • Select the Parameters tab • Select the C_ONE_TIMER_ONLY parameters and click the Add button • Edit the parameter value Implementing Processor Systems on Xilinx FPGAs Page 102
  • 103. Put Timer On the OPB • Select the Bus Connections tab • Click on the box to mark the Timer as a slave on the OPB bus Implementing Processor Systems on Xilinx FPGAs Page 103
  • 104. Adding an Interrupt Controller • Select the Project menu • Select the Add/Edit Cores submenu • Select the opb_intc and click Add • Edit the Base Address and High Address of the intc Implementing Processor Systems on Xilinx FPGAs Page 104
  • 105. Put Intc On the OPB • Select the Bus Connections tab • Click on the box to mark the Intc as a slave on the OPB bus Implementing Processor Systems on Xilinx FPGAs Page 105
  • 106. Connect Intc to MicroBlaze • Select Ports tab • Add Interrupt input of MicroBlaze and Irq output of Intc • Highlight both of these and press Connect • Name the net, select Internal, and press OK Implementing Processor Systems on Xilinx FPGAs Page 106
  • 107. Connect Intc to MicroBlaze Implementing Processor Systems on Xilinx FPGAs Page 107
  • 108. Connect Timer to Intc • Select Ports tab • Add Interrupt output of Timer and Intr input of Intc • Highlight both of these and press Connect • Name the net, select Internal, and press OK Implementing Processor Systems on Xilinx FPGAs Page 108
  • 109. Connect Timer to Intc Implementing Processor Systems on Xilinx FPGAs Page 109
  • 111. EDK System Design Comprehensive Tool Chain Standard Embedded SW Standard FPGA HW Development Flow Development Flow C/C++ Code Xilinx Platform VHDL/Verilog Studio (XPS) Compiler/Linker Synthesizer (Simulator) Simulator Object Code Place & Route Data2BlockRAM ? ? code code Bitstream in off-chip in on-chip memory memory Download to FPGA Download to Board & FPGA Debugger RTOS, Board Support Package ChipScope Tools Implementing Processor Systems on Xilinx FPGAs Page 111
  • 112. Building Software in XPS • XPS is an Integrated Development Environment (IDE) similar to other products with the primary difference being it allows the user to build hardware and software. • The GNU tools (compiler, linker, etc.) including GDB are used by XPS for software development. • The GNU tools are not native Windows tools such that they execute within a Xygwin (Xilinx Cygwin) environment. Implementing Processor Systems on Xilinx FPGAs Page 112
  • 113. XPS Project Directory Structure • A project within XPS is a directory that contains multiple subdirectories. • The code subdirectory is created by the user and contains application source code. • The include files, drivers, and libraries are located in a directory based on the instance name of the microprocessor in the project. Implementing Processor Systems on Xilinx FPGAs Page 113
  • 114. XPS Example Project Directory Implementing Processor Systems on Xilinx FPGAs Page 114
  • 115. Library Generation • XPS compiles device drivers and C run-time CRT into a single library that is then linked with a user application program. • Libgen is the tool executed from within XPS or from a command line, that copies the library source files and device driver source files to the project directory to build the library. Implementing Processor Systems on Xilinx FPGAs Page 115
  • 116. Command Line Builds • XPS generates a single make file, system.make, that can be used to build the hardware or software from the command line of a Xygwin window. • This make file could be used to create a build environment for software development groups that build from the command line. Implementing Processor Systems on Xilinx FPGAs Page 116
  • 117. Xilinx Microprocessor Debugger (XMD) • Interfaces GDB to a “target” • Supports script interface for built-in commands • Allows debug with or without a ROM monitor – MDM target for true JTAG – UART target for ROM monitor (xmd-stub) – SIM target for instruction set simulator UART GDB XMD MDM SIM Implementing Processor Systems on Xilinx FPGAs Page 117
  • 118. Microprocessor Debug Module (MDM) • JTAG debug using BSCAN • Software non-intrusive debugging • Read/Write access to internal registers • Access to all addressable memory • Hardware single-stepping • Hardware breakpoints - configurable (max 16) • Hardware read/write address/data watchpoints – configurable (max 8) Implementing Processor Systems on Xilinx FPGAs Page 118
  • 120. Device Drivers for FPGA Designs • Hardware is parameterizable – Capabilities and features may change every build • FPGA space is limited – User needs flexible driver architecture – Internal memory solution as well as external memory solution • Processor may change – Portability of driver is key Implementing Processor Systems on Xilinx FPGAs Page 120
  • 121. Device Driver Goals • Portability/Reusability – Drivers are to be portable across many different RTOSs, microprocessors, and toolsets – Minimize development effort • Out-of-the-box solution for customers Implementing Processor Systems on Xilinx FPGAs Page 121
  • 122. Driver Design Considerations Programming Languages • Assembly Language – Minimized to allow maximum portability between microprocessors – Only boot code, which executes prior to the C/C++ runtime system, is typically necessary to be assembly language – Located in separate source files to help isolate it, as opposed to in-line assembly language in the C source code • C Programming Language – The C programming language is the most utilized language for embedded systems – In order to support the largest number of customers, the first implementation utilizes the C programming language Implementing Processor Systems on Xilinx FPGAs Page 122
  • 123. Driver Design Considerations • Object Oriented Design – Emphasize data abstraction, data hiding, and encapsulation in addition to greater potential for code reuse and ease of maintenance – Provides an easier transition from non-object oriented languages such as C to more object oriented languages such as C++ and Java • Delivery Format – Delivered to customers in source code format, allowing it to be built and optimized for a wide range of microprocessors using customer selected tools Implementing Processor Systems on Xilinx FPGAs Page 123
  • 124. Device Driver Architecture • Component based object Layer 2 Drivers oriented design implemented (RTOS Adapters) in ANSI C • A device driver supports Layer 1 (High Level) multiple instances of a device Drivers • Layered device driver Layer 0 (Low Level) architecture to allow user Drivers selectable features and size Implementing Processor Systems on Xilinx FPGAs Page 124
  • 125. Device Driver Architecture (continued) • Source code is provided • Layer 0 and Layer 1 are OS-independent • Device drivers in all layers have common characteristics • Primitive data types for portability (Xuint8, Xuint16, Xuint32, etc.), in xbasic_types.h • Isolation of I/O accesses for portability (XIo_In8(), XIo_Out8(), etc.), in xio.h • Coding and documentation conventions Implementing Processor Systems on Xilinx FPGAs Page 125
  • 126. Layer 0, Low Level Drivers • Interface contained in <driver>_l.h file • Designed for a small system, typically for internal memory of an FPGA. • Small memory footprint • No error checking performed • Supports primary device features only, not comprehensive • Polled I/O, blocking functions Implementing Processor Systems on Xilinx FPGAs Page 126
  • 127. Layer 1, High Level Drivers • Interface contained in <driver>.h file • Designed to allow a developer to utilize all features of a device • Larger memory footprint • Robust error checking such as asserting input arguments • Supports configuration parameters in <driver>_g.c • Interrupt driven I/O, non-blocking functions – Interrupt service routines are provided Implementing Processor Systems on Xilinx FPGAs Page 127
  • 128. Layer 2 Drivers, RTOS Adapters • Interface contained in <driver>_adapter.h file. • Converts the Layer 1 device driver interface to an interface that matches the device driver scheme of the RTOS. • Contains calls specific to the RTOS • Can use RTOS features such as memory management, threading, inter-task communication, etc. Implementing Processor Systems on Xilinx FPGAs Page 128
  • 129. RTOS Independent Device Drivers • Driver – Responsible for interfacing to the device (peripheral). It encapsulates communication to the device – Designed to be portable across processor architectures and operating systems • Adapter – Integrates the driver into an operating system – Satisfies the "plug-in" requirements of the operating system – Needs to be rewritten for each OS Implementing Processor Systems on Xilinx FPGAs Page 129
  • 130. RTOS Support • Xilinx supports VxWorks 5.4/5.5 for PowerPC in-house • 3rd party support includes MontaVista Linux (PPC), ATI Nucleus, uCos, ucLinux • VxWorks integration: – All device drivers can be used directly by the application – Some device drivers tightly integrated into VxWorks • UARTs to standard and file I/O • Ethernet to network stack (Enhanced Network Driver) • Interrupt controller • System ACE into VxWorks filesystem interface • Automatic Tornado BSP generation using EDK Implementing Processor Systems on Xilinx FPGAs Page 130
  • 131. Naming Conventions • A common name is used for all external identifiers of the device driver – <driver_name>_FunctionName(); – <driver_name>_DataType; • A common name is used for all source files of the device driver for ease of use – <driver_name>_l.h low level driver interface definition – <driver_name>.h high level driver interface definition – <driver_name>.c primary source file – <driver_name>_g.c configuration table source file – <driver_name>_intr.c interrupt processing source file Implementing Processor Systems on Xilinx FPGAs Page 131
  • 132. Multiple Instance Details • Multiple instances of a single device (such as an Ethernet MAC) typically exist in a system • A single device driver handles all instances of the device • A layer 1 device driver uses a data type that is passed as the first argument to each function of the driver. The data type contains information about each device instance such as the base address Implementing Processor Systems on Xilinx FPGAs Page 132
  • 133. Example Layer 0 Device Driver API • Each function of Layer 0 uses the base address of the device as the first argument • No state information is kept by the driver and the user must manage multiple instances of the device • void XEmac_mSetControlReg(Xuint32 BaseAddress, Xuint32 Mask) • void XEmac_SendFrame(Xuint32 BaseAddress, Xuint8 *FramePtr, int Size) • int XEmac_RecvFrame(Xuint32 BaseAddress, Xuint8 *FramePtr) Implementing Processor Systems on Xilinx FPGAs Page 133
  • 134. Example Layer 1 Device Driver API • Each function of Layer 1 uses an instance pointer as the first argument • XStatus XEmac_Initialize(XEmac *InstancePtr, Xuint16 DeviceId) • XStatus XEmac_Start(XEmac *InstancePtr) • XStatus XEmac_Stop(XEmac *InstancePtr) • void XEmac_Reset(XEmac *InstancePtr) • XStatus XEmac_SelfTest(XEmac *InstancePtr) Implementing Processor Systems on Xilinx FPGAs Page 134
  • 135. Example Layer 1 Device Driver API For FIFO Interrupt Support • XStatus XEmac_FifoSend(XEmac *InstancePtr, Xuint8 *BufPtr, Xuint32 ByteCount); • XStatus XEmac_FifoRecv(XEmac *InstancePtr, Xuint8 *BufPtr, Xuint32 *ByteCountPtr); • void XEmac_SetFifoRecvHandler(XEmac *InstancePtr, void *CallBackRef, XEmac_FifoHandler FuncPtr); • void XEmac_SetFifoSendHandler(XEmac *InstancePtr, void *CallBackRef, XEmac_FifoHandler FuncPtr); • void XEmac_IntrHandlerFifo(void *InstancePtr); /* interrupt handler */ Implementing Processor Systems on Xilinx FPGAs Page 135
  • 136. Device Driver & System Configuration • xparameters.h contains important system parameters used by the drivers & the BSP • Parameters for each device may include a device ID, a base address, an interrupt identifier, and any device unique parameters • This file is the best place to start when trying to understand a system • Libgen automatically generates xparameters.h Implementing Processor Systems on Xilinx FPGAs Page 136
  • 137. Example xparameters.h File • The following example is for a system that has an Ethernet MAC device at address 0x60000000. The name of the hardware instance is opb_ethernet. #define XPAR_XEMAC_NUM_INSTANCES 1 #define XPAR_OPB_ETHERNET_BASEADDR 0x60000000 #define XPAR_OPB_ETHERNET_HIGHADDR 0x60003FFF #define XPAR_OPB_ETHERNET_DEVICE_ID 0 #define XPAR_OPB_ETHERNET_ERR_COUNT_EXIST 1 #define XPAR_OPB_ETHERNET_DMA_PRESENT 3 #define XPAR_OPB_ETHERNET_MII_EXIST 1 Implementing Processor Systems on Xilinx FPGAs Page 137
  • 138. Device Driver Configuration Specifics • Constants describing each device instance are contained in xparameters.h • These constants are also inserted into a configuration table for each device driver contained in the <driver_name>_g.c • The device driver looks up information for the specific instance of the device when it is initialized • The data type definition for the configuration data is contained in the <driver_name>.h file • Libgen generates the <driver_name>_g.c file for each device driver Implementing Processor Systems on Xilinx FPGAs Page 138
  • 139. Device Driver Configuration Example • typedef struct From { Xuint16 DeviceId; xemac.h Xuint32 BaseAddress; source file Xboolean HasCounters; Xuint8 IpIfDmaConfig; Xboolean HasMii; } XEmac_Config; • XEmac_Config XEmac_ConfigTable[] = { From { xemac_g.c XPAR_OPB_ETHERNET_DEVICE_ID, XPAR_OPB_ETHERNET_BASEADDR, source file XPAR_OPB_ETHERNET_ERR_COUNT_EXIST, XPAR_OPB_ETHERNET_DMA_PRESENT, XPAR_OPB_ETHERNET_MII_EXIST } Implementing Processor Systems on Xilinx FPGAs Page 139 };