Skip to content

Instantly share code, notes, and snippets.

@warmonkey
Last active March 5, 2023 09:33
Show Gist options
  • Save warmonkey/b1e997d83c0feb0d9820bf58bb32119e to your computer and use it in GitHub Desktop.
Save warmonkey/b1e997d83c0feb0d9820bf58bb32119e to your computer and use it in GitHub Desktop.
Internal structure of Xilinx bitstream (.bit) file
The Xilinx .bit format is pretty simple. It uses keys and lengths to
divide the file.
Parser source code: https://gist.github.com/warmonkey/49dd574fda39f88b5eed5edc92707cf2
Here is an example. Below is a hex dump from the beginning of a .bit file:
00000000: 00 09 0f f0 0f f0 0f f0 0f f0 00 00 01 61 00 0a .............a..
00000010: 78 66 6f 72 6d 2e 6e 63 64 00 62 00 0c 76 31 30 xform.ncd.b..v10
00000020: 30 30 65 66 67 38 36 30 00 63 00 0b 32 30 30 31 00efg860.c..2001
00000030: 2f 30 38 2f 31 30 00 64 00 09 30 36 3a 35 35 3a /08/10.d..06:55:
00000040: 30 34 00 65 00 0c 28 18 ff ff ff ff aa 99 55 66 04.e..(.......Uf
Field 1
2 bytes length 0x0009 (big endian)
9 bytes some sort of header 0f f0 0f f0 0f f0 0f f0 00
Field 2
2 bytes length 0x0001 (key-length-value below)
Field 3
1 byte key 0x61 (The letter "a")
2 bytes length 0x000a (value depends on file name length)
10 bytes string design name "xform.ncd" end with \0
Field 4
1 byte key 0x62 (The letter "b")
2 bytes length 0x000c (value depends on part name length)
12 bytes string part name "v1000efg860" end with \0
Field 4
1 byte key 0x63 (The letter "c")
2 bytes length 0x000b
11 bytes string date "2001/08/10" end with \0
Field 5
1 byte key 0x64 (The letter "d")
2 bytes length 0x0009
9 bytes string time "06:55:04" end with \0
Field 6
1 byte key 0x65 (The letter "e")
4 bytes length 0x000c2818 (configuration length)
796696 bytes raw bitstream starting with ffff ffff aa99 5566 sync word
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment