Add 5k colbuf fuzzing scripts

This commit is contained in:
David Shah 2017-11-02 11:48:29 +00:00
parent e75e9171ac
commit 7e58f47639
4 changed files with 172 additions and 0 deletions

51
icefuzz/tests/colbuf_5k.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash
for f in colbuf_io_5k.work/*.exp colbuf_logic_5k.work/*.exp colbuf_ram_5k.work/*.exp; do
echo $f >&2
python3 colbuf.py $f
done | sort -u > colbuf_5k.txt
get_colbuf_data()
{
tr -d '(,)' < colbuf_5k.txt
# for x in {0..2} {4..9} {11..13}; do
# echo $x 4 $x 0
# echo $x 5 $x 8
# echo $x 12 $x 9
# echo $x 13 $x 17
# done
# for x in 3 10; do
# echo $x 3 $x 0
# echo $x 3 $x 4
# echo $x 5 $x 8
# echo $x 11 $x 9
# echo $x 11 $x 12
# echo $x 13 $x 17
# done
}
{
echo "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"1050\" width=\"1050\">"
for x in {1..33}; do
echo "<line x1=\"$((10+x*30))\" y1=\"10\" x2=\"$((10+x*30))\" y2=\"$((10+34*30))\" style=\"stroke:rgb(0,0,0);stroke-width:3\" />"
done
for y in {1..33}; do
echo "<line x1=\"10\" y1=\"$((10+y*30))\" x2=\"$((10+34*30))\" y2=\"$((10+y*30))\" style=\"stroke:rgb(0,0,0);stroke-width:3\" />"
done
for x in {0..33}; do
echo "<text x=\"$((10+$x*30+7))\" y=\"$((10+34*30+15))\" fill=\"black\">$x</text>"
done
for y in {0..33}; do
echo "<text x=\"$((10+34*30+5))\" y=\"$((10+(33-y)*30+20))\" fill=\"black\">$y</text>"
done
while read x1 y1 x2 y2; do
echo "<line x1=\"$((10+x1*30+15))\" y1=\"$((10+(33-y1)*30+15))\" x2=\"$((10+x2*30+15))\" y2=\"$((10+(33-y2)*30+15))\" style=\"stroke:rgb(255,0,0);stroke-width:5\" />"
done < <( get_colbuf_data; )
while read x1 y1 x2 y2; do
echo "<circle cx=\"$((10+x2*30+15))\" cy=\"$((10+(33-y2)*30+15))\" r=\"4\" fill=\"blue\" />"
done < <( get_colbuf_data; )
while read x1 y1 x2 y2; do
echo "<circle cx=\"$((10+x1*30+15))\" cy=\"$((10+(33-y1)*30+15))\" r=\"5\" fill=\"gray\" />"
done < <( get_colbuf_data; )
echo "</svg>"
} > colbuf_8k.svg

37
icefuzz/tests/colbuf_io_5k.sh Executable file
View File

@ -0,0 +1,37 @@
#!/bin/bash
set -ex
mkdir -p colbuf_io_5k.work
cd colbuf_io_5k.work
glb_pins="20 35 37 44"
pins="
2 3 4 6 9 10 11 12
13 18 19 20 21
25 26 27 28 31 32 34 35 36
37 38 42 43 44 45 46 47 48
"
pins="$( echo $pins )"
for pin in $pins; do
pf="colbuf_io_5k_$pin"
gpin=$( echo $glb_pins | tr ' ' '\n' | grep -v $pin | sort -R | head -n1; )
cat > ${pf}.v <<- EOT
module top (input clk, data, output pin);
SB_IO #(
.PIN_TYPE(6'b 0101_00)
) pin_obuf (
.PACKAGE_PIN(pin),
.OUTPUT_CLK(clk),
.D_OUT_0(data)
);
endmodule
EOT
echo "set_io pin $pin" > ${pf}.pcf
echo "set_io clk $gpin" >> ${pf}.pcf
ICEDEV=up5k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1
../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp
rm -rf ${pf}.tmp
done

View File

@ -0,0 +1,28 @@
#!/bin/bash
set -ex
mkdir -p colbuf_logic_5k.work
cd colbuf_logic_5k.work
glb_pins="20 35 37 44"
for x in {1..5} {7..18} {20..24}; do
for y in {1..30}; do
pf="colbuf_logic_5k_${x}_${y}"
gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; )
cat > ${pf}.v <<- EOT
module top (input c, d, output q);
SB_DFF dff (
.C(c),
.D(d),
.Q(q)
);
endmodule
EOT
echo "set_location dff $x $y 0" > ${pf}.pcf
echo "set_io c $gpin" >> ${pf}.pcf
ICEDEV=up5k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1
../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp
rm -rf ${pf}.tmp
done; done

56
icefuzz/tests/colbuf_ram_5k.sh Executable file
View File

@ -0,0 +1,56 @@
#!/bin/bash
set -ex
mkdir -p colbuf_ram_5k.work
cd colbuf_ram_5k.work
glb_pins="20 35 37 44"
for x in 6 19; do
for y in {1..30}; do
pf="colbuf_ram_5k_${x}_${y}"
gpin=$( echo $glb_pins | tr ' ' '\n' | sort -R | head -n1; )
if [ $((y % 2)) == 1 ]; then
clkport="WCLK"
other_clkport="RCLK"
else
clkport="RCLK"
other_clkport="WCLK"
fi
cat > ${pf}.v <<- EOT
module top (input c, oc, input [1:0] d, output [1:0] q);
wire gc;
SB_GB_IO #(
.PIN_TYPE(6'b 0000_00),
.PULLUP(1'b0),
.NEG_TRIGGER(1'b0),
.IO_STANDARD("SB_LVCMOS")
) gbuf (
.PACKAGE_PIN(c),
.GLOBAL_BUFFER_OUTPUT(gc)
);
SB_RAM40_4K #(
.READ_MODE(3),
.WRITE_MODE(3)
) ram40 (
.WADDR(11'b0),
.RADDR(11'b0),
.$clkport(gc),
.$other_clkport(oc),
.RDATA(q),
.WDATA(d),
.WE(1'b1),
.WCLKE(1'b1),
.RE(1'b1),
.RCLKE(1'b1)
);
endmodule
EOT
echo "set_location ram40 $x $((y - (1 - y%2))) 0" > ${pf}.pcf
echo "set_io oc 1" >> ${pf}.pcf
echo "set_io c $gpin" >> ${pf}.pcf
ICEDEV=up5k-sg48 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1
../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp
rm -rf ${pf}.tmp
done; done