The structure of the .bit file is not documented, however, there are some files available to help with this task.
You can generate readback fileswhen generating your bit file. The command line file to do this is "-l" and "-g readback". The files are:
The .ll file can be used to locate the register locations in the Readback data. Here is an example .ll file entry:
Bit 5269730 0x00001c9b 194 Block=K13 Latch=I Net=CLK_?IN_?BUFGP/?IBUFG
offset = 5269730 -> Absolute offset in the readback data/?bit file when you ignore the dummy frame
Frame Address = 0x00001c9b -> Frame Address
Frame offset = 194 -> Bit offset in frame, in this case it is bit 194 out of 2275 bits. The max offset is 2274 as the index starts at bit 0.
When reading back the configuration memory, many bits are masked and values which are "0" in the bit file will read back as "1" and should be masked out when comparing the files. The MSD file can be used to determine which bits need to be masked out.
For an example of one data word, see below. You need to use the RBT, RBD, and MSD files. Remember to account for the Dummy Frame in your readback data.
RBT RBD MSD Actual Readback Data
00010000000000000000000000000000 00010000000000000000000000000000 01101101101101110110000111010000 01111101101101110110000111010000
The MSD is your mask file and will tell you which bits are 0 in the bit/rbt file, but will always read back as 1. The Configuration User Guide has some good references for comparing this data.