uwbr matlab ise

Upload: jebilee

Post on 14-Apr-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/30/2019 UWBR Matlab Ise

    1/20

    From Matlab/Simulink to ISE

    Version number Date

    1.0 2008

    Author: Sandro Noto

    Revised by: Helena Sarmento

    Technical Report

    Project: UWB Receiver: baseband processing using reconfigurable hardware (UWBR)

    PTDC/EEA-ELC/67993/2006

  • 7/30/2019 UWBR Matlab Ise

    2/20

    2

    Funded by:

  • 7/30/2019 UWBR Matlab Ise

    3/20

    3

    Funded by:

    Abstract

    System Generator can be useful when implementing the design flow as described by [1].

    With Simulink, with its blocksets, and Matlab code we can explore an algorithm in a

    functional domain. Using System Generator blocks (Xilinx blockset) we can also design inthe functional domain, but towards an FPGA implementation (physical domain). System

    Generator provides interfaces to CAD tools (ISE, ModelSim). System Generator

    automatically compiles designs into low-level representations. Experiments using hardware

    generation can suggest the hardware speeds that are possible and, through the resourceestimation, give a rough idea of the cost of the design in hardware. If a promising approach

    is identified, system generator can create the bit stream (physical level) to the FPGA.

    System Generator allows refinements (lower levels) to be done in steps. Some portions ofthe design can be made ready for implementation in hardware, while others remain

    described by Simulink blocks, System generator blocks or were designed outside and are

    inside a wrapper to be wired in the System Generator tool. The mixed descriptions can be

    simulated in a multiple environment. Hardware descriptions can be emulated in the FPGA

    (Co-Simulation).This report describes the design of a small example. This example permitted to understand

    the interfaces between Simulink, ISE [2] and the FPGA, as well as the capabilities to designthe complete Ultra Wide Band receiver. The example demonstrates the use of System

    Generator, using a ML402 evaluation platform with a Virtex-4 xc4vsx35-10ff668. The

    necessary steps to configure the board through an Ethernet interface are also part of thisreport.

  • 7/30/2019 UWBR Matlab Ise

    4/20

    4

    Funded by:

  • 7/30/2019 UWBR Matlab Ise

    5/20

    5

    Funded by:

    Table of Contents

    Introduction.............................................................................................................................7

    ML402 Configuration .........................................................................................................8

    Board setup .........................................................................................................................9

    Network setup ...................................................................................................................10CompactFlash setup..........................................................................................................13

    Verifying the board...........................................................................................................13

    Simulink, ISE and FPGA design ..........................................................................................14

    Simulink with Xilinx Blockset..........................................................................................14

    FPGA co-simulation .........................................................................................................15

    Results and conclusions ........................................................................................................19References.............................................................................................................................20

  • 7/30/2019 UWBR Matlab Ise

    6/20

    6

    Funded by:

  • 7/30/2019 UWBR Matlab Ise

    7/20

    7

    Funded by:

    IntroductionSystem Generator is a system-level modeling tool that extends Simulink to provide FPGA

    hardware design. It offers high-level abstractions, the System Generator blocks (Xilinx

    blockset), that can be automatically compiled into an FPGA. System Generator cangenerate equivalent representations of the design, at the same or lower level. For example,

    from the functional domain it can generate a structural representation, an HDL or NGCnetlist, or a physical representation such as an FPGA configuration bitstream. It can also togenerate an equivalent high-level module that performs a specific function in applications

    external to System Generator (ModelSim hardware co-simulation) [3].

    System Generator does not substitute hardware design, but permits to design less critical

    portions with System Generator blocks and then combined them with the other criticalones. Therefore:

    Parts of the design are implemented using System Generator blocks. SystemGenerator employs libraries of intellectual property (IP) to automatically map

    abstractions onto device primitives.

    Other parts are designed directly in the FPGA using basic functions (adders,registers, memories) and a HDL language. The developed code (VHDL, Verilog)

    can be imported using wrappers to create Black Boxes. Black boxes are wired intothe design, participate in simulations, and are compiled into hardware.

    The complete design is a combination of all the parts (System Generator blocks andimported blocks) into a working whole.

    System Generator offers mechanisms to:

    To import HDL code into a design. A configuration wizard can be used to associatethe HDL module to a Black Box block. The wizard creates an M-function that

    defines the interface, the implementation and the simulation behavior of the black

    box block it is associated with.

    To automatically generate an HDL testbench, including test vectors. Uponrequested, System Generator generates a testbench that produces files to allow

    comparisons of simulation results between Simulink and ModelSim (HDLsimulator). The testbench is a wrapper that feeds the stimuli to the HDL for the

    design and compares HDL results against expected ones.

    To perform hardware co-simulations, hardware run under the control of Simulink,bringing the power of MATLAB and Simulink to bear for data analysis andvisualization. For hardware Co-Simulation, a bitstream is created and associated to

    a block. When the design is simulated in Simulink, results for the compiled portion

    are calculated in hardware

    The example (named cosimul) used in this report was described with basic blocks ofSimulink and with blocks from Xilinx blockset. The Xilinx Blockset contains some low-

    level blocks, providing access to device-specific hardware, and high level blocks,

    implementing signal processing and advanced communications algorithms. The descriptionbase on the Xilinx blockset was compiled to create the bitstream. Finally, a co-simulation

    was performed where the bitstream is downloaded to the FPGA board and the hardware

    outputs are analyzed by Simulink.

  • 7/30/2019 UWBR Matlab Ise

    8/20

    8

    Funded by:

    ML402 ConfigurationFor the hardware co-simulation, the communication between the System Generator and the

    ML402 board was established through Ethernet. JTAG can also be used. Using Ethernet,

    the board connects to the PC either remotely across a network or directly using a standard

    Ethernet cable. System Generator automatically wraps the design with the logic necessary

    to communicate with the FPGA over an Ethernet connection during the simulation.A CompactFlash card installed on the ML402 board contains a special boot-loader image

    that allows the FPGA to receive, over the Ethernet cable, the bitstreams to be simulated onthe FPGA. The ML402 configuration process is performed over the same Ethernet

    connection used for co-simulation.

    To use the ML402 board with System Generator for DSP we need a 15W (5V @ 3A) AC

    adapter, a Compact Flash (CF) card and CF reader. The PC requires two NICs (NetworkInterface Card) for Ethernet connection, one to access the Matlab license server and another

    to connect to the ML402 board.

    Windows XP Professional, MATLAB 7.6.0 (R2008a) and Xilinx System Generator 10.1

    were used to install and configure the ML402 board. We connected the ML402 board andthe NIC board in the PC through an RJ45 Ethernet cable and we followed the instructions

    in [3]. To set-up the board, the Network and the CompactFlash we followed [3].

  • 7/30/2019 UWBR Matlab Ise

    9/20

    9

    Funded by:

    Board setup

    Figure 1 ML402 evaluation platform (front) [5]

    For the board setup we performed the following steps:

    1. Inserted the CompactFlash card with the power switch OFF (see Figure 3).2. Plugged the power supply adapter cable into the ML402 board and to AC power.3. Configured the address and mode DIP switch (Figure 1). Dip switches number 1, 4

    and 6 up and dip switches 2, 3 and 5 down (Figure 2).

    4. Configure the source selector switch to SYS ACE (Figure 1).

    Figure 2 Address and mode DIP switches [3]

    SYS ACE switch

    LEDs

    Address and mode

    DIP switches

    Power switch

  • 7/30/2019 UWBR Matlab Ise

    10/20

    10

    Funded by:

    Figure 3 ML402 evaluation platform wit CompactFlash inserted (back) [5]

    Network setup

    Figure 4 Network connections on Control Panel

    Power switch 5V ower ack

  • 7/30/2019 UWBR Matlab Ise

    11/20

    11

    Funded by:

    To configure the Ethernet connection, we performed the following steps:

    1. Found the reference of the NIC connected to the ML402 evaluation platform board.In this example is a SMC9452TX-2 Gigabit Ethernet PCI board.

    2. Configured the board identified in the previous step on network connections of thecontrol panel: Click Start Control Panel Network Connections, and next select

    Properties (Figure 4).

    3. Selected TCP-IP (Figure 5) and then Properties. Set the IP. The IP must be in thesame sub-network of the ML402 IP. Initial IP values were in the 192.168.8.0/24

    range [3]. After the CompactFlash configuration we detected some problems

    (Figure 6) that were solved changing the IP range. The IP value of the ML boardwas changed from 192.168.8.1 to 1.2.3.1, editing the IP.dat file in the

    CompactFlash

    4. Set the NIC board to 1.2.3.2 with a network mask to 255.255.255.0 (Figure 5).5. Configured the communication, selecting the Configure button (Figure 7) and then

    the Advanced tab (Figure 8), to enable flow control and automatic negotiation in the

    communication speed and duplex mode.

    Figure 5 TCP-IP properties

    Figure 6 IP assignment problems

  • 7/30/2019 UWBR Matlab Ise

    12/20

    12

    Funded by:

    Figure 7 Configuration

    Figure 8 Communication speed and flow control

  • 7/30/2019 UWBR Matlab Ise

    13/20

    13

    Funded by:

    CompactFlash setupTo configure the memory card, we performed the following steps:

    1. Used a CompactFlash reader to mount a CompactFlash as a disk drive.2. Formatted the CompactFlash as FAT16, using the mkdofs command (mkdosfs v

    F 16) [4].

    3. Ran the unzip command in a Matlab window:unzip(fullfile(xlFindSysgenRoot,'plugins/bin/ML506_sysace_cf.zip'), ':\')

    to transfer to the CompactFlash the files: IP.dat (IP configuration), MAC.dat (MAC

    configuration), xilinx.sys and the folder ml402 (with boot files) (Figure 9).

    Figure 9 CompactFlash configuration files [3]

    4. Edited IP.dat to change the ML402 IP to 1.2.3.1.5. Eject the CompactFlash from the PC

    Verifying the boardAfter power on, we verified the network configuration looking at the green LEDs identified

    on Figure 1 (TX, RX, DUP, 1000, 100, 10) and the LCD. LCD displayed MAC and IPaddresses. The LEDs indicating 1000 Mbps, Rx and TX were illuminated.

    To verify the network connection, a ICMP (Internet Control Message Protocol) ping

    command was issued in the PC (Figure 10) with a successful message.

  • 7/30/2019 UWBR Matlab Ise

    14/20

    14

    Funded by:

    Figure 10 ICMP ping command

    Simulink, ISE and FPGA designWe analyzed the design environment, involving the Matlab/Simulink, ISE and the ML402

    board. For that we design a very small example that uses a XOR function to invert the bitsof a random bit stream.

    Simulink with Xilinx Blockset

    Figure 11 Simulink and Xilinx blocksets descriptions (example)

    On Figure 11 the XOR is described by the XOR logical operator of Simulink or by the XORblock of Xilinx blockset. The input bit stream, for simulation purposes, is generated by a

    Bernoulli binary generator (Communications blockset). The Scope block (Simulink basic

    block) permitted the analysis and comparison of simulations results. Both blocks are

    Simulink blocks. To use Xilinx blocksets, we need Gateway In and Gateway Out blocksthat become the input and output ports when translated into hardware. Simulation results

    obtained by the Scope block are represented on Figure 12.

  • 7/30/2019 UWBR Matlab Ise

    15/20

    15

    Funded by:

    Figure 12 Simulation results with Simulink and Xilinx blockset

    FPGA co-simulation

    In this example, everything needed for a design is available inside System Generator. Wedo not use exterior blocks. Simulink basic blocks used only generate the bitstream and

    permit data visualization.

    Pressing the Generate button in System Generator generates files for the ISE package:

    HDL code describing the design itself; a clock wrapper that produces the clock and clock enable signals that the design

    needs;

    HDL code for the testbench that encloses the clock wrapper to allow results fromSimulink simulations to be compared against ones produced by a logic simulator;

    project files and scripts to allow XST synthesis tools to operate on generated HDL; Files to allow the HDL code to be used as a project in Project Navigator.

    To generate the system block, representing our example, we performed the following steps:

    1. Opened the System Generator block and choose for Compilation Hardware Co-Simulation, ML402 board, Ethernet and Network based (Figure 13). We also triedthe option Point-to-Point without success when running the simulation.

  • 7/30/2019 UWBR Matlab Ise

    16/20

    16

    Funded by:

    2. Choose the Generate button. A system block was created including the descriptionof the bitstream inverter, corresponding to the description between Gateway In andGateway Out (Figure 14). The locations of the GateWay In and Gateway Out ports

    and the speeds at which they must operate can be entered in the Gateway In and Out

    parameter dialog boxes [3].

    3. Copied the generated block (cosimul) (Figure 14) in the Simulink window to obtaina description for hardware co-simulation. The Bernoulli generator and the Scopeblock (Figure 15) were simulated in Simulink, the cosimul block will run in the

    FPGA (co-simulation).

    4. Verified the IP address in the Network tab, clicking on the block (Figure 16). Set itto 1.2.3.1 (see CompactFlash setup).

    5. Executed the hardware co-simulation. We connected the Ethernet cable between theboard and the PC NIC card and the power cord to the AC power supply. Wepowered the ML402 board (power switch ON). In the Simulink window we initiated

    the simulation. Different messages indicating the generation of ACE files, the

    FPGA configuration and the network connection appeared before simulation is

    finished. Opening the scope blocks, simulation results appeared (Figure 17).Simulated the complete system in Simulink. To

    6. We also tried the option Point-to-Point (step 1), but an error occurred when weexecuted the co-simulation.

  • 7/30/2019 UWBR Matlab Ise

    17/20

    17

    Funded by:

    Figure 13 System block generation

    Figure 14 System block

  • 7/30/2019 UWBR Matlab Ise

    18/20

    18

    Funded by:

    Figure 15 Hardware co-simulation description

    Figure 16 Set IP address

  • 7/30/2019 UWBR Matlab Ise

    19/20

    19

    Funded by:

    Figure 17 Hardware co-simulation results

    Results and conclusionsWe analyzed this example, using a PC with an Intel Pentium 3.2 GHz and 512 Mbytes of

    RAM. Simulation times are presented on Table 1. Even in a small example the bit streamtakes time to be generated.

    Table 1 Simulation time

    Simulation Time

    Simulink and System Generator blocks 3.19 s

    Hardware co-simulation: generation of black box 13m 42.94 s

    Hardware co-simulation 14.38 s

  • 7/30/2019 UWBR Matlab Ise

    20/20

    20

    Funded by:

    References[1] Gajski, D.D. and Kuhn, R.H., New VLSI Tools, Computer Volume 16, Issue 12, pp:

    11 14, December 1983 Release 10.1 March, 2008

    [2] Xilinx, ISE In-Depth Tutorial, 2007[3]

    Xilinx, System Generator for DSP User Guide, Release 10.1, March 2008

    [4] http://www.xilinx.com/products/boards/ml310/current/utilities/mkdosfs.zip[5] Xilinx, ML401/ML402/ML403 Evaluation Platform User Guide, May 2006