New Horizons

Welcome to my blog

My name is Sven Andersson and I
work as a consultant in embedded
system design, implemented in ASIC
and FPGA.
In my spare time I write this blog
and I hope it will inspire others to
learn more about this fantastic field.
I live in Stockholm Sweden and have
my own company


You are welcome to contact me
and ask questions or make comments
about my blog.


New Horizons
What's new
Starting a blog
Writing a blog
Using an RSS reader

Zynq Design From Scratch
Started February 2014
1 Introduction
Changes and updates
2 Zynq-7000 All Programmable SoC
3 ZedBoard and other boards
4 Computer platform and VirtualBox
5 Installing Ubuntu
6 Fixing Ubuntu
7 Installing Vivado
8 Starting Vivado
9 Using Vivado
10 Lab 1. Create a Zynq project
11 Lab 1. Build a hardware platform
12 Lab 1. Create a software application
13 Lab 1. Connect to ZedBoard
14 Lab 1. Run a software application
15 Lab 1. Benchmarking ARM Cortex-A9
16 Lab 2. Adding a GPIO peripheral
17 Lab 2. Create a custom HDL module
18 Lab 2. Connect package pins and implement
19 Lab 2. Create a software application and configure the PL
20 Lab 2. Debugging a software application
21 Running Linux from SD card
22 Installing PetaLinux
23 Booting PetaLinux
24 Connect to ZedBoad via ethernet
25 Rebuilding the PetaLinux kernel image
26 Running a DHCP server on the host
27 Running a TFTP server on the host
28 PetaLinux boot via U-boot
29 PetaLinux application development
30 Fixing the host computer
31 Running NFS servers
32 VirtualBox seamless mode
33 Mounting guest file system using sshfs
34 PetaLinux. Setting up a web server
35 PetaLinux. Using cgi scripts
36 PetaLinux. Web enabled application
37 Convert from VirtualBox to VMware
38 Running Linaro Ubuntu on ZedBoard
39 Running Android on ZedBoard
40 Lab2. Booting from SD card and SPI flash
41 Lab2. PetaLinux board bringup
42 Lab2. Writing userspace IO device driver
43 Lab2. Hardware debugging
44 MicroZed quick start
45 Installing Vivado 2014.1
46 Lab3. Adding push buttons to our Zynq system
47 Lab3. Adding an interrupt service routine
48 Installing Ubuntu 14.04
49 Installing Vivado and Petalinux 2014.2
50 Using Vivado 2014.2
51 Upgrading to Ubuntu 14.04
52 Using Petalinux 2014.2
53 Booting from SD card and SPI flash
54 Booting Petalinux 2014.2 from SD card
55 Booting Petalinux 2014.2 from SPI flash
56 Installing Vivado 2014.3

Chipotle Verification System

EE Times Retrospective Series
It all started more than 40 years ago
My first job as an electrical engineer
The Memory (R)evolution
The Microprocessor (R)evolution

Four soft-core processors
Started January 2012
Table of contents
OpenRISC 1200
Nios II

Using the Spartan-6 LX9 MicroBoard
Started August 2011
Table of contents
Problems, fixes and solutions

FPGA Design From Scratch
Started December 2006
Table of contents
Acronyms and abbreviations

Actel FPGA design
Designing with an Actel FPGA. Part 1
Designing with an Actel FPGA. Part 2
Designing with an Actel FPGA. Part 3
Designing with an Actel FPGA. Part 4
Designing with an Actel FPGA. Part 5

A hardware designer's best friend
Zoo Design Platform

Installing Cobra Command Tool
A processor benchmark

Porting a Unix program to Mac OS X
Fixing a HyperTerminal in Mac OS X
A dream come true

Stockholm by bike

The New York City Marathon

Kittelfjall Lappland

Tour skating in Sweden and around the world
Wild skating
Tour day
Safety equipment
A look at the equipment you need
Skate maintenance
Books, photos, films and videos
Weather forecasts

38000 feet above see level
A trip to Spain
Florida the sunshine state

Photo Albums
Seaside Florida
Ronda Spain
Sevilla Spain
Cordoba Spain
Alhambra Spain
Kittelfjäll Lapland
Landsort Art Walk
Skating on thin ice

100 Power Tips for FPGA Designers

