aboutsummaryrefslogtreecommitdiffstats
path: root/icefuzz
diff options
context:
space:
mode:
authorAndrew Wygle <awygle@gmail.com>2018-05-07 21:45:05 -0700
committerAndrew Wygle <awygle@gmail.com>2018-05-12 21:47:09 -0700
commitda18da271b79e13f0e9bdb43edf82433fd497df4 (patch)
treee432d82f8de444f3b4240cb0447291885e5b203c /icefuzz
parente4d502e76ce3ec6cb659368c00111afdb5b6b4e0 (diff)
downloadicestorm-da18da271b79e13f0e9bdb43edf82433fd497df4.tar.gz
icestorm-da18da271b79e13f0e9bdb43edf82433fd497df4.tar.bz2
icestorm-da18da271b79e13f0e9bdb43edf82433fd497df4.zip
[WIP] Add partial icebox support for lm4k.
Diffstat (limited to 'icefuzz')
-rw-r--r--icefuzz/tests/colbuf_io_lm4k.sh41
-rw-r--r--icefuzz/tests/colbuf_logic_lm4k.sh29
-rwxr-xr-xicefuzz/tests/colbuf_ram_lm4k.sh56
-rw-r--r--icefuzz/tests/io_latched_lm4k.sh31
-rw-r--r--icefuzz/tests/ioctrl_lm4k.py21
-rwxr-xr-xicefuzz/tests/ioctrl_lm4k.sh33
-rwxr-xr-xicefuzz/tests/pllauto/pllauto.py3
7 files changed, 213 insertions, 1 deletions
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..aaeb4d4
--- /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 E7
+ F2 F3 F4 F7
+ G3
+"
+
+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)