mirror of https://github.com/YosysHQ/icestorm.git
icefuzz make_xxx.py files are ready for LP384.
This commit is contained in:
parent
2ca9f929ac
commit
f8934de8d5
|
|
@ -2,6 +2,9 @@ include ../config.mk
|
|||
export LC_ALL=C
|
||||
export ICE_SBTIMER_LP=1
|
||||
|
||||
#EIGTHK = _8k
|
||||
THREEH = _384
|
||||
|
||||
TESTS =
|
||||
TESTS += binop
|
||||
TESTS += pin2pin
|
||||
|
|
@ -15,13 +18,12 @@ TESTS += gbio
|
|||
TESTS += gbio2
|
||||
TESTS += prim
|
||||
TESTS += fflogic
|
||||
TESTS += ram40
|
||||
TESTS += mem
|
||||
TESTS += pll
|
||||
TESTS += aig
|
||||
|
||||
#EIGTHK = _8k
|
||||
THREEH = _384
|
||||
ifneq ($(THREEH),_384)
|
||||
TESTS += ram40
|
||||
TESTS += mem
|
||||
TESTS += pll
|
||||
TESTS += aig
|
||||
endif
|
||||
|
||||
database: bitdata_io.txt bitdata_logic.txt bitdata_ramb$(EIGTHK).txt bitdata_ramt$(EIGTHK).txt
|
||||
ifeq ($(EIGTHK),_8k)
|
||||
|
|
|
|||
|
|
@ -37,8 +37,13 @@ def print_seq_op(dst, src1, src2, op, f):
|
|||
|
||||
for idx in range(num):
|
||||
with open("work_fflogic/fflogic_%02d.v" % idx, "w") as f:
|
||||
print("module top(input clk, rst, en, input [15:0] a, b, c, d, output [15:0] y, output z);", file=f)
|
||||
print(" reg [15:0] p, q;", file=f)
|
||||
if os.getenv('ICE384PINS'):
|
||||
print("module top(input clk, rst, en, input [1:0] a, b, c, d, output [1:0] y, output z);", file=f)
|
||||
print(" reg [1:0] p, q;", file=f)
|
||||
else:
|
||||
print("module top(input clk, rst, en, input [15:0] a, b, c, d, output [15:0] y, output z);", file=f)
|
||||
print(" reg [15:0] p, q;", file=f)
|
||||
|
||||
print_seq_op("p", "a", "b", random_op(), f)
|
||||
print_seq_op("q", "c", "d", random_op(), f)
|
||||
print(" assign y = p %s q, z = clk ^ rst ^ en;" % random_op(), file=f)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import os
|
|||
os.system("rm -rf work_gbio")
|
||||
os.mkdir("work_gbio")
|
||||
|
||||
w = 2 if os.getenv('ICE384PINS') else 8
|
||||
|
||||
for p in gpins:
|
||||
if p in pins: pins.remove(p)
|
||||
|
||||
|
|
@ -15,7 +17,7 @@ for idx in range(num):
|
|||
glbs = np.random.permutation(list(range(8)))
|
||||
print("""
|
||||
module top (
|
||||
inout [7:0] pin,
|
||||
inout [%s:0] pin,
|
||||
input latch_in,
|
||||
input clk_en,
|
||||
input clk_in,
|
||||
|
|
@ -23,9 +25,9 @@ for idx in range(num):
|
|||
input oen,
|
||||
input dout_0,
|
||||
input dout_1,
|
||||
output [7:0] din_0,
|
||||
output [7:0] din_1,
|
||||
output [7:0] globals,
|
||||
output [%s:0] din_0,
|
||||
output [%s:0] din_1,
|
||||
output [%s:0] globals,
|
||||
output reg q
|
||||
);
|
||||
SB_GB_IO #(
|
||||
|
|
@ -33,7 +35,7 @@ for idx in range(num):
|
|||
.PULLUP(1'b0),
|
||||
.NEG_TRIGGER(1'b0),
|
||||
.IO_STANDARD("SB_LVCMOS")
|
||||
) PINS [7:0] (
|
||||
) PINS [%s:0] (
|
||||
.PACKAGE_PIN(pin),
|
||||
.LATCH_INPUT_VALUE(%s),
|
||||
.CLOCK_ENABLE(%s),
|
||||
|
|
@ -54,6 +56,7 @@ for idx in range(num):
|
|||
q <= globals[%d];
|
||||
endmodule
|
||||
""" % (
|
||||
w-1, w-1, w-1, w-1, w-1,
|
||||
np.random.choice(["latch_in", "globals", "din_0+din_1", "din_0^din_1"]),
|
||||
np.random.choice(["clk_en", "globals", "din_0+din_1", "din_0^din_1"]),
|
||||
np.random.choice(["clk_in", "globals", "din_0+din_1", "din_0^din_1"]),
|
||||
|
|
@ -61,21 +64,24 @@ for idx in range(num):
|
|||
np.random.choice(["oen", "globals", "din_0+din_1", "din_0^din_1"]),
|
||||
np.random.choice(["dout_1", "globals", "globals^dout_0", "din_0+din_1", "~din_0"]),
|
||||
np.random.choice(["dout_0", "globals", "globals^dout_1", "din_0+din_1", "~din_1"]),
|
||||
np.random.choice(["din_0", "{din_0[3:0], din_0[7:4]}"]),
|
||||
np.random.choice(["din_1", "{din_1[1:0], din_1[7:2]}"]),
|
||||
np.random.choice(["globals", "{globals[0], globals[7:1]}"]),
|
||||
np.random.choice(["din_0", "{din_0[0], din_0[1]}"]) if os.getenv('ICE384PINS')
|
||||
else np.random.choice(["din_0", "{din_0[3:0], din_0[7:4]}"]) ,
|
||||
np.random.choice(["din_1", "{din_1[0], din_1[1]}"]) if os.getenv('ICE384PINS')
|
||||
else np.random.choice(["din_1", "{din_1[1:0], din_1[7:2]}"]),
|
||||
np.random.choice(["globals", "{globals[0], globals[1]}"]) if os.getenv('ICE384PINS')
|
||||
else np.random.choice(["globals", "{globals[0], globals[7:1]}"]),
|
||||
glbs[0], glbs[1], glbs[1], glbs[2], glbs[3]
|
||||
), file=f)
|
||||
with open("work_gbio/gbio_%02d.pcf" % idx, "w") as f:
|
||||
p = np.random.permutation(pins)
|
||||
g = np.random.permutation(gpins)
|
||||
for i in range(8):
|
||||
for i in range(w):
|
||||
print("set_io pin[%d] %s" % (i, g[i]), file=f)
|
||||
print("set_io din_0[%d] %s" % (i, p[8+i]), file=f)
|
||||
print("set_io din_1[%d] %s" % (i, p[2*8+i]), file=f)
|
||||
print("set_io globals[%d] %s" % (i, p[3*8+i]), file=f)
|
||||
print("set_io din_0[%d] %s" % (i, p[w+i]), file=f)
|
||||
print("set_io din_1[%d] %s" % (i, p[2*w+i]), file=f)
|
||||
print("set_io globals[%d] %s" % (i, p[3*w+i]), file=f)
|
||||
for i, n in enumerate("latch_in clk_en clk_in clk_out oen dout_0 dout_1".split()):
|
||||
print("set_io %s %s" % (n, p[4*8+i]), file=f)
|
||||
print("set_io %s %s" % (n, p[4*w+i]), file=f)
|
||||
print("set_io q %s" % (p[-1]), file=f)
|
||||
|
||||
with open("work_gbio/Makefile", "w") as f:
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import os
|
|||
os.system("rm -rf work_gbio2")
|
||||
os.mkdir("work_gbio2")
|
||||
|
||||
w = 2 if os.getenv('ICE384PINS') else 8
|
||||
|
||||
for p in gpins:
|
||||
if p in pins: pins.remove(p)
|
||||
|
||||
|
|
@ -15,7 +17,7 @@ for idx in range(num):
|
|||
glbs = np.random.permutation(list(range(8)))
|
||||
print("""
|
||||
module top (
|
||||
inout [7:0] pin,
|
||||
inout [%s:0] pin,
|
||||
input latch_in,
|
||||
input clk_en,
|
||||
input clk_in,
|
||||
|
|
@ -23,13 +25,15 @@ for idx in range(num):
|
|||
input oen,
|
||||
input dout_0,
|
||||
input dout_1,
|
||||
output [7:0] din_0,
|
||||
output [7:0] din_1,
|
||||
output [7:0] globals,
|
||||
output [%s:0] din_0,
|
||||
output [%s:0] din_1,
|
||||
output [%s:0] globals,
|
||||
output reg q
|
||||
);
|
||||
""", file=f);
|
||||
for k in range(8):
|
||||
""" % (
|
||||
w-1, w-1, w-1, w-1
|
||||
), file=f);
|
||||
for k in range(w):
|
||||
print("""
|
||||
SB_GB_IO #(
|
||||
.PIN_TYPE(6'b %s),
|
||||
|
|
@ -68,13 +72,13 @@ for idx in range(num):
|
|||
with open("work_gbio2/gbio2_%02d.pcf" % idx, "w") as f:
|
||||
p = np.random.permutation(pins)
|
||||
g = np.random.permutation(gpins)
|
||||
for i in range(8):
|
||||
for i in range(w):
|
||||
print("set_io pin[%d] %s" % (i, g[i]), file=f)
|
||||
print("set_io din_0[%d] %s" % (i, p[8+i]), file=f)
|
||||
print("set_io din_1[%d] %s" % (i, p[2*8+i]), file=f)
|
||||
print("set_io globals[%d] %s" % (i, p[3*8+i]), file=f)
|
||||
print("set_io din_0[%d] %s" % (i, p[w+i]), file=f)
|
||||
print("set_io din_1[%d] %s" % (i, p[2*w+i]), file=f)
|
||||
print("set_io globals[%d] %s" % (i, p[3*w+i]), file=f)
|
||||
for i, n in enumerate("latch_in clk_en clk_in clk_out oen dout_0 dout_1".split()):
|
||||
print("set_io %s %s" % (n, p[4*8+i]), file=f)
|
||||
print("set_io %s %s" % (n, p[4*w+i]), file=f)
|
||||
print("set_io q %s" % (p[-1]), file=f)
|
||||
|
||||
with open("work_gbio2/Makefile", "w") as f:
|
||||
|
|
|
|||
|
|
@ -7,28 +7,31 @@ import os
|
|||
os.system("rm -rf work_io")
|
||||
os.mkdir("work_io")
|
||||
|
||||
if os.getenv('ICE384PINS'): w = 2
|
||||
else: w = 4
|
||||
|
||||
for idx in range(num):
|
||||
with open("work_io/io_%02d.v" % idx, "w") as f:
|
||||
glbs = np.random.permutation(list(range(8)))
|
||||
print("""
|
||||
module top (
|
||||
inout [3:0] pin,
|
||||
input [3:0] latch_in,
|
||||
input [3:0] clk_en,
|
||||
input [3:0] clk_in,
|
||||
input [3:0] clk_out,
|
||||
input [3:0] oen,
|
||||
input [3:0] dout_0,
|
||||
input [3:0] dout_1,
|
||||
output [3:0] din_0,
|
||||
output [3:0] din_1
|
||||
inout [%s:0] pin,
|
||||
input [%s:0] latch_in,
|
||||
input [%s:0] clk_en,
|
||||
input [%s:0] clk_in,
|
||||
input [%s:0] clk_out,
|
||||
input [%s:0] oen,
|
||||
input [%s:0] dout_0,
|
||||
input [%s:0] dout_1,
|
||||
output [%s:0] din_0,
|
||||
output [%s:0] din_1
|
||||
);
|
||||
SB_IO #(
|
||||
.PIN_TYPE(6'b %s_%s),
|
||||
.PULLUP(1'b %s),
|
||||
.NEG_TRIGGER(1'b %s),
|
||||
.IO_STANDARD("SB_LVCMOS")
|
||||
) PINS [3:0] (
|
||||
) PINS [%s:0] (
|
||||
.PACKAGE_PIN(pin),
|
||||
.LATCH_INPUT_VALUE(latch_in),
|
||||
.CLOCK_ENABLE(clk_en),
|
||||
|
|
@ -42,13 +45,14 @@ for idx in range(num):
|
|||
);
|
||||
endmodule
|
||||
""" % (
|
||||
w-1, w-1, w-1, w-1, w-1, w-1, w-1, w-1, w-1, w-1,
|
||||
np.random.choice(["0000", "0110", "1010", "1110", "0101", "1001", "1101", "0100", "1000", "1100", "0111", "1111"]),
|
||||
np.random.choice(["00", "01", "10", "11"]), np.random.choice(["0", "1"]), np.random.choice(["0", "1"])
|
||||
np.random.choice(["00", "01", "10", "11"]), np.random.choice(["0", "1"]), np.random.choice(["0", "1"]), w-1
|
||||
), file=f)
|
||||
with open("work_io/io_%02d.pcf" % idx, "w") as f:
|
||||
p = list(np.random.permutation(pins))
|
||||
for k in ["pin", "latch_in", "clk_en", "clk_in", "clk_out", "oen", "dout_0", "dout_1", "din_0", "din_1"]:
|
||||
for i in range(4):
|
||||
for i in range(w):
|
||||
print("set_io %s[%d] %s" % (k, i, p.pop()), file=f)
|
||||
|
||||
with open("work_io/Makefile", "w") as f:
|
||||
|
|
|
|||
|
|
@ -12,17 +12,21 @@ def random_op():
|
|||
|
||||
for idx in range(num):
|
||||
with open("work_logic/logic_%02d.v" % idx, "w") as f:
|
||||
print("module top(input [15:0] a, b, c, d, output [15:0] y);", file=f)
|
||||
if os.getenv('ICE384PINS'):
|
||||
print("module top(input [3:0] a, b, c, d, output [3:0] y);", file=f)
|
||||
else:
|
||||
print("module top(input [15:0] a, b, c, d, output [15:0] y);", file=f)
|
||||
print(" assign y = (a %s b) %s (c %s d);" % (random_op(), random_op(), random_op()), file=f)
|
||||
print("endmodule", file=f)
|
||||
with open("work_logic/logic_%02d.pcf" % idx, "w") as f:
|
||||
p = np.random.permutation(pins)
|
||||
for i in range(16):
|
||||
r = 4 if os.getenv('ICE384PINS') else 16
|
||||
for i in range(r):
|
||||
print("set_io a[%d] %s" % (i, p[i]), file=f)
|
||||
print("set_io b[%d] %s" % (i, p[i+16]), file=f)
|
||||
print("set_io c[%d] %s" % (i, p[i+32]), file=f)
|
||||
print("set_io d[%d] %s" % (i, p[i+48]), file=f)
|
||||
print("set_io y[%d] %s" % (i, p[i+64]), file=f)
|
||||
print("set_io b[%d] %s" % (i, p[i+r]), file=f)
|
||||
print("set_io c[%d] %s" % (i, p[i+r*2]), file=f)
|
||||
print("set_io d[%d] %s" % (i, p[i+r*3]), file=f)
|
||||
print("set_io y[%d] %s" % (i, p[i+r*4]), file=f)
|
||||
|
||||
with open("work_logic/Makefile", "w") as f:
|
||||
print("all: %s" % " ".join(["logic_%02d.bin" % i for i in range(num)]), file=f)
|
||||
|
|
|
|||
|
|
@ -7,11 +7,13 @@ import os
|
|||
os.system("rm -rf work_prim")
|
||||
os.mkdir("work_prim")
|
||||
|
||||
w = 5 if os.getenv('ICE384PINS') else 24
|
||||
|
||||
for idx in range(num):
|
||||
with open("work_prim/prim_%02d.v" % idx, "w") as f:
|
||||
clkedge = np.random.choice(["pos", "neg"])
|
||||
print("module top(input clk, input [23:0] a, b, output reg x, output reg [23:0] y);", file=f)
|
||||
print(" reg [23:0] aa, bb;", file=f)
|
||||
print("module top(input clk, input [%s:0] a, b, output reg x, output reg [%s:0] y);""" % ( w-1, w-1 ), file=f)
|
||||
print(" reg [%s:0] aa, bb;""" % ( w-1 ), file=f)
|
||||
print(" always @(%sedge clk) aa <= a;" % clkedge, file=f)
|
||||
print(" always @(%sedge clk) bb <= b;" % clkedge, file=f)
|
||||
if np.random.choice([True, False]):
|
||||
|
|
@ -26,20 +28,20 @@ for idx in range(num):
|
|||
with open("work_prim/prim_%02d.pcf" % idx, "w") as f:
|
||||
p = np.random.permutation(pins)
|
||||
if np.random.choice([True, False]):
|
||||
for i in range(24):
|
||||
for i in range(w):
|
||||
print("set_io a[%d] %s" % (i, p[i]), file=f)
|
||||
if np.random.choice([True, False]):
|
||||
for i in range(24):
|
||||
print("set_io b[%d] %s" % (i, p[24+i]), file=f)
|
||||
for i in range(w):
|
||||
print("set_io b[%d] %s" % (i, p[w+i]), file=f)
|
||||
if np.random.choice([True, False]):
|
||||
for i in range(24):
|
||||
print("set_io y[%d] %s" % (i, p[2*24+i]), file=f)
|
||||
for i in range(w):
|
||||
print("set_io y[%d] %s" % (i, p[2*w+i]), file=f)
|
||||
if np.random.choice([True, False]):
|
||||
print("set_io x %s" % p[3*24], file=f)
|
||||
print("set_io x %s" % p[3*w], file=f)
|
||||
if np.random.choice([True, False]):
|
||||
print("set_io y %s" % p[3*24+1], file=f)
|
||||
print("set_io y %s" % p[3*w+1], file=f)
|
||||
if np.random.choice([True, False]):
|
||||
print("set_io clk %s" % p[3*24+2], file=f)
|
||||
print("set_io clk %s" % p[3*w+2], file=f)
|
||||
|
||||
with open("work_prim/Makefile", "w") as f:
|
||||
print("all: %s" % " ".join(["prim_%02d.bin" % i for i in range(num)]), file=f)
|
||||
|
|
|
|||
Loading…
Reference in New Issue