Adventures in ASIC
Computer History Museum
Design & Reuse
d9 Tech Blog
EDA Cafe
EDA DesignLine
Eli's tech Blog
FPGA Arcade
FPGA Central
FPGA developer
FPGA Journal
FPGA World
Lesley Shannon Courses
Mac 2 Ubuntu
Programmable Logic DesignLine
World of ASIC

If you want to be updated on this weblog Enter your email here:

rss feed

Saturday, May 05, 2007
FPGA design from scratch. Part 25
Implementing the hardware platform

After more than 5 month of hard work we have reached
the point of no return, it is time to program the FPGA. After completing hardware platform design entry, we are ready to:
  • Specify design constraints
  • Generate the bitstream (BIT) file that represents the completed hardware platform

User Constraints File

To create the BIT file for downloading and implement the design, we must first set up our User Constraints File (UCF). As in ISE, an FPGA design implemented using EDK requires a UCF. Primarily, the UCF specifies pinouts and timing constraints. It can also control a variety of other hardware implementation features, such as the configurable electrical characteristics of our  FPGA I/O signals.

Setting up our User Constraints File

To access the UCF file for our XPS project:

  1. Click the Project tab in the Project Information Area of the main window and look for the UCF file under the Project Files heading.
  2. Double-click the UCF file to open it in the System Assembly panel.

The UCF has the same base filename as the Xilinx Microprocessor Project (XMP) file, and it must reside in the data subfolder of our project directory.

Specifying Pin Constraints

We must often provide a Location (LOC) constraint to define the FPGA pin location for each external port. To view the list of the external ports, do the following:

  1. In the XPS main window, click the System Assembly tab.
  2. Select the Ports filter.

LOC constraints take the following form:

NET RS232_RX_pin LOC=U4;

Specifying Timing Constraints

For most embedded processor designs, we need only specify the input (reference) clock period to ensure that your system meets performance requirements. In some cases, our design might contain off-chip peripherals, such as memory controllers, that have particular input and output timing requirements. We should also declare Timing IGnore (TIG) constraints on signals that are not timing critical to allow better place and route tools to optimize other timing paths. The following are typical of the basic timing constraints we must provide in our UCF file:

Net sys_clk_pin PERIOD = 20000 ps;
Net sys_rst_pin TIG;

The implementation directory

The result from netlist generation is stored in the implemenation directory. All the NGC files from the synthesis runs are collected here. The bitstream generation program will include all the netlist files to generate the final bitstream. We have to make sure all netlist files can be found in the implementation directory before we start the bitstream generation. When we generated the ETC_DUAL_PORT_1024x32 memory using Coregen (
see part 4) the netlist file ETC_DUAL_PORT_1024x32.edn was created. This file will also be copied to the implementation directory.

Start bitstream generation

From the XPS Hardware menu we choose Generate Bitstream to start the bitstream generation.

Here is a printout from the startup of the program.

At Local date and time: Fri May 25 16:18:25 2007
 make -f ETC_system.make bits started...

Running Xilinx Implementation tools..


xflow -wd implementation -p xc4vfx12ff668-10 -implement xflow.opt ETC_system.ngc

Release 9.1.02i - Xflow J.30

Copyright (c) 1995-2007 Xilinx, Inc.  All rights reserved.

xflow -wd implementation -p xc4vfx12ff668-10 -implement xflow.opt ETC_system.ngc
Using Flow File: /home/svenand/root/projects/ETC/xps/implementation/fpga.flw

Using Option File(s):


Creating Script File ...


# Starting program ngdbuild

# ngdbuild -p xc4vfx12ff668-10 -nt timestamp -bm ETC_system.bmm
"/home/svenand/root/projects/ETC/xps/implementation/ETC_system.ngc" -uc
ETC_system.ucf ETC_system.ngd


Release 9.1.02i - ngdbuild J.33
Copyright (c) 1995-2007 Xilinx, Inc.  All rights reserved.

Command Line: ngdbuild -p xc4vfx12ff668-10 -nt timestamp -bm ETC_system.bmm
/home/svenand/root/projects/ETC/xps/implementation/ETC_system.ngc -uc
ETC_system.ucf ETC_system.ngd

Bitstream generation flow

