arm_adi_v5: fix and update sequences to spec IHI 0031E
[openocd.git] / src / helper / update_jep106.pl
blobcaec0664f23b4a85fbb4e4e050de5de3cf459b00
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use File::Basename;
6 if (@ARGV != 1) {
7 die "Usage: $0 <JEP106 PDF document>\n\n"
8 . "Convert the JEDEC document containing manufacturer identification codes\n"
9 . "to an array initializer suitable for incusion into jep106.c. The latest\n"
10 . "version of the document can be found here:\n"
11 . "http://www.jedec.org/standards-documents/results/jep106\n";
14 my $outfile = dirname($0) . "/jep106.inc";
16 open(my $out, ">", $outfile) || die "Cannot open $outfile: $!\n";
17 open(my $pdftotext, "pdftotext -layout $ARGV[0] - |") || die "Cannot fork: $!\n";
19 print $out "/* Autogenerated with " . basename($0) . "*/\n";
21 my $bank = -1;
23 while (<$pdftotext>) {
24 if (/^[0-9]+[[:space:]]+(.*?)[[:space:]]+([01][[:space:]]+){8}([0-9A-F]{2})$/) {
25 if ($3 eq "01") {
26 $bank++
28 my $id=sprintf("0x%02x",hex($3)&0x7f);
29 print $out "[$bank][$id - 1] = \"$1\",\n";
33 close $pdftotext || die "Error: $! $?\n";
35 print $out "/* EOF */\n";