UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor matme
Visitor
12,519 Views
Registered: ‎11-21-2011

How to generate bin files of constant size?

Jump to solution

Hi,

 

I am looking for a method to achieve a constant file size of the configuration bin file. So when i add HDL code and hit compile the output bin file should be the same over each compilation.

 

I am generating the bin file from the bit file with the Promgen tool. I use this command: "promgen -u 0x0 top.bit -p bin -w  -data_width 8".

 

I have observed that playing around with the bitgen settings and or adding logic, clock buffers etc can influence the bin file size.

The device I am using is a Spartan 6 LX25. According to UG380, Table 5-5 this device should have 6,440,432 configuration bits (= 805,054 B). The bin files I generate vary in sizes from 801,462 Bytes to 802,018 Bytes.

 

Question 1: Is it possible, using the default Xilinx tools, to get a bin file with a constant file size?

Question 2a: If yes, what settings should I use? Do I need to change the promgen/bitgen/... parameters?

Question 2b: If not, are we allowed to pad the bin file with 0xFF words for example to increase the bin file? I am thinking of increasing the file size to 805,054B as stated in UG380.

 

 

Thanks

0 Kudos
1 Solution

Accepted Solutions
Visitor matme
Visitor
21,302 Views
Registered: ‎11-21-2011

Re: How to generate bin files of constant size?

Jump to solution

Thank you for your suggestion. I am indeed using the promgen tool to have a bitswapped bin file.

 

I think I found the root cause now: I was using the 'new' bit stream format as described in AR# 39999.

 

In the UG380 we can read that
"Bitstream lengths might appear to increase after the ISE tools, version 13.2. This is due to a software change that affects designs containing 9K block RAMs. For more information on this change, refer to the Block RAM Initialization section of UG383, Spartan-6 FPGA Block RAM User Guide."

 

and in the UG383 we can read:
"The bitstream update in ISE software v13.2 results in a small increase in bitstream size that
depends on the quantity and location of the 9 Kb block RAM in the design (<1% increase)...."

 

So I guess my block RAMS have moved location between different placements, which resulted in a bitstream increase over different compilations.

 

Now I have tested switching to the 'old' bitstream as suggested in the AR# 39999 and the file size seems constant. Conversion of the 9Kb to the 18Kb also works for me.

 

Thanks for the effort!

3 Replies
Highlighted
Instructor
Instructor
12,507 Views
Registered: ‎08-14-2007

Re: How to generate bin files of constant size?

Jump to solution

1) Bit files should have a constant size unless you enable bitstream compression in the bitgen options.

 

2) You can generate a .bin file directly from bitgen without using Impact (or promgen).  This .bin file will be a pure binary file with just the configuration data - no header.  It is intended to shift out MSB first.  It is essentially the .bit file without the header.  If that's what you wanted (i.e. promgen was not doing bitswap or generating the old style ASCII binary file with an ASCII character of '0' or '1' for each bit) then your options for bitgen should look like:

 

-- Gabor
BitgenSettings.PNG
0 Kudos
Visitor matme
Visitor
21,303 Views
Registered: ‎11-21-2011

Re: How to generate bin files of constant size?

Jump to solution

Thank you for your suggestion. I am indeed using the promgen tool to have a bitswapped bin file.

 

I think I found the root cause now: I was using the 'new' bit stream format as described in AR# 39999.

 

In the UG380 we can read that
"Bitstream lengths might appear to increase after the ISE tools, version 13.2. This is due to a software change that affects designs containing 9K block RAMs. For more information on this change, refer to the Block RAM Initialization section of UG383, Spartan-6 FPGA Block RAM User Guide."

 

and in the UG383 we can read:
"The bitstream update in ISE software v13.2 results in a small increase in bitstream size that
depends on the quantity and location of the 9 Kb block RAM in the design (<1% increase)...."

 

So I guess my block RAMS have moved location between different placements, which resulted in a bitstream increase over different compilations.

 

Now I have tested switching to the 'old' bitstream as suggested in the AR# 39999 and the file size seems constant. Conversion of the 9Kb to the 18Kb also works for me.

 

Thanks for the effort!

Instructor
Instructor
12,489 Views
Registered: ‎08-14-2007

Re: How to generate bin files of constant size?

Jump to solution

I'm glad you found the problem and thanks for posting your solution!

 

I have to say that it did bother me that there was so little difference in bitstream size between your builds.  When using bitstream compression I would expect a much larger variance.

 

In answer to your other question, it is perfectly acceptable to pad the files with 0xFF at the end.  When you write it to a flash, this would be the default.  Any data past the end of the bitstream is ignored during configuration and startup.

-- Gabor
0 Kudos