The Bitstream generation uses the XFLOW program to setup and run the complete program flow. XFLOW is a command line program that automates Xilinx synthesis, implementation, and simulation flows. XFLOW reads a design file as input as well as a flow file and an option file. Xilinx provides a default set of flow files that automate which Xilinx programs are run to achieve a specific design flow. For example, a flow file can specify that NGDBuild, MAP, PAR, and TRACE are run to achieve an implementation flow for an FPGA. Here is the 
xflow log file from our bitstream generation run.
For more information about XFLOW read the
Xilinx Development System Reference Guide.

                                                                                                 (Courtesy of Xilinx)

The NGC files are processed, along with the system constraints, through Xilinx tools (NGDBuild, MAP, PAR, and TRACE) when XPS invokes the XFlow command-line program.

Script file to run XFlow

Here is the script file that are generated when we start the bitstream generation.

#!/bin/csh -f
# Script file to run the flow
# Command line for ngdbuild
ngdbuild -p xc4vfx12ff668-10 -nt timestamp -bm ETC_system.bmm "/home/svenand/root/projects/ETC/xps/implementation/ETC_system.ngc" -uc ETC_system.ucf ETC_system.ngd

# Command line for map
map -o ETC_system_map.ncd -pr b ETC_system.ngd ETC_system.pcf

# Command line for par
par -w -ol high ETC_system_map.ncd ETC_system.ncd ETC_system.pcf

# Command line for post_par_trce
trce -e 3 -xml ETC_system.twx ETC_system.ncd ETC_system.pcf

Bitstream generation result

During the bitstream generation a number of files have been generated.

 File Name
 Description Readable
ETC_system.bgn Bitgen log file
ETC_system.bit Bitstream download file
ETC_system.bld Ngdbuild log file
ETC_system.bmm Address map bram
ETC_system.drc Drc log file
ETC_system.ncd Mapping output file
ETC_system.ngc XST synthesis output file
ETC_system.ngd Xilinx native generic database format
ETC_system.pad Pin definition file (spreadsheet import file)  Yes 
Placer report file
Map report file
Trace report file (timing constraints)
Trace XML file
User constraints file (copied from data dir)
ETC_system.unroutesDisplays unrouted netsYes
Pin definition file (spreadsheet import file)
Pin definition file (text format)
Mapping report file

Configuration of the FPGA

Virtex-4 devices are configured by loading application-specific configuration data�the bitstream�into internal memory. Because Xilinx FPGA configuration memory is volatile, it must be configured each time it is powered-up. The bitstream is loaded into the device through special configuration pins. These configuration pins serve as the interface for a number of different configuration modes:
  • Master-serial configuration mode
  • Slave-serial configuration mode
  • Master SelectMAP (parallel) configuration mode
  • Slave SelectMAP (parallel) configuration mode
  • In addition, the bitstream can be loaded through the JTAG interface
Read more in the Virtex-4 Configuration Guide.

Using the Platform Cable USB

Platform Cable USB is a high-performance download cable attaching to user hardware for the purpose of programming or configuring any of the following Xilinx devices:
  • ISP Configuration PROMs
  • CPLDs
  • FPGAs
Platform Cable USB attaches to the USB port on a desktop or laptop PC with an off-the-shelf Hi-Speed USB A-B cable. It derives all operating power from the hub port controller. No external power supply is required. A sustained slave-serial FPGA configuration transfer rate of 24 Mb/s is possible in a Hi-Speed USB environment. Actual transfer rates can vary if bandwidth of the hub is being shared with other USB peripheral devices. Platform Cable USB attaches to target systems using a 14-conductor ribbon cable designed for high-bandwidth data transfers.

ML403 evaluation board

                                                                                                                         (Courtesy of Xilinx)

Read the
ML403 user guide to find out what the numbers stand for. Here are some known issues with this board. Here is all the documentation about the ML403 board.

ML403 block diagram

                                                                                                                         (Courtesy of Xilinx)
ML403 blocks and busses

                                                                                                                    (Courtesy of Xilinx)
Installing cable drivers

In the Xilinx answers database we find answer
#22648: 9.1i iMPACT - Installing Xilinx cable drivers on Linux operating system/kernel version 2.6. We will install the drivers in our Ubuntu Linux 7.04 system. To find out which version of the kernel we have installed we use the command:

