of 29/29
XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 1 © 2009–2010 Xilinx, Inc. XILINX, the Xilinx logo, Virtex, Spartan, ISE, and other designated brands included herein are trademarks of Xilinx in the United States and other countries. All other trademarks are the property of their respective owners. Summary The Simple MicroBlaze™ Microcontroller (SMM) is a small form-factor 32-bit microcontroller based on the MicroBlaze processor that can be instantiated into an FPGA design quickly and easily. Introduction Using a small microcontroller programmed in C or C++ can be more efficient than doing the same function in HDL. This application note provides a new way to easily add a simple MicroBlaze microcontroller without having to learn new tools. The controller is instantiated directly into the HDL and can be used immediately in a standard FPGA design flow without special scripts or complicated steps. Only three files are necessary to get started. The microcontroller can be used for a wide range of applications; like user interface control, general purpose processing, monitoring, encryption/decryption engine, or as a state machine replacement to name a few. Hardware and Software Requirements The hardware and software requirements for this reference system are: Xilinx® ML605 board, Xilinx SP605 board, or Xilinx Spartan®-3A Starter Kit RS232 serial cable and serial communication utility (HyperTerminal) Xilinx Software Development Kit (SDK) 12.1 Xilinx Integrated Software Environment (ISE®) 12.1 Xilinx Embedded Development Kit (EDK) 12.1 is optional Reference System Specifics The microcontroller comes initially implemented for Spartan®-6, Spartan-3A/AN, Virtex®-6, and Virtex-5 architectures and can be modified to support other architectures. The entire embedded system is delivered as a netlist that can easily be instantiated into a Verilog or VHDL design, removing the need to create an EDK design. Starting with ISE® Design Suite 11.1, MicroBlaze software development is fully supported by the standalone SDK, allowing C and C++ applications to be created and debugged without the need for EDK. The microcontroller comes pre-configured with two options: a UART option and a debug option. Once the code is debugged, the user can switch netlists to reduce the size of the design. With a total of 3 files (2 for hardware implementation, 1 for software), a complete 32-bit MicroBlaze microcontroller can be added to any FPGA design. Application Note: Embedded Processing XAPP1141 (v3.0) November 9, 2010 The Simple MicroBlaze Microcontroller Concept Author: Christophe Charpentier

The Simple MicroBlaze Microcontroller Conceptxilinx.eetrend.com/files-eetrend-xilinx/article/201105/1839-3354... · XAPP1141 (v3.0) November 9, 2010 2 Simple MicroBlaze Microcontroller

  • View
    219

  • Download
    2

Embed Size (px)

Text of The Simple MicroBlaze Microcontroller...

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 1

    20092010 Xilinx, Inc. XILINX, the Xilinx logo, Virtex, Spartan, ISE, and other designated brands included herein are trademarks of Xilinx in the United States and other countries. All other trademarks are the property of their respective owners.

    Summary The Simple MicroBlaze Microcontroller (SMM) is a small form-factor 32-bit microcontroller based on the MicroBlaze processor that can be instantiated into an FPGA design quickly and easily.

    Introduction Using a small microcontroller programmed in C or C++ can be more efficient than doing the same function in HDL. This application note provides a new way to easily add a simple MicroBlaze microcontroller without having to learn new tools. The controller is instantiated directly into the HDL and can be used immediately in a standard FPGA design flow without special scripts or complicated steps. Only three files are necessary to get started. The microcontroller can be used for a wide range of applications; like user interface control, general purpose processing, monitoring, encryption/decryption engine, or as a state machine replacement to name a few.

    Hardware and Software Requirements

    The hardware and software requirements for this reference system are:

    Xilinx ML605 board, Xilinx SP605 board, or Xilinx Spartan-3A Starter Kit

    RS232 serial cable and serial communication utility (HyperTerminal)

    Xilinx Software Development Kit (SDK) 12.1

    Xilinx Integrated Software Environment (ISE) 12.1

    Xilinx Embedded Development Kit (EDK) 12.1 is optional

    Reference System Specifics

    The microcontroller comes initially implemented for Spartan-6, Spartan-3A/AN, Virtex-6, and Virtex-5 architectures and can be modified to support other architectures.

    The entire embedded system is delivered as a netlist that can easily be instantiated into a Verilog or VHDL design, removing the need to create an EDK design.

    Starting with ISE Design Suite 11.1, MicroBlaze software development is fully supported by the standalone SDK, allowing C and C++ applications to be created and debugged without the need for EDK.

    The microcontroller comes pre-configured with two options: a UART option and a debug option. Once the code is debugged, the user can switch netlists to reduce the size of the design.

    With a total of 3 files (2 for hardware implementation, 1 for software), a complete 32-bit MicroBlaze microcontroller can be added to any FPGA design.

    Application Note: Embedded Processing

    XAPP1141 (v3.0) November 9, 2010

    The Simple MicroBlaze Microcontroller ConceptAuthor: Christophe Charpentier

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 2

    Simple MicroBlaze Microcontroller Features 32-bit MicroBlaze RISC processor

    8KB of internal RAM/ROM

    Software application is stored in BRAMs at configuration time

    32-bit wide Input and Output ports

    64KB of addressable user space

    Interrupt input

    Optional UART

    Full C/C++ support

    Optional debug support

    Simple hardware interface

    SMM is available in 4 pre-configured netlists for the Spartan-6, Spartan-3 (A, AN, ADSP), Virtex-6 and Virtex-5 architectures.

    SMM with Debug support and UART option

    SMM with Debug support and no UART option

    SMM with UART option and no Debug support

    SMM with no UART option and no Debug support

    The user could start with Debug support during the development phase then switch to the no Debug support netlist for production. The estimated size for each implementation using default mapping options for ISE 12.1 is shown in Table 1. Different mapping options might yield slightly different results.

    Microcontroller Interfaces

    The block diagram of the Simple MicroBlaze Controller is shown in Figure 1.

    Table 1: SMM Size

    FPGA Family Spartan-6 Spartan-3 Virtex-6 Virtex-5

    Configuration LUTs FFs Slices LUTs FFs Slices LUTs FFs Slices LUTs FFs Slices

    SMM + UART + Debug 1340 1200 510 1770 1240 1120 1350 1200 500 1020 1230 460

    SMM + UART 1060 860 320 1510 900 1040 1050 870 380 830 880 350

    SMM + Debug 970 750 370 1390 790 820 990 750 350 980 740 350

    SMM 690 440 250 1130 450 630 690 440 240 630 440 220

    X-Ref Target - Figure 1

    Figure 1: Simple MicroBlaze Controller Diagram

    SimpleMicroBlaze

    Microcontroller

    DIN [0:31]

    SIN (Optional)

    INTERRUPT

    RESET

    DOUT [0:31]

    BE [0:3]

    ADDR [0:15]

    CS

    RNW

    SOUT (Optional)

    INTERRUPT_ACKCLK

    X1141_01_060809

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 3

    Signal Descriptions

    The Simple MicroBlaze Controller signal names and descriptions are shown in Table 2.

    Table 2: Simple MicroBlaze Controller Input and Output Signals

    Signal Direction Description

    DIN [0:31] Input Data input port: input data for read operations. The data is sampled on the rising edge of CLK.

    SIN Input Serial input: UART input signal (optional)

    INTERRUPT Input Interrupt Input: generate an interrupt to the microcontroller. Interrupts have to be enabled in the application code

    RESET Input Reset Input: Active high reset input

    CLK InputClock Input: the clock is used by the entire system and interfaces and can be from DC to the max operating frequency for the particular FPGA

    DOUT [0:31] Output Data Output port: output data is valid during CS for two clock cycles

    BE [0:3] Output Byte Enables: shows the active byte lanes. Active high

    ADDR [0:15] Output User Address: the address is valid for 2 clock cycles during CS

    CS Output Chip Select: active high select for read and write operations. Asserted for 2 clock cycles

    RNW Output Read Not Write: active high for reads and active low for write. Valid during CS

    SOUT Output Serial Output: UART output signal (optional)

    INTERRUPT_ACK Output Interrupt Acknowledge output: asserted high for one clock when the interrupt is being serviced

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 4

    Input and Output Interface Timing

    The user interface provides 64KB of input and output access through a simple controller. The access time for reads and writes is always 2 clock cycles based on the assertion of CS. The read and write timing diagram is shown in Figure 2.

    The address comes from the microcontroller user interface peripheral with a fixed address map from 0x1000_0000 to 0x1000_FFFF.

    The data follows a big endian addressing scheme. The relationship between the address and data for words, half-word, and byte transfers is shown in Figure 3. Byte enables can be ignored when doing only word (32-bit) transfers. Unaligned transfers are not recommended.

    X-Ref Target - Figure 2

    Figure 2: Read and Write Timing Diagram

    X-Ref Target - Figure 3

    Figure 3: Relationship of Address and Data Transfers

    CLK

    RNW

    ADDR [0:15]

    DOUT [0:31]

    Write Cycle Timing

    BE [0:3]

    CS

    Addr

    Data

    BE

    CLK

    RNW

    ADDR [0:15]

    DIN [0:31]

    Read Cycle Timing

    BE [0:3]

    CS

    Addr

    Data

    BE

    X1141_02_060809

    DataSampled

    ValidDIN/OUTWord transfer, ADDR [15:16] = 0, BE[0:3] = 1111

    Valid Valid Valid0 317 8 23 2415 16

    ValidDIN/OUT

    Half-word transfer, ADDR [15:16] = 00, BE[0:3] = 1100

    Valid0 317 8 23 2415 16

    DIN/OUTHalf-word transfer, ADDR [15:16] = 10, BE[0:3] = 0011

    Valid Valid0 317 8 23 2415 16

    ValidDIN/OUT

    Byte transfer, ADDR [15:16] = 00, BE[0:3] = 1000

    0 317 8 23 2415 16

    DIN/OUT

    Byte transfer, ADDR [15:16] = 01, BE[0:3] = 0100

    Valid0 317 8 23 2415 16

    DIN/OUTByte transfer, ADDR [15:16] = 10, BE[0:3] = 0010

    Valid

    Valid

    0 3123 2415 16

    DIN/OUT

    Byte transfer, ADDR [15:16] = 11, BE[0:3] = 0001

    0 317 8 23 2415 16

    X1141_03_060809

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 5

    Interrupt Timing

    The system supports one level sensitive, active high external interrupt source. The microcontroller will respond to interrupts only if they have been enabled in software. If more interrupts are required, they can be multiplexed in the FPGA logic. A user addressable register could be created in the FPGA logic to keep track of the multiple interrupts. The interrupt acknowledge output signal can be used to clear the incoming interrupt signal. It is asserted for one clock cycle when the interrupt event is serviced.

    Clock and Reset

    The clock input can be as low as DC and as high as the ISE tools will allow. Assuming that a clock constraint is present on the clock used, no other constraints need to be specified.

    The Reset input is active high and can be synchronous or asynchronous to the clock input. The reset input will be synchronized to the clock internally.

    Serial Input and Output

    An option for a serial 16450 UART is provided as a pre-configured version. The Baud Rate is programmed in software to keep the UART independent from the clock input. Features for the UART include:

    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

    False start bit detection and recover

    Line break detection and generation

    Internal loop back diagnostic functionality

    Debug Interface

    The microcontroller uses the BSCAN resource of the target FPGA to communicate through JTAG. The interface is internal to the FPGA and does not require pins. It uses the dedicated FPGA JTAG pins. For architectures with a single BSCAN primitive, the microcontroller system would need to be customized or used in the no-debug configuration to be able to simultaneously use ChipScope Pro logic analyzer.

    X-Ref Target - Figure 4

    Figure 4: Interrupt Acknowledge Output Signal Diagram

    CLK

    INTERRUPT

    INTERRUPT_ACK

    X1141_04_060809

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 6

    Using the Microcontroller

    The microcontroller system comes in four pre-configured implementations for Spartan-6, Spartan-3, Virtex-6, and Virtex-5 FPGA architectures. For other architectures, see Customizing the Simple MicroBlaze Microcontroller, page 23.

    For the FPGA design, ISE is required. For the software flow, SDK is required. EDK is only needed if there is a need to customize the microcontroller system beyond what can be accomplished with the user interface.

    As shown in Figure 5, only three files are necessary to complete a microcontroller FPGA project: two files to be used with ISE, and one file to be used with SDK.

    Design Directory Contents

    The directories and files shown are provided to enable a Simple MicroBlaze Microcontroller design.

    Each pre-configured directory contains an hw and sw directory. The hw directory contains the files needed for ISE. The sw directory contains the file needed for SDK. The SMM_Src directory will be covered in the customization chapter. The SMM_Ref directory is described in Reference Design Overview, page 26.

    X-Ref Target - Figure 5

    Figure 5: Design Directories Structure

    SMM Note:The SMM_V6, SSM_S6, and SSM_V5 directories follow the same structure as the SMM_S3 directory structure shown below.

    hw

    smm.ngc

    smm.bmm

    smm.xml

    hw

    SMM_S3

    SMM_Src

    SMM_Ref

    SMM_Full

    SMM_UART_noDBG

    SMM_DBG_noUART

    SMM_noDBG_noUART

    SMM_V5

    X1141_05_060809

    SMM_V6

    SMM_S6

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 7

    SMM FPGA Design Flow

    The FPGA design flow follows the standard ISE design flow (Figure 6). The microcontroller system can be instantiated into VHDL and Verilog designs as a black box. The BRAM Memory Map file (smm.bmm) must be added to the ISE project. The netlist file (smm.ngc) is picked up during the translate phase.

    After BitGen, a new BRAM Memory Map file (smm_bd.bmm) will contain the locations of the BRAMs inside the FPGA. That information will be used to store code into the microcontroller main memory.

    X-Ref Target - Figure 6

    Figure 6: ISE Design Flow

    Note:Copy the two SMM hardwarefiles to the ISE project.

    Note:The {design}.bit and smm_bd.bmmfiles will be used by SDK.

    Synthesize (XST)

    Translate {NGB Build}

    smm.ngc

    smm.bmm

    X1141_05_060809

    - {design}.v .vhd - {sub_modules}.v .vhd - ...... - smm instantiation

    {design}.ngc

    {design}.ngd

    {design}.ncd

    Map {MAP}

    Place and Route {PAR}

    Generate Programming File{BitGen}

    smm_bd.bmm{design}.bit

    Constraints{design}.ucf

    ISE

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 8

    SMM HDL Instantiation Templates

    The microcontroller can be instantiated in VHDL and Verilog design at any level of hierarchy. Use the module declarations and instantiation templates shown in Figure 7, Figure 8, Figure 9, page 9, and Figure 10, page 9.

    X-Ref Target - Figure 7

    Figure 7: VHDL Component Declaration

    X-Ref Target - Figure 8

    Figure 8: VHDL Component Instantiation

    -- W ith U A R T

    c om ponent s m m is port ( S IN : in s td_ logic ; S O U T : out s td_logic ; C LK : in s td_ logic ; R E S E T : in s td_ logic ; D IN : in s td_ logic _ v ec tor(0 to 31 ) ; D O U T : out s td_logic _ v ec tor(0 to 31) ; B E : out s td_logic _ v ec tor(0 to 3); R N W : out s td_logic ; A D D R : out s td_logic _ v ec tor(0 to 15) ; C S : out s td_logic ; IN TE R R U P T : in s td_ logic ; IN TE R R U P T_A C K : out s td_logic ); end c om ponent ;

    at tribute B O X _ TY P E : S TR IN G;attribute B O X _ TY P E of s m m : c om ponent is "blac k _box ";

    -- W ithout U A R T

    c om ponent s m m is port ( C LK : in s td_logic ; R E S E T : in s td_logic ; D IN : in s td_logic _ v ec tor(0 to 31) ; D O U T : out s td_logic _v ec tor(0 to 31 ); B E : out s td_logic _v ec tor(0 to 3) ; R N W : out s td_logic ; A D D R : out s td_logic _v ec tor(0 to 15 ); C S : out s td_logic ; IN TE R R U P T : in s td_logic ; IN TE R R U P T_A C K : out s td_logic ); end c om ponent ;

    attribute B O X _ TY P E : S TR IN G;attribute B O X _ T Y P E of s m m : c om ponent is "blac k _box " ;

    X1141_07_060809

    -- W ith U A R T

    s m m_ i : s m m port m ap ( S IN = > S IN , S O U T = > S O U T , C LK = > C LK , R E S E T = > R E S E T , D IN = > D IN, D O U T = > D O U T , B E = > B E , R N W = > R N W , A D D R = > A D D R, C S = > C S , IN TE R R U P T = > IN TE R R U P T, IN TE R R U P T_A C K = > IN TE R R U P T_A C K );

    -- W ithout U A R T

    s m m _i : s m m port m ap ( C LK = > C LK , R E S E T = > R E S E T, D IN = > D IN, D O U T = > D O U T, B E = > B E, R N W = > R N W, A D D R = > A D D R, C S = > C S, IN T E R R U P T = > IN T E R R U P T, IN T E R R U P T_A C K = > IN T E R R U P T_A C K );

    X1141_08_060809

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 9

    X-Ref Target - Figure 9

    Figure 9: Verilog Module Declaration

    X-Ref Target - Figure 10

    Figure 10: Verilog Module Instantiation

    / / W ith U A R Tm odule s m m ( S IN, S O U T , C LK, R E S E T , D IN, D O U T , B E, R N W , A D D R, C S , IN TE R R U P T, IN TE R R U P T_A C K );

    input S IN; output S O U T ; input C LK ; input R E S E T ; input [0 :31 ] D IN; output [0:31 ] D O U T ; output [0:3 ] B E ; output R N W ; output [0:15 ] A D D R; output C S ; input IN TE R R U P T; output IN TE R R U P T_ A C K;endm odule

    // W ithout U A R T

    m odule s m m ( C LK , R E S E T , D IN, D O U T, B E , R N W , A D D R, C S , IN TE R R U P T, IN TE R R U P T_ A C K );

    input C LK ; input R E S E T ; input [0 :31] D IN; output [0 :31 ] D O U T ; output [0 :3 ] B E ; output R N W ; output [0 :15 ] A D D R; output C S ; input IN TE R R U P T; output IN TE R R U P T_A C K;endm odule

    X1141_09_060809

    / / W ith U A R T(*BOX_TYPE=black_box*)

    s m m s m m_i ( .S IN ( S IN ) , .S O U T ( S O U T ), .C LK ( C LK ), .R E S E T ( R E S E T ) , .D IN ( D IN ), .D O U T ( D O U T ), .B E ( B E ), .R N W ( R N W ), .A D D R ( A D D R ), .C S ( C S ), .IN TE R R U P T ( IN TE R R U P T ) , .IN TE R R U P T_ A C K ( IN TE R R U P T_A C K ) );

    / / W ithout U A R T(*BOX_TYPE=black_box*)

    s m m s m m_i ( .C LK ( C LK ), .R E S E T ( R E S E T ) , .D IN ( D IN ), .D O U T ( D O U T ), .B E ( B E ), .R N W ( R N W ), .A D D R ( A D D R ), .C S ( C S ) , .IN TE R R U P T ( IN TE R R U P T ) , .IN TE R R U P T_ A C K ( IN TE R R U P T_ A C K ) );

    X1141_10_060809

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 10

    BRAM Memory Map (BMM) File

    The smm.bmm file provides the memory map and BRAMs allocation for the BRAMs used by the processor as main memory.

    The BMM file is the same for all pre-configured versions of the microcontroller for a given architecture. The contents of the file are listed in Figure 11.

    The hierarchy of the BMM file must match the hierarchy of the FPGA design. The BMM file assumes that the microcontroller is instantiated at the top level with the name smm_i.

    If the microcontroller is instantiated in a sub module, the BMM file needs to be modified to reflect each hierarchy level.

    For example if the microcontroller was instantiated inside a sub-module named micro below the top level, the BMM file BUS_BLOCK hierarchy would have to be modified to:

    micro/smm_i/lmb_bram/lmb_bram/ramb...

    Using an S3ADSP part: The RAMB16 primitive for the S3ADSP part is slightly different from the one used in the S3A part. An additional modification needs to be made to the BMM file BUS_LOCK hierarchy as shown below to account for the automatic primitive replacement.

    smm_i/lmb_bram/lmb_bram/ramb16bwe_0/RAM16BWER [31:24];smm_i/lmb_bram/lmb_bram/ramb16bwe_1/RAM16BWER [23:16];smm_i/lmb_bram/lmb_bram/ramb16bwe_2/RAM16BWER [15:8];smm_i/lmb_bram/lmb_bram/ramb16bwe_3/RAM16BWER [7:0];

    X-Ref Target - Figure 11

    Figure 11: BMM File Contents

    AD D R ESS_M AP m icroblaze_0 M IC R OBLAZ E 100AD D R ESS_SPAC E lm b _bram _com bined C OM BIN ED [0x 00000000:0x00001fff]AD D R ESS_R AN GE R AM B16

    BU S_BLOC Ksm m _i/lm b _bram /lm b_bram/ram b16bw er_0 [31:24] ;sm m _i/lm b _bram /lm b_bram/ram b16bw er_1 [23:16] ;sm m _i/lm b _bram /lm b_bram/ram b16bw er_ 2 [15:8] ;sm m _i/lm b _bram /lm b_bram/ram b16bw er_3 [7:0] ;

    EN D _BU S_BLOC K;EN D _AD D R ESS_R AN GE;

    EN D_AD D R ESS_SPAC E;EN D _AD D R ESS_M AP;

    Vir tex -6 F am ily

    AD D R ESS_M AP m icroblaze _0 M IC R OBLAZ E 100AD D R ESS_SPAC E lm b _bram_com bined C OM BIN ED [0x 00000000:0x 00001fff]

    AD D R ESS_R AN GE R AM B32BU S_BLOC K

    sm m _i /lm b_bram/lm b_bram/ramb36e1_0 [31:16];sm m _i /lm b_bram/lm b_bram/ram b36e1_1 [15:0];

    EN D_BU S_BLOC K;EN D_AD D R ESS_R AN GE ;

    EN D_AD D R ESS_SPAC EEN D _AD D R ESS_M AP;

    X1141_11_060809

    Spartan-3 F am ily

    AD D R ESS_M AP m icroblaze_0 M IC R OBLAZ E 100AD D R ESS_SPAC E lm b _bram _com bined C OM BIN ED [0x 00000000:0x00001fff]AD D R ESS_R AN GE R AM B16

    BU S_BLOC Ksm m _i/lm b _bram /lm b_bram/ram b16bw e_0 [31:24] ;sm m _i/lm b _bram /lm b_bram/ram b16bw e_1 [23:16] ;sm m _i/lm b _bram /lm b_bram/ram b16bw e_2 [15:8] ;sm m _i/lm b _bram /lm b_bram/ram b16bw e_3 [7:0] ;

    EN D _BU S_BLOC K;EN D _AD D R ESS_R AN GE;

    EN D_AD D R ESS_SPAC E;EN D _AD D R ESS_M AP;

    Vir tex -5 F am ily

    AD D R ESS_M AP m icroblaze _0 M IC R OBLAZ E 100AD D R ESS_SPAC E lm b _bram_com bined C OM BIN ED [0x 00000000:0x 00001fff]

    AD D R ESS_R AN GE R AM B32BU S_BLOC K

    sm m _i /lm b_bram/lm b_bram/ram b36_0 [31:16] ;sm m _i /lm b_bram/lm b_bram/ram b36_1 [15:0] ;

    EN D_BU S_BLOC K;EN D_AD D R ESS_R AN GE;

    EN D_AD D R ESS_SPAC E;EN D _AD D R ESS_M AP;

    Spartan-6 Family

    ;

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 11

    Adding the Software Application to the Bitstream

    The software application can be loaded into the BRAMs as part of the configuration data. This enables the application to run as soon as the FPGA is configured and the microcontroller Reset signal has been de-asserted.

    There are two ways to generate the final bitstream file:

    1. Use SDK as shown in Step-by-Step SMM Design Example.

    2. Use the utility data2mem in command line mode. The files needed are the ISE {design}.bit file, the smm_bd.bmm file, and the {application}.elf executable file generated by SDK. In a DOS prompt you would type:

    data2mem -bm smm_bd.bmm -bt design.bit bd application.elf tag microblaze_0 -o b final.bit

    The final.bit file would contain the application code pre-loaded into the BRAMs.

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 12

    The SMM Software Flow

    A single file (smm.xml) contains all the information necessary to start a software project. Using SDK does not require ISE or EDK to be installed. A standalone SDK installation would be sufficient.

    The bit file and bmm file generated by ISE will be needed to program the FPGA and debug the application. They are not required to develop the application.

    Drivers and libraries, constituting the software platform, are provided to design a C or C++ application. SDK includes the GNU Compiler Collection as well as common utilities to support C and C++ applications.

    X-Ref Target - Figure 12

    Figure 12: SDK Design Flow

    Application_x

    Note:[design].bit and smm_bd_bmmare generated by ISE.

    Note:Copy the SMM software file to the SDK project location.

    X1141_12_060809

    Standalone Software Platform

    Note:Linker script Generator wizardfacilitates linker script creation.

    standalone.mss

    Pre-processor

    Linker

    Compiler

    {design}.bit

    smm_bd.bmm

    Program FPGA{Data2Mem + iMPACT}

    Debug Application

    Assembler

    - Libraries- drivers.h-drivers.c

    MicroBlaze Processor

    SDK

    Generate Libraries(LibGen)

    {App} linker script{App}.o

    smm.xml

    {App}.elf

    - {App}.h- {App}.c cpp

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 13

    SMM Address Map

    Table 3 shows the address map for the microcontroller. The user interface address on ADDR [0:15] correlates to the 64KB User Interface space allocated.

    Keeping a Small Software Footprint

    The EDK libraries contain standard C functions for I/O, such as printf and scanf. These functions are large and are not well suited for a simple microcontroller application. The Xilinx library provides smaller equivalent stdio functions that should be used instead.

    To print a string of characters to the UART use the command void print (char *).

    To output an integer to the UART use the command void putnum (int).

    Instead of using printf use the command void xil_printf (const *char ctrl1,...).

    This function is similar to printf but much smaller in size (only 1 kB). It does not have support for floating point numbers. xil_printf also does not support printing of long (such as 64-bit numbers).

    Some other suggestions:

    When creating the linker script for the application, make sure that the stack and heap sizes are appropriate for the application

    After the code is debugged in SDK, switch to the active configuration for the application from Debug to Release.

    When using Xilinx peripherals (like the UART), use the low level drivers for the peripheral. The low level drivers have a *_l.h file name. For example: xuartns550_l.h

    Be careful of unnecessary variable initialization. Initialized variables are part of the data section which will increase the size of the executable.

    Use the smallest variable type needed for the application.

    Table 3: SMM Address Map

    SMM RAM/ROM User Interface UART 16450 Registers

    0x00000000 to 0x00001FFF 0x10000000 to 0x1000FFFF 0x80000000 to 0x8000FFFF

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 14

    Step-by-Step SMM Design Example

    The following steps create a simple microcontroller design to illustrate the flow. The example design covers a Spartan-6 FPGA board as well as a Virtex-6 FPGA board.

    The design makes use of the board switches, LEDs, and RS232 UART to create a simple microcontroller example design. The processor reads the switches values using its input port and writes the values to the LEDs using its output port. The UART is used to display simple messages to a terminal.

    Hardware Steps 1. Start ISE 12.1 Project Navigator and create a new project. File > New Project

    2. Select a project location (for example: C:\SMM_proj\ and a project name (for example: SimpleMicro).

    3. Click Next.

    4. Select the device properties.

    a. For the Spartan-6 SP605 board:

    - Family: Spartan-6

    - Device: XC6SLX45T

    - Package: FGG484

    - Speed: -3

    b. For the Virtex-6 ML605 board:

    - Family: Virtex-6

    - Device: XC6VLX240T

    - Package: FF1156

    - Speed: -1

    5. Select the project properties:

    - Synthesis Tool: XST

    - Preferred Language: VHDL (Verilog can also be used)

    6. Leave the default settings for the other properties.

    7. Click Next, then Finish.

    8. Go to Project > New Source

    a. Select VHDL Module

    b. Type the file name simplemicro.

    c. Click Next.

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 15

    9. Add the ports for the clock, reset, UART, pushbuttons, and LEDs (Figure 13).

    10. Click Next, then Finish.

    11. Copy the smm.ngc and smm.bmm files from the SMM\SMM_S6\SMM_Full\hw directory for the SP605 project, or SMM\SMM_V6\SMM_Full\hw directory for the ML605 projectto the ISE project directory (for example: C:\SMM_proj\SimpleMicro)

    12. In ISE, open the simplemicro.vhd file.

    13. Add the SMM component declaration between the architecture and the begin statements, as shown below.

    architecture Behavioral of simplemicro iscomponent smm is port ( SIN : in std_logic; SOUT : out std_logic; CLK : in std_logic; RESET : in std_logic; DIN : in std_logic_vector(0 to 31); DOUT : out std_logic_vector(0 to 31); BE : out std_logic_vector(0 to 3); RNW : out std_logic; ADDR : out std_logic_vector(0 to 15); CS : out std_logic; INTERRUPT : in std_logic; INTERRUPT_ACK : out std_logic ); end component;

    attribute BOX_TYPE : STRING; attribute BOX_TYPE of smm : component is "black_box";

    begin

    X-Ref Target - Figure 13

    Figure 13: Simplemicro Module PortsX1141_13_060809

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 16

    14. Add the signal declarations below before the begin statement for the internal signals.

    signal CS : std_logic; signal RNW : std_logic; signal DOUT : std_logic_vector (0 to 31); signal DIN : std_logic_vector (0 to 31); signal leds_int : std_logic_vector (3 downto 0);

    begin

    15. Add the SMM instantiation after the begin statement, as shown below.

    begin

    smm_i : smm port map ( SIN => UART_sin, SOUT => UART_sout, CLK => Clock, RESET => Reset, DIN => DIN, DOUT => DOUT, BE => open, RNW => RNW, ADDR => open, CS => CS,

    INTERRUPT => '0', INTERRUPT_ACK => open );

    Because we will be using only one read address and one write address, there is no need to decode the address coming from the microcontroller. We will respond to all addresses in the 64KB range. The DIN port will be used to sample the pushbuttons and the DOUT port will drive the LEDs. We will capture the DOUT port during CS to hold the LED values.

    16. Add the HDL code before the end Behavioral; statement for the pushbuttons and LEDs, as shown below.

    process( Clock ) is begin if ( Clock'event and Clock = '1' ) then if ( CS = '1' and RNW = '0') then leds_int

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 17

    19. Click OK.

    The BMM file does not need to be modified since the microcontroller is instantiated at the top level.

    20. In ISE, double-click on Synthesize - XST to synthesize the design.

    21. Now add the timing and pin constraints.

    For the ML605 use the position LEDs and pushbuttons.

    For the SP605 use the GPIO LEDs and the position pushbuttons.

    22. In the ISE processes window, expand the User Constraints selection.

    23. Double-click on Create Timing Constraints.

    24. Click Yes to add the UCF file to the project.

    25. Double-click below TIMESPEC Name to add a new constraint.

    26. Select the clock period for the board, then click OK.

    The board single-ended clock was chosen to keep the design simple.

    SP605: 27 MHz

    ML605: 66 MHz

    27. Close the Timing Constraint window. Click Yes to save the constraint file.

    28. In ISE, select the simplemicro.ucf file. Double-click the Edit Constraints text in the Processes window.

    X-Ref Target - Figure 14

    Figure 14: Clock Period Definition

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 18

    29. Add the pin assignment constraints shown below for the ports.

    For the SP605 Board:

    NET "Reset" LOC = "H8" | IOSTANDARD = LVCMOS15;NET "Clock" LOC = "AB13" | IOSTANDARD = LVCMOS25;

    NET "UART_sin" LOC = "H17" | IOSTANDARD = LVCMOS25;NET "UART_sout" LOC = "B21" | IOSTANDARD = LVCMOS25;

    NET "LEDs" LOC = "D17" | IOSTANDARD = LVCMOS25;NET "LEDs" LOC = "AB4" | IOSTANDARD = LVCMOS25;NET "LEDs" LOC = "D21" | IOSTANDARD = LVCMOS25;NET "LEDs" LOC = "W15" | IOSTANDARD = LVCMOS25;

    NET "Buttons" LOC = "F3" | IOSTANDARD = LVCMOS15;NET "Buttons" LOC = "G6" | IOSTANDARD = LVCMOS15;NET "Buttons" LOC = "F5" | IOSTANDARD = LVCMOS15;NET "Buttons" LOC = "C1" | IOSTANDARD = LVCMOS15;

    For the ML605 Board:

    NET "Reset" LOC = "H10" | IOSTANDARD = SSTL15 | PULLUP;NET "Clock" LOC = "U23" | IOSTANDARD = LVCMOS25;

    NET "UART_sin" LOC = "J24" | IOSTANDARD = LVCMOS25;NET "UART_sout" LOC = "J25" | IOSTANDARD = LVCMOS25;

    NET "LEDs" LOC = "AD21" | IOSTANDARD = LVCMOS25;NET "LEDs" LOC = "AE21" | IOSTANDARD = LVCMOS25;NET "LEDs" LOC = "AH27" | IOSTANDARD = LVCMOS25;NET "LEDs" LOC = "AH28" | IOSTANDARD = LVCMOS25;

    NET "Buttons" LOC = "H17" | IOSTANDARD = LVCMOS15;NET "Buttons" LOC = "G17" | IOSTANDARD = LVCMOS15;NET "Buttons" LOC = "A19" | IOSTANDARD = LVCMOS15;NET "Buttons" LOC = "A18" | IOSTANDARD = LVCMOS15;

    30. Save and close the file.

    31. Select simplemicro.vhd in the ISE Sources window.

    The design is ready to be implemented.

    32. Double-click on Generate Programming File in the ISE Processes window.

    The hardware steps are complete. Verify that the ISE project directory contains a simplemicro.bit file and a smm_bd.bmm file.

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 19

    Software Steps 1. Inside the C:\SMM_proj directory, create a SimpleMicro_SDK directory.

    Copy the smm.xml file from the SMM\SMM_S6\SMM_Full\sw directory for the SP605 project, or

    SMM\SMM_V6\SMM_Full\sw directory for the ML605 project

    20, to the SimpleMicro_SDK directory.

    2. Start Xilinx SDK 12.2.

    3. Browse to the C:\SMM_proj\SimpleMicro_SDK directory for the workspace selection.

    4. Click OK.

    The Welcome page contains information and help topics for the software development kit.

    The first step is to select the hardware platform for the project.

    5. Go to File > New > Xilinx Hardware Platform Specification.

    6. Browse to the smm.xml file in the C:\SMM_proj\SimpleMicro_SDK directory for the Hardware Specification File.

    7. Click Finish.

    Creating the Software Application

    SDK will create a Board Support Package based on the hardware platform. The application will be using the libraries and drivers created for the platform.

    1. Go to File > New > Xilinx C Project

    2. Select simple for the project name, select Empty Application, then click Next.3. Select standalone for the Project name of the Board Support Package. Click Finish.

    Adding the Application

    1. Add a new source file for the project by selecting File > New > Source File.

    2. Name the Source File simple.c.

    3. Click Finish.

    4. Add the application as shown below to thesimple.c file you just created.

    #include #include "xuartns550_l.h"#include "xio.h"#include "xbasic_types.h"

    #define STDOUT_BASEADDR 0x80000000

    int main(){

    Xuint8 Buttons;

    /* Setup the UART Baud Rate to 9600*/ XUartNs550_SetBaud(STDOUT_BASEADDR, 27000000, 9600); /* Use this for ML605 XUartNs550_SetBaud(STDOUT_BASEADDR, 66000000, 9600); */

    XUartNs550_SetLineControlReg(STDOUT_BASEADDR,XUN_LCR_8_DATA_BITS);

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 20

    print("Simple Microcontroller Application\n\r");

    while (1) { /* Read the Push Button Values */ Buttons = XIo_In8(0x10000000); /* Output to the LEDs */

    XIo_Out8(0x10000000, Buttons); } }

    The second argument in the XUartNx550_SetBaud function call indicates the clock frequency of the microcontroller. The third argument indicates the desired UART baud rate. The application reads the pushbutton values and outputs the result to the LEDs.

    5. Save the file. The project builds automatically.

    The included files are provided by the standalone platform and can be found under standalone/microblaze_0/include in the C/C++ Projects perspective window. The include files for the UART 16450 drivers are located in that directory.

    6. Create a new Linker Script for the application by selecting Xilinx Tools > Generate Linker Script

    7. Click Generate, then Yes.

    The software application is now ready to be used.

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 21

    Programming the FPGA1. Connect the two Type-A to Mini-B USB cables.

    2. Power-on the board.

    3. Open Hyperterminal and connect at 9600, no parity.

    4. Go to Xilinx Tools > Program FPGA

    5. Browse to the ISE project C:\SMM_proj\SimpleMicro and use simplemicro.bit for the bit file.

    6. Browse to the ISE project C:\SMM_proj\SimpleMicro and use smm_bd.bmm for the Bmm File.

    7. Select simple.elf to be initialized inside the BRAM memory (Figure 15).

    8. Click Program. The software application will be added to the BRAMs inside the bitstream. A new bit file, download.bit, is created.

    9. Check Hyperterminal for the print statement and press the pushbuttons to turn on the LEDs.

    X-Ref Target - Figure 15

    Figure 15: FPGA Programming

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 22

    Debugging the Application

    Because we selected a microcontroller version with Debug Support, we can debug the application.

    1. Go to Run > Debug Configurations 2. Click on New launch configuration

    A new debug configuration is created for the simple application.

    3. Click Debug.

    The Debug perspective provides all the necessary tools and information to debug a software application.

    The editor window shows the file being debugged. Placing the cursor over variables shows the current value for the variable.

    The Debug window provides information on the status of the session. The application is currently stopped, waiting for input. The green arrow resumes the application; the red square terminates the session. Multiple stepping options are available, including stepping in assembly mode.

    4. Click the Registers tab in the top right window to view the MicroBlaze registers. Any changes from the last context are shown in red.

    5. To view the source disassembly select Window > Show View > Disassembly.

    6. Click the Memory tab on the bottom left.

    7. Click on the + sign to add a memory selection. Type 0x0, which is the start of the main memory, in the address field of the memory window. Click OK.

    8. Double-click in the column on the left of the print statement to set a breakpoint.

    9. Click the Resume icon on the toolbar to go to the breakpoint.

    The line will be highlighted in green.

    10. Click on the Step Over icon on the toolbar to print the line.

    Registers and memory values can be modified from the debugger.

    11. Step to the XIo_Out8 line. Click the Variables tab in the top right window.

    The value of the variable Buttons reflects the pushbutton values.

    12. Right-click the variable Buttons and select Change Value Set the value to 0xFF.

    13. Step to execute the XIo_Out8 function. All the LEDs should turn on.

    X-Ref Target - Figure 16

    Figure 16: Debug Configuration

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 23

    14. Click the Terminate icon to stop the debug session.

    15. Click the C/C++ perspective above the Debug window to go back to the projects view.

    The bitstream file created by SDK with the application loaded into BRAMs is located at

    C:\SMM_proj\SimpleMicro_SDK\SMM_Full_hw_platform\download.bit.

    The updated bit file can be used to create a PROM file or can be used directly by iMPACT to configure the FPGA.

    Customizing the Simple MicroBlaze Microcontroller

    As the microcontroller is built using MicroBlaze, more standard peripherals and options are available to customize the embedded system. A user might want to use a different FPGA architecture or add more main memory or a Floating Point Unit or a standard SPI or I2C peripheral.

    To customize the microcontroller, EDK 12.1 is required. This section is not intended as a Xilinx Platform Studio (XPS) tutorial. Some prior knowledge of XPS is recommended. To understand the flow to customize the microcontroller we increase the main memory for the V5 from 8 KB to 16 KB. Figure 17 shows the XPS project diagram for the microcontroller.X-Ref Target - Figure 17

    Figure 17: XPS Project Diagram

    8 kBBRAM

    LMBController

    RESETSystemReset

    LMBController

    X1141_17_060809

    SMM User Interface

    SIN RNW ADDR DIN DOUT BE

    UART 16450

    SIN

    MicroBlazeProcessor

    ILMB

    Debug

    DLMB

    DPLBMDM

    BSCAN

    SOUT

    INTERRUPT_ACK

    INTERRUPT

    CLK

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 24

    SMM Source Directory Contents

    The source files to generate the microcontroller are provided for each configuration (Figure 18).

    Each architecture directory contains a complete XPS project for the four pre-configured versions of the Simple MicroBlaze Microcontroller. Our example modifies the SMM_Src\V5\SMM_Full project.

    X-Ref Target - Figure 18

    Figure 18: Source Directory Contents

    SMM

    Note:The V6, S6, and S3 directories follow thesame structure as the V5 directory structure shown below.

    etc

    pcores

    smm.mhs

    smm.xmp

    SMM_V5

    SMM_S5

    SMM_Src

    SMM_Ref

    SMM_Full

    SMM_UART_noDBG

    SMM_DBG_noUART

    SMM_noDBG_noUART

    V6

    V5

    X1141_18_060809

    SMM_V6

    SMM_S6

    S6

    S3

    data

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 25

    SMM Customization 1. Copy the SMM_Src\V5\SMM_Full directory to a working directory.

    For example C:\SMM_proj\custom\SMM_Full.

    2. Start Xilinx Platform Studio (XPS) 12.1 and open the smm.xmp project.

    3. Select the Addresses tab in the System Assembly View.

    4. Expand microblaze_0s Address Map.

    5. For the dlmb_cntlr and ilmb_ctlr, select 16K.

    6. Go to Hardware > Generate Netlist to create the new netlist and BMM file.

    7. When complete, go to Project > Export Hardware Design to SDK to create the new xml file. Click on Export Only.

    8. Copy the three required SMM files to the working ISE and SDK projects. The files locations are:

    smm.ngc: C:\SMM_proj\custom\SMM_Full\implementation\smm.ngc

    smm.bmm: C:\SMM_proj\custom\SMM_Full\implementation\smm_stub.bmm

    smm.xml: C:\SMM_proj\custom\SMM_Full\SDK\SDK_Export\hw\smm.xml

    When replacing an existing smm.ngc file in the ISE project, a full re-implementation of the FPGA is necessary.

    When replacing an existing smm.xml file in the SDK project, SDK will automatically detect a new xml file and will rebuild the software platform to match the new configuration

    SMM Reference Designs

    Reference designs are provided in the SMM_Ref directory. They are two identical designs, one for the S3A Starter Kit and the other for the ML605 board.

    The reference design uses the SMM to print information to the character LCD screen. The ISE and SDK projects are provided using the smallest pre-configured version of SMM (without Debug and UART). The directory structure for the reference directory is shown in Figure 19.

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 26

    Reference Directory Contents

    The src directory contains the VHDL source files for the ISE project. The ise directory contains the ISE project, including the constraints file. The sdk directory contains the SDK project, including the C source file.

    Reference Design Overview

    The reference design uses a combination of FPGA logic and C code running on the microcontroller to output messages to the LCD screen.

    The microcontroller handles the initialization of the LCD and the printing of string messages to the LCD.

    Because the LCD timing is very slow, with some instructions requiring up to 1.6us of wait time, a 32-bit timer located in the FPGA logic handles the wait times. The timer generates an interrupt to the SMM to indicate that the timer has reached a loaded value.

    The LCD hardware timing is created in the FPGA logic. The microcontroller sends commands and data through a single 16-bit register. Bit 0 is used to differentiate between LCD data and commands.

    X-Ref Target - Figure 19

    Figure 19: Reference Directory Contents

    SMM

    Note:The S3A directory follows the same structureas the ML605 directory structure shown below.

    SMM_V5

    SMM_S3

    SMM_Ref

    SMM_Src

    lcd_ref

    S3A_LCD_Ref

    ML605_LCD_Ref

    ise

    lcd_ref.ucf

    smm.ngc

    sdk

    smm.xml

    smm.bmm

    lcd_ref.xise

    src

    lcd_ref.vhd

    lcd_ctlr.vhd

    timer.vhd

    X1141_19_060809

    http://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 27

    VHDL Source Files Overview lcd_ref.vhd: Top level VHDL file. Contains the input and output ports for the design, the

    SMM instantiation, the 32-bit timer instantiation, and the LCD Controller instantiation. For the S3A Kit, the LCD is used in 8-bit mode. For the ML605, the LCD is used in 4-bit mode. The South pushbutton is used as a user input. The pushbutton is sampled into a register using the clock input. The register is cleared when read by the SMM.

    timer.vhd: Sub-module VHDL file. Contains a 32-bit counter. The timer is loaded with a software accessible register. The counter starts after the load. An interrupt is generated when the counter reaches the loaded value. The INTERRUPT_ACK signal from the SMM is used to clear the interrupt.

    lcd_ctlr.vhd: Sub-module VHDL file. Contains the LCD screen logic. A 16-bit software accessible register is used to output data and commands to the LCD_DB pins. Bit 0 of the register is used to generate the LCD_RS bit. The least significant bits of the register are used for LCD_DB. Once a value is written to the register, the LCD_E signal is asserted. The logic handles the hold and width times of the LCD_E signal using a small counter.

    ISE Files Overview lcd_ref.xise: ISE project file

    lcd_ref.ucf: ISE project constraints file

    smm.ngc: SMM netlist without Debug Support and without UART

    smm.bmm: SMM BRAM Memory Map

    SDK Files Overview

    The sdk directory contains files needed for an SDK project. There is a single C source file for the processor.

    lcd_ref.c: C source file. Contains the LCD reference application source code. The application enable interrupts, initializes the LCD, writes a couple lines to the LCD, and waits for the pushbutton input to continue. Some local functions are created to make the code more readable.

    void Timer_Wait (Xuint32 delay): Sends the delay value to the FPGA logic timer and waits for the interrupt to be serviced.

    void timer_int_handler(void * arg): Interrupt service routine.

    void lcd_init (void): Handles the LCD screen initialization.

    void lcd_print (Xuint32 Line, Xuint8 *Str): Prints characters to the LCD. The Line argument indicates which of the 2 lines to print to.

    void lcd_clear (void): Clears the LCD Screen. It includes the 1.56ms delay required after a clear.

    lcd_4_write (Xuint16 value): For the ML605, the LCD is used in 4-bit mode. This function takes an 8-bit value and sends two 4-bit values to the LCD. It only applies for the ML605 design.

    http://www.xilinx.com/support/documentation/boards_and_kits/ug347.pdfhttp://www.xilinx.com/support/documentation/boards_and_kits/ug347.pdfhttp://www.xilinx.com

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 28

    Running the Design

    Follow these instructions to run the design on the S3A Kit or ML605.

    1. Open the ise directory and double-click on the lcd_ref.xise file.

    2. In Project Navigator double-click on Generate Programming File.

    3. Close Project Navigator when finished.

    4. Start Xilinx SDK 12.1.

    5. Browse to the sdk directory for the workspace selection and Click OK.

    6. Go to File > New > Xilinx Board Support Package. Click on Specify.

    7. Browse to the smm.xml file in the sdk directory for the Hardware Specification File and click Finish.

    8. Select standalone for the project name then click Finish, then OK.9. Go to File > Import Inside the General folder, select Existing Projects into

    Workspace. Click Next.

    10. Browse to the sdk directory. Make sure that only the lcd_ref project is checked.

    11. Click Finish.

    Wait for the project to build.

    12. Connect the USB JTAG cable.

    13. Power-on the board.

    14. Go to Xilinx Tools > Program FPGA

    15. Browse to the ISE project and use lcd_ref.bit for the Bit File.

    16. Browse to the ISE project and use smm_bd.bmm for the Bmm File.

    17. Select lcd_ref.elf to be initialized inside the BRAM memory.

    18. Click Program.

    19. Check the LCD screen. Press the South pushbutton to clear the screen and output a new line.

    References 1. UG081 MicroBlaze Processor Reference Guide 2. UG334 Spartan-3A/3AN FPGA Starter Kit Board User Guide

    3. UG534 ML605 Hardware User Guide

    4. UG526 SP605 Hardware User Guide

    http://www.xilinx.com/support/documentation/boards_and_kits/ug334.pdfhttp://www.xilinx.comhttp://www.xilinx.com/ise/embedded/edk91i_docs/mb_ref_guide.pdfhttp://www.xilinx.com/support/documentation/boards_and_kits/ug534.pdfhttp://www.xilinx.com/support/documentation/boards_and_kits/ug526.pdf

  • XAPP1141 (v3.0) November 9, 2010 www.xilinx.com 29

    Revision HistoryThe following table shows the revision history for this document.

    Notice of Disclaimer

    Xilinx is disclosing this Application Note to you AS-IS with no warranty of any kind. This Application Noteis one possible implementation of this feature, application, or standard, and is subject to change withoutfurther notice from Xilinx. You are responsible for obtaining any rights you may require in connection withyour use or implementation of this Application Note. XILINX MAKES NO REPRESENTATIONS ORWARRANTIES, WHETHER EXPRESS OR IMPLIED, STATUTORY OR OTHERWISE, INCLUDING,WITHOUT LIMITATION, IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT, ORFITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT WILL XILINX BE LIABLE FOR ANY LOSS OFDATA, LOST PROFITS, OR FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, OR INDIRECTDAMAGES ARISING FROM YOUR USE OF THIS APPLICATION NOTE.

    Date Version Description of Revisions

    07/08/09 1.0 Initial Xilinx release.

    02/08/10 2.0 Added support for Spartan-6 and Virtex-6 families. Replaced the ML505 reference design with the ML605 reference design.

    11/09/10 3.0 Updated tools versions, content in Table 1, and figures. Updated steps in Step-by-Step SMM Design Example and SMM Reference Designs.

    http://www.xilinx.com

    The Simple MicroBlaze Microcontroller ConceptSummaryIntroductionHardware and Software RequirementsReference System SpecificsSimple MicroBlaze Microcontroller FeaturesMicrocontroller Interfaces

    Signal DescriptionsInput and Output Interface TimingInterrupt TimingClock and ResetSerial Input and OutputDebug Interface

    Using the MicrocontrollerDesign Directory ContentsSMM FPGA Design FlowSMM HDL Instantiation TemplatesBRAM Memory Map (BMM) FileAdding the Software Application to the BitstreamThe SMM Software FlowSMM Address MapKeeping a Small Software Footprint

    Step-by-Step SMM Design ExampleHardware StepsSoftware StepsProgramming the FPGADebugging the Application

    Customizing the Simple MicroBlaze MicrocontrollerSMM Source Directory ContentsSMM Customization

    SMM Reference DesignsReference Directory ContentsReference Design OverviewVHDL Source Files OverviewISE Files OverviewSDK Files OverviewRunning the Design

    ReferencesRevision HistoryNotice of Disclaimer

    /ColorImageDict > /JPEG2000ColorACSImageDict > /JPEG2000ColorImageDict > /AntiAliasGrayImages false /CropGrayImages true /GrayImageMinResolution 150 /GrayImageMinResolutionPolicy /OK /DownsampleGrayImages true /GrayImageDownsampleType /Bicubic /GrayImageResolution 300 /GrayImageDepth -1 /GrayImageMinDownsampleDepth 2 /GrayImageDownsampleThreshold 1.50000 /EncodeGrayImages true /GrayImageFilter /DCTEncode /AutoFilterGrayImages true /GrayImageAutoFilterStrategy /JPEG /GrayACSImageDict > /GrayImageDict > /JPEG2000GrayACSImageDict > /JPEG2000GrayImageDict > /AntiAliasMonoImages false /CropMonoImages true /MonoImageMinResolution 1200 /MonoImageMinResolutionPolicy /OK /DownsampleMonoImages true /MonoImageDownsampleType /Bicubic /MonoImageResolution 1200 /MonoImageDepth -1 /MonoImageDownsampleThreshold 1.50000 /EncodeMonoImages true /MonoImageFilter /CCITTFaxEncode /MonoImageDict > /AllowPSXObjects false /CheckCompliance [ /None ] /PDFX1aCheck false /PDFX3Check false /PDFXCompliantPDFOnly false /PDFXNoTrimBoxError true /PDFXTrimBoxToMediaBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXSetBleedBoxToMediaBox true /PDFXBleedBoxToTrimBoxOffset [ 0.00000 0.00000 0.00000 0.00000 ] /PDFXOutputIntentProfile () /PDFXOutputConditionIdentifier () /PDFXOutputCondition () /PDFXRegistryName () /PDFXTrapped /False

    /Description >>> setdistillerparams> setpagedevice