1351278Sdim
2351278Sdim#------------------------------------------------------------------------------
3351278Sdim# $File: xilinx,v 1.7 2014/04/30 21:41:02 christos Exp $
4351278Sdim# This is Aaron's attempt at a MAGIC file for Xilinx .bit files.
5351278Sdim# Xilinx-Magic@RevRagnarok.com
6351278Sdim# Got the info from FPGA-FAQ 0026
7351278Sdim#
8351278Sdim# Rewritten to use pstring/H instead of hardcoded lengths by O. Freyermuth, 
9351278Sdim# fixes at least reading of bitfiles from Spartan 2, 3, 6. 
10351278Sdim# http://www.fpga-faq.com/FAQ_Pages/0026_Tell_me_about_bit_files.htm
11351278Sdim#
12351278Sdim# First there is the sync header and its length
13351278Sdim0	beshort 0x0009
14351278Sdim>2 	belong	=0x0ff00ff0
15351278Sdim>>&0	belong  =0x0ff00ff0
16351278Sdim>>>&0	byte    =0x00
17351278Sdim>>>&1   beshort =0x0001
18351278Sdim>>>&3	string	a	Xilinx BIT data
19351278Sdim# Next is a Pascal-style string with the NCD name. We want to capture that.
20351278Sdim>>>>&0	   pstring/H	x	- from %s
21351278Sdim# And then 'b'
22351278Sdim>>>>>&1    string b
23351278Sdim# Then the model / part number: 
24351278Sdim>>>>>>&0   pstring/H    x       - for %s
25351278Sdim# Then 'c'
26351278Sdim>>>>>>>&1 string c
27351278Sdim# Then the build-date
28351278Sdim>>>>>>>>&0 pstring/H    x       - built %s
29351278Sdim# Then 'd'
30351278Sdim>>>>>>>>>&1   string d
31351278Sdim# Then the build-time
32351278Sdim>>>>>>>>>>&0  pstring/H x        \b(%s)
33351278Sdim# Then 'e'
34351278Sdim>>>>>>>>>>>&1  string e
35351278Sdim# And length of data
36351278Sdim>>>>>>>>>>>>&0 belong x          - data length 0x%x
37351278Sdim
38351278Sdim# Raw bitstream files
39351278Sdim0      long    0xffffffff      
40351278Sdim>&0    belong  0xaa995566      Xilinx RAW bitstream (.BIN)
41351278Sdim