diff options
Diffstat (limited to 'icefuzz')
-rw-r--r-- | icefuzz/Makefile | 5 | ||||
-rw-r--r-- | icefuzz/fuzzconfig.py | 19 | ||||
-rw-r--r-- | icefuzz/icecube.sh | 56 | ||||
-rw-r--r-- | icefuzz/tests/colbuf_io_lm4k.sh | 41 | ||||
-rw-r--r-- | icefuzz/tests/colbuf_logic_lm4k.sh | 29 | ||||
-rwxr-xr-x | icefuzz/tests/colbuf_ram_lm4k.sh | 56 | ||||
-rw-r--r-- | icefuzz/tests/io_latched_lm4k.sh | 31 | ||||
-rw-r--r-- | icefuzz/tests/ioctrl_lm4k.py | 21 | ||||
-rwxr-xr-x | icefuzz/tests/ioctrl_lm4k.sh | 33 | ||||
-rwxr-xr-x | icefuzz/tests/pllauto/pllauto.py | 3 |
10 files changed, 293 insertions, 1 deletions
diff --git a/icefuzz/Makefile b/icefuzz/Makefile index a2a40b4..ea9f3e0 100644 --- a/icefuzz/Makefile +++ b/icefuzz/Makefile @@ -18,6 +18,11 @@ ifeq ($(DEVICECLASS), 5k) RAM_SUFFIX := _8k endif +ifeq ($(DEVICECLASS), 4k) + DEVICE := lm4k-cm49 + RAM_SUFFIX := _8k +endif + ifeq ($(DEVICECLASS), 8k) DEVICE := hx8k-ct256 RAM_SUFFIX = _8k diff --git a/icefuzz/fuzzconfig.py b/icefuzz/fuzzconfig.py index a50cce5..f03c815 100644 --- a/icefuzz/fuzzconfig.py +++ b/icefuzz/fuzzconfig.py @@ -60,6 +60,25 @@ elif device_class == "1k": """.split() gpins = "20 21 49 50 93 94 128 129".split() + +elif device_class == "4k": + num_ramb40 = 20 + num_iobanks = 2 + num_dsp = 0 + + # TODO(awygle) add F5 G6 F6 E6 which are constrained to (config) SPI. + pins = """ + A1 A2 A3 A4 A5 A6 A7 + B1 B2 B4 B6 B7 + C1 C3 C4 C6 C7 + D1 D2 D3 D6 D7 + E1 E2 E3 E4 E5 E7 + F2 F3 F4 F7 + G3 + """.split() + + gpins = "A3 A4 D2 E2 E5 G3".split() + elif device_class == "5k": num_ramb40 = 30 num_iobanks = 2 diff --git a/icefuzz/icecube.sh b/icefuzz/icecube.sh index 5a1a7f2..832c15e 100644 --- a/icefuzz/icecube.sh +++ b/icefuzz/icecube.sh @@ -56,6 +56,11 @@ if [ "$1" == "-up5k" ]; then shift fi +if [ "$1" == "-lm4k" ]; then + ICEDEV=lm4k-cm49 + shift +fi + set -ex set -- ${1%.v} icecubedir="${ICECUBEDIR:-/opt/lscc/iCEcube2.2015.08}" @@ -187,6 +192,42 @@ case "${ICEDEV:-hx1k-tq144}" in iCEPACKAGE="UWG30" iCE40DEV="iCE40UP5K" ;; + lm4k-cm49) + iCEPACKAGE="CM49" + iCE40DEV="iCE40LM4K" + ;; + lm4k-cm36) + iCEPACKAGE="CM36" + iCE40DEV="iCE40LM4K" + ;; + lm4k-swg25tr) + iCEPACKAGE="SWG25TR" + iCE40DEV="iCE40LM4K" + ;; + lm2k-cm49) + iCEPACKAGE="CM49" + iCE40DEV="iCE40LM2K" + ;; + lm2k-cm36) + iCEPACKAGE="CM36" + iCE40DEV="iCE40LM2K" + ;; + lm2k-swg25tr) + iCEPACKAGE="SWG25TR" + iCE40DEV="iCE40LM2K" + ;; + lm1k-cm49) + iCEPACKAGE="CM49" + iCE40DEV="iCE40LM1K" + ;; + lm1k-cm36) + iCEPACKAGE="CM36" + iCE40DEV="iCE40LM1K" + ;; + lm1k-swg25tr) + iCEPACKAGE="SWG25TR" + iCE40DEV="iCE40LM1K" + ;; *) echo "ERROR: Invalid \$ICEDEV device config '$ICEDEV'." exit 1 @@ -238,6 +279,21 @@ case "$iCE40DEV" in libfile="ice40UP5K.lib" devfile="ICE40T05.dev" ;; + iCE40LM1K) + icetech="SBTiCE40LM" + libfile="ice40LM4K.lib" + devfile="ICE40R04.dev" + ;; + iCE40LM2K) + icetech="SBTiCE40LM" + libfile="ice40LM4K.lib" + devfile="ICE40R04.dev" + ;; + iCE40LM4K) + icetech="SBTiCE40LM" + libfile="ice40LM4K.lib" + devfile="ICE40R04.dev" + ;; esac ( diff --git a/icefuzz/tests/colbuf_io_lm4k.sh b/icefuzz/tests/colbuf_io_lm4k.sh new file mode 100644 index 0000000..80d2f64 --- /dev/null +++ b/icefuzz/tests/colbuf_io_lm4k.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +set -ex + +mkdir -p colbuf_io_lm4k.work +cd colbuf_io_lm4k.work + +glb_pins="A3 A4 D2 E2 E5 G3" + +pins=" + A1 A2 A3 A4 A5 A6 A7 + B1 B2 B4 B6 B7 + C1 C3 C4 C6 C7 + D1 D2 D3 D6 D7 + E1 E2 E3 E4 E5 E7 + F2 F3 F4 F7 + G3 +" +pins="$( echo $pins )" + +for pin in $pins; do + pf="colbuf_io_lm4k_$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=lm4k-cm49 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 + ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp + rm -rf ${pf}.tmp +done + diff --git a/icefuzz/tests/colbuf_logic_lm4k.sh b/icefuzz/tests/colbuf_logic_lm4k.sh new file mode 100644 index 0000000..d1dc681 --- /dev/null +++ b/icefuzz/tests/colbuf_logic_lm4k.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +set -ex + +mkdir -p colbuf_logic_lm4k.work +cd colbuf_logic_lm4k.work + +glb_pins="A3 A4 D2 E2 E5 G3" + +for y in {1..32}; do +for y in {1..20}; do + pf="colbuf_logic_lm4k_${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=lm4k-cm49 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 + ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp + rm -rf ${pf}.tmp +done; done + diff --git a/icefuzz/tests/colbuf_ram_lm4k.sh b/icefuzz/tests/colbuf_ram_lm4k.sh new file mode 100755 index 0000000..86fb08a --- /dev/null +++ b/icefuzz/tests/colbuf_ram_lm4k.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +set -ex + +mkdir -p colbuf_ram_lm4k.work +cd colbuf_ram_lm4k.work + +glb_pins="A3 A4 D2 E2 E5 G3" + +for x in 6 19; do +for y in {1..20}; do + pf="colbuf_ram_lm4k_${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=lm4k-cm49 bash ../../icecube.sh ${pf}.v > ${pf}.log 2>&1 + ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp + rm -rf ${pf}.tmp +done; done diff --git a/icefuzz/tests/io_latched_lm4k.sh b/icefuzz/tests/io_latched_lm4k.sh new file mode 100644 index 0000000..5e6b63c --- /dev/null +++ b/icefuzz/tests/io_latched_lm4k.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -ex + +mkdir -p io_latched_lm4k.work +cd io_latched_lm4k.work + +pins=" + A1 A2 A3 A4 A5 A6 A7 + B1 B2 B4 B6 B7 + C1 C3 C4 C6 C7 + D1 D2 D3 D6 D7 + E1 E2 E3 E4 E5 E7 + F2 F3 F4 F7 + G3 +" +pins="$( echo $pins )" + +for pin in $pins; do + pf="io_latched_$pin" + cp ../io_latched.v ${pf}.v + read pin_latch pin_data < <( echo $pins | tr ' ' '\n' | grep -v $pin | sort -R; ) + { + echo "set_io pin $pin" + echo "set_io latch_in $pin_latch" + echo "set_io data_out $pin_data" + } > ${pf}.pcf + ICEDEV=lm4k-cm49 bash ../../icecube.sh ${pf}.v + ../../../icebox/icebox_vlog.py -SP ${pf}.psb ${pf}.asc > ${pf}.ve +done + diff --git a/icefuzz/tests/ioctrl_lm4k.py b/icefuzz/tests/ioctrl_lm4k.py new file mode 100644 index 0000000..67c0c6d --- /dev/null +++ b/icefuzz/tests/ioctrl_lm4k.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 + +import fileinput + +for line in fileinput.input(): + line = line.split() + if len(line) == 0: + continue + if line[0] == ".io_tile": + current_tile = (int(line[1]), int(line[2])) + if line[0] == "IoCtrl" and line[1] == "REN_0": + ren = (current_tile[0], current_tile[1], 0) + if line[0] == "IoCtrl" and line[1] == "REN_1": + ren = (current_tile[0], current_tile[1], 1) + if line[0] == "IOB_0": + iob = (current_tile[0], current_tile[1], 0) + if line[0] == "IOB_1": + iob = (current_tile[0], current_tile[1], 1) + +print("(%2d, %2d, %2d, %2d, %2d, %2d)," % (iob[0], iob[1], iob[2], ren[0], ren[1], ren[2])) + diff --git a/icefuzz/tests/ioctrl_lm4k.sh b/icefuzz/tests/ioctrl_lm4k.sh new file mode 100755 index 0000000..9722038 --- /dev/null +++ b/icefuzz/tests/ioctrl_lm4k.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -ex + +mkdir -p ioctrl.work +cd ioctrl.work + +pins=" + A1 A2 A3 A4 A5 A6 A7 + B1 B2 B4 B6 B7 + C1 C3 C4 C6 C7 + D1 D2 D3 D6 D7 + E1 E2 E3 E4 E5 E6 E7 + F2 F3 F4 F5 F6 F7 + G3 G6 +" + +pins="$( echo $pins )" + +for pin in $pins; do + pf="ioctrl_$pin" + echo "module top (output pin); assign pin = 1; endmodule" > ${pf}.v + echo "set_io pin $pin" > ${pf}.pcf + bash ../../icecube.sh -lm4k ${pf}.v > ${pf}.log 2>&1 + ../../../icebox/icebox_explain.py ${pf}.asc > ${pf}.exp +done + +set +x +echo "--snip--" +for pin in $pins; do + python3 ../ioctrl_5k.py ioctrl_${pin}.exp +done | tee ioctrl_db.txt +echo "--snap--" diff --git a/icefuzz/tests/pllauto/pllauto.py b/icefuzz/tests/pllauto/pllauto.py index 647be29..517417d 100755 --- a/icefuzz/tests/pllauto/pllauto.py +++ b/icefuzz/tests/pllauto/pllauto.py @@ -209,7 +209,8 @@ device = "up5k" #TODO: environment variable? #and look for the stuck bit) #TODO: clever code could get rid of this divq_bit0 = { - "up5k" : (11, 31, 3) + "up5k" : (11, 31, 3), + "lm4k" : (11, 0, 3) } #Return a list of PLL config bits in the format (x, y, bit) |