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