| 1 |
#!/usr/bin/perl |
| 2 |
# |
| 3 |
# Generate a list of rotation vectors so we always use the same set. |
| 4 |
# This needs to be run on a platform with /dev/urandom. |
| 5 |
# |
| 6 |
|
| 7 |
($n) = @ARGV; |
| 8 |
|
| 9 |
sysopen(UR, '/dev/urandom', O_RDONLY) or die; |
| 10 |
|
| 11 |
$maxlen = 78; |
| 12 |
|
| 13 |
print "\@random_sv_vectors = (\n"; |
| 14 |
$outl = ' '; |
| 15 |
|
| 16 |
for ($i = 0; $i < $n; $i++) { |
| 17 |
|
| 18 |
die if (sysread(UR, $x8, 8) != 8); |
| 19 |
@n = unpack("V*", $x8); |
| 20 |
|
| 21 |
$xl = sprintf(" [0x%08x, 0x%08x]%s", |
| 22 |
$n[0], $n[1], |
| 23 |
($i == $n-1) ? '' : ','); |
| 24 |
if (length($outl.$xl) > $maxlen) { |
| 25 |
print $outl, "\n"; |
| 26 |
$outl = ' '; |
| 27 |
} |
| 28 |
$outl .= $xl; |
| 29 |
} |
| 30 |
close(UR); |
| 31 |
|
| 32 |
print $outl, "\n"; |
| 33 |
print ");\n"; |
| 34 |
print "1;\n"; |