]> cvs.zerfleddert.de Git - proxmark3-svn/blame - tools/rbt2c.pl
documented tag IDs for the 3 new EM4102 traces
[proxmark3-svn] / tools / rbt2c.pl
CommitLineData
30f2a7d3 1#!/usr/bin/perl\r
2\r
3# This tool converts a Xilinx xxx.rbt FPGA bitstream to a table that will\r
4# compile as C source code. The output format is DWORDs, MSB first.\r
5\r
6print "// Generated by rbt2c.pl, do not edit!\n\n";\r
7\r
8for(1..7) {\r
9 chomp($_ = <>);\r
10 print "//// $_\n";\r
11}\r
12\r
13print <<EOT;\r
14\r
15#include <proxmark3.h>\r
16\r
17const DWORD FpgaImage[] = {\r
18EOT\r
19\r
20while(<>) {\r
21 chomp;\r
22 $v = 0;\r
23 for $b (split(//, $_)) {\r
24 $v <<= 1;\r
25 if($b eq '1') {\r
26 $v |= 1;\r
27 } elsif($b ne '0') {\r
28 die;\r
29 }\r
30 }\r
31 printf("\t0x%08x,\n", $v);\r
32}\r
33\r
34print <<EOT;\r
35};\r
36\r
37const DWORD FpgaImageLen = sizeof(FpgaImage) / sizeof(FpgaImage[0]);\r
38\r
39EOT\r
Impressum, Datenschutz