==> uname -a
Linux svenand-desktop 2.6.20-15-generic #2 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Linux

When I was out on the web looking for information about installing the cable drivers I came across the following link:

XILINX JTAG tools on Linux without proprietary kernel modules

When using Xilinx JTAG software like Impact, Chipscope and XMD on Linux, the proprietary kernel module windrvr from  Jungo is needed to access the parallel- or usb-cable. As this module does not work with current linux kernel versions (> 2.6.18) a library was developed, which emulates the module in userspace and allows the tools to access the JTAG cable without the need for a proprietary kernel module.

Let's give it a try. To me it sounds like a much better solution than the one Xilinx provides. We will follow the instructions found in this README file.
  1. Install the libusb-dev package using the command: sudo apt-get install libusb-dev
  2. Download usb-driver-HEAD.tar.gz and save the file in a temp directory
  3. Goto the temp directory cd .../temp
  4. Unpack the file using the command: tar zxvf usb-driver-HEAD.tar.gz
  5. Goto the usb-driver directory: cd usb-driver
  6. Install the package build-essential (contains make) sudo apg-get install build-essential
  7. Build the library file using the command: make
  8. Copy to the /usr/lib directory: sudo cp  /usr/lib/.
  9. To use this library we have to preload it before starting impact: 
  10. export LD_PRELOAD=/usr/lib/ (sh and bash)
  11. setenv LD_PRELOAD /usr/lib/ (csh and tcsh)
Setting up the USB cable
  1. To use the device as an ordinary user, put the following line in the file /etc/udev/rules.d/50-xilinx-usb-pav.rules (or use any file name you like) ACTION=="add",BUS=="usb",SYSFS{idVendor}=="03fd",MODE="666"
  2. sudo gedit /etc/udev/rules.d/50-xilinx-usb-pav.rules and add the line above
  3. Restart udev: sudo /etc/init.d/udev restart
  4. Execute the command: lsusb
  5. Bus 002 Device 002: ID 03fd:000f Xilinx, Inc.
    Bus 002 Device 001: ID 0000:0000 
    Bus 001 Device 001: ID 0000:0000
  6. If your cable does not have the ID 03fd:0008 in the output of lsusb the initial firmware has not been loaded (loading it changes the product-ID from another value to 0008
  7. To load the firmware follow these steps:
  8. If you have no /etc/udev/rules.d/xusbdfwu.rules file, copy it from /ISE_install_dir/bin/lin/xusbdfwu.rules
  9. Install the package fxload using the command: sudo apt-get install fxload
  10. Copy the file /ISE_install_dir/bin/lin/xusbdfwu.hex to /usr/share/xusbdfwu.hex
  11. Restart udev: sudo /etc/init.d/udev restart
  12. Execute the command: lsusb
  13. Bus 002 Device 001: ID 0000:0000 
    Bus 001 Device 003: ID 0e0f:0002 
    Bus 001 Device 002: ID 03fd:0008 Xilinx, Inc.
    Bus 001 Device 001: ID 0000:0000
  14. The ID is 03fd:0008
  15. Replug the usb cable
  16. Make sure the green status light is on. The USB cable interface must be connected during  VMware Fusion Ubuntu bootup. WMware will detect the USB cable interface and automatically connect it.

Permission denied. Change owner

Can't open /dev/parport0: Permission denied

If this message is displayed in the terminal when starting iMPACT, we have to change the owner of this file from root to the current user. Like this: sudo chown svenand /dev/parport0. This has to repeated every time after we have booted the Linux OS.

Unlocking the cable interface

Use the following commands to unlock the cable interface if needed:

==>  impact -batch
  > setMode -bscan
  > cleancablelock
  > quit

iMPACT FPGA configuration tool

iMPACT allows designers to easily perform device configuration and programming either as a batch operation or through a convenient graphical user interface. iMPACT is a full featured software tool used for configuration and programming of all Xilinx PLDs (FPGAs and CPLDs) and PROMs. iMPACT features a series of design wizards that easily guide the user through each step of the configuration process.

Starting iMPACT

==> impact & (xilinx_install_dir/bin/lin/impact)

We will create a new project in iMPACT and give it a name ETC_system.icf

We will use Boundary-Scan (JTAG) to configure the FPGA.

When we click Finish the program connects to our evaluation board. Here is the printout from iMPACT:

Connecting to cable (Usb Port - USB21).
Checking cable driver.
File version of /home/svenand/cad/xilinx91i/bin/lin/xusbdfwu.hex = 1025(dec), 0x0401.
File version of /usr/share/xusbdfwu.hex = 1025(dec), 0x0401. version: 2007-05-27 00:37:02.
 Cable PID = 0008.
 Max current requested during enumeration is 280 mA.
 Cable Type = 3, Revision = 0.
 Cable Type = 0x0605.
 Setting cable speed to 6 MHz.
Cable connection established.
Firmware version = 1025.
CPLD file version = 0012h.
CPLD version = 0006h.
WARNING:iMPACT:2356 - Platform Cable USB firmware must be updated. This operation may take up to 10 minutes on a USB 2.0 port or up to 30 minutes on a USB 1.1 port.
Please do not stop the process or disconnect the cable prior to completion. The cable

STATUS LED will be RED for the duration of the update process.

Updating the cable firmware...
PROGRESS_START - Starting Operation.
Firmware update completed successfully.
PROGRESS_END - End Operation.
Elapsed time =   1943 sec.
Attempting to identify devices in the boundary-scan chain configuration...// *** BATCH CMD : Identify
PROGRESS_START - Starting Operation.
Identifying chain contents ....'1': : Manufacturer's ID =Xilinx xc95144xl, Version : 5
INFO:iMPACT:1777 -
Reading /home/svenand/cad/xilinx91i/xc9500xl/data/xc95144xl.bsd...
INFO:iMPACT:501 - '1': Added Device xc95144xl successfully.
'2': : Manufacturer's ID =Xilinx xc4vfx12, Version : 2
INFO:iMPACT:1777 -
Reading /home/svenand/cad/xilinx91i/virtex4/data/xc4vfx12.bsd...
INFO:iMPACT:501 - '1': Added Device xc4vfx12 successfully.
'3': : Manufacturer's ID =Xilinx xcf32p, Version : 15
INFO:iMPACT:1777 -
Reading /home/svenand/cad/xilinx91i/xcfp/data/xcf32p.bsd...
INFO:iMPACT:501 - '1': Added Device xcf32p successfully.
'4': : Manufacturer's ID =Xilinx xccace, Version : 0
INFO:iMPACT:1777 -
Reading /home/svenand/cad/xilinx91i/acecf/data/xccace.bsd...
INFO:iMPACT:501 - '1': Added Device xccace successfully.
PROGRESS_END - End Operation.
Elapsed time =      4 sec.
// *** BATCH CMD : identifyMPM

Congratulations! We have a working cable connection to our evaluation board. Thanks Michael, you saved our day.

Next  Previous

Posted at 11:34 by

Per Bj. BRO
October 2, 2009   05:34 PM PDT
Thank you for a very clear description. If your Xilinx board USB cable is not detected with product ID 000f, when executing 'lsusb', then you might have to copy all of the xusb*.hex files from the /Xilinx/bin/lin directory to /usr/share. This is clear if you look at the rules file. In my case, the product ID was 000d, and I needed the xusb_emb.hex file.
August 9, 2008   10:09 PM PDT
XILINX JTAG tools on Linux without proprietary kernel modules RELATED

Thanks for your precious guide. Now I can use Impact (ISE 9.2i) in OpenSuse 11.0 (X86_64)
November 17, 2007   09:33 AM PST
I have 64-bit Gentoo Linux
I compiled
When I tried to run impact I see:

LD_PRELOAD=/home/starterkit/Xilinx92i/bin/lin/ ./impact
ERROR: object '/home/starterkit/Xilinx92i/bin/lin/' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: object '/home/starterkit/Xilinx92i/bin/lin/' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: object '/home/starterkit/Xilinx92i/bin/lin/' from LD_PRELOAD cannot be preloaded: ignored.

Release 9.2i - iMPACT J.36
Copyright (c) 1995-2007 Xilinx, Inc. All rights reserved.
ERROR: object '/home/starterkit/Xilinx92i/bin/lin/' from LD_PRELOAD cannot be preloaded: ignored.

What can I do?

Leave a Comment:


Homepage (optional)


Previous Entry Home Next Entry