For applications that need to choose the order of a daisy-chain configuration "on-the-fly", or reduce the amount of memory space needed to hold mutiple daisy-chain configuration streams, some manual intervention may be applied so that each FPGA configuration need only be stored once.
A daisy-chain of six devices and multiple designs per device is demonstrated below:
Lead / Slaves...
Device1 -> Device2 -> Device3 -> Device4 -> Device5 -> Device6
Design1 Design2 Design4 Design7 Design10 Design12
Design3 Design5 Design8 Design11
To store all combinations of the above daisy-chains would result in the same designs being stored in multiple memory locations.
This solution record assumes basic knowledge of FPGA configuration and file generation. Please consult the Development System Reference Guide for information on using the BITGEN and PROMGEN utilities.
A daisy-chain configuration stream can be realized as multiple separate files on a per device basis. However, some limitations apply. The configuration file for a lead device in the chain may not be used to program a slave device, and vice-versa.
1. Create a bitstream (.bit) file for each design/device combination. The same bitstream may not be used for different device architectures.
2. Create an ASCII-HEX (.hex) file for each bitstream.
3. For all .hex files, except those intended for Lead Devices, remove the first 10 hex characters. These represent the 40-bit header of the configuration data.
4. Calculate the number of configuration bits remaining in each file. One way to accomplish this is:
bits = (Bytes_per_file - number_of_lines) x 4 bits_per_character
5. Adjust file size to match the standard "Program Data" value in the Databook plus eight. Every file will have some padding at the end of the file in the form of "F"s hex. Adding an "F" to the end of the file will increase its size by four configuration bits. Removing an "F" will decrease the number of configuration bits by four. All bit files intended for the same device must be equal in length.
Lead device files should be 40 bits larger than slave device files because of the configuration data header.
6. Calculate the LengthCount for the daisy-chain.
The LengthCount number is the total number of configuration bits for the chain of devices chosen minus seven:
LengthCount = Total Configuration bits - 7
The total number of configuration bits is the sum of configuration bits per device, where bits per device is Program Data + 8.
7. Replace original LengthCount value in all Lead configuration files with new value.
The hex files will most likely be "byte-swapped." The first five bytes must be unswapped to extract the old LengthCount number,
replace it with the new one, and re-swap the bytes before inserting them into the file. For example:
The original header may look like: FF043C89F9
Unswapping this would yield: FF203C919F
The LengthCount is the 24-bit word succeeding the preamble "FF2," which in this case would be 03C919. If our calculated
lengthcount from step 6 was 0F4099, then replacing the lengthcount and re-swapping would yield:
This would replace the first five bytes in each of the Lead device configuration files.
8. Convert the hex files to the desired format for memory storage.
The Xilinx web site contains a utility for converting hex files to prom files: