Calculate CRC in Virtex-Spartan II bitstream

Jul 25, 2006 2 Replies

Hi, I'm a student, I want calculate the CRC of a standard bitstream (Spartan II) Xilinx in C. I read xilinx's document( specially xapp176) and i'm applied the CRC algorithm at stream of 36 bit:



address register 4bit data stream 32 bit.



Example i apply the CRC algorithm at:



Write the CMD Register: RCRC



address=4 data stream=0x00000007



Write the FLR Register: D



address=11 data stream=0x0000000d



Write the COR Register: Configuration options



address=9 data stream=0xXXXXXXXX



Write the MASK Register: CTL MASK



address=6 data stream=0x00000000



Write the CMD Register: SWITCH



address=4 data stream=0x00000009



Write the FAR Register: Frame address



address=0 data stream=0x00000000



Write the CMD Register: WCFG



address=4 data stream=0x00000001


cycle of 22544 time Write the FDRI Register: DATA



address=2 data stream=0xXXXXXXXX



Write the FAR Register: Frame address



address=0 data stream=0x02000000


cycle of 910 time



Write the FDRI Register: DATA



address=2 data stream=0xXXXXXXXX



Write the FAR Register: Frame address



address=0 data stream=0x02020000


cycle of 896 time



Write the FDRI Register: DATA



address=2 data stream=0xXXXXXXXX


Now there is a write to CRC, I calculate a CRC value but is different of ISE value. I continue with other comand,i calculate the second CRR,so this is different.



I make some error?



Any idea to risolve my problems?



Thanks.



Francesco



Francesco Verdicchio schrieb:

[]

Franseso,

the bitstream CRC calculation works as described in Xilinx docs. So yes if you cant calculate it properly then you have made an error and you must resolve the problem you have.

each write to CRC register clear the CRC so it restarts again. also check that you have proper bit-order in the CRC in my algorithm I need todo 16 bit swap, but that depends on how you calculate the CRC.

Antti

formatting link

I have not gone into the details of CRC for the spartan-II but recently implemented the CRC computation for virtex-II family. Some caveats:

You must compute LSB first on these 36 bits (on virtex-II, there are 5 bits of register address, you may also want to check this).

You must be carefull that the CRC reset happens *after* CRC update by the RCRC command write (which means that after the RCRC command, the CRC register is actually zero, not the weird value computed from the CMD addr + RCRC command).

On virtex-II at least, the contiguous writes to the FDRI must update the CRC taking into account the FDRI address for each word (this is clear from the app notes).

Then, on the Virtex-II at least, a successfull CRC write/check would be:

1/ update the CRC according to the CRC reg addr + CRC write data 2/ check that the resulting CRC value is indeed zero

That is, never access the CRC register's value directly (except on CRC reset), even in the case of a CRC register write...

The autoCRC word (if such a thing exists in the spartanII) must be interpreted as a write to the CRC register (which should zero its value).

JB

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required