aboutsummaryrefslogtreecommitdiffstats
path: root/icefuzz/Makefile
blob: ca1c58324cd90f3575be24b73934f6c11f016fbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
include ../config.mk
export LC_ALL=C
export ICE_SBTIMER_LP=1

#EIGTHK = _8k
THREEH = _384

TESTS =
TESTS += binop
TESTS += pin2pin
TESTS += mesh
TESTS += fanout
TESTS += logic
TESTS += cluster
TESTS += iopack
TESTS += io
TESTS += gbio
TESTS += gbio2
TESTS += prim
TESTS += fflogic
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)
	cp cached_ramb.txt bitdata_ramb.txt
	cp cached_ramt.txt bitdata_ramt.txt
else
	cp cached_ramb_8k.txt bitdata_ramb_8k.txt
	cp cached_ramt_8k.txt bitdata_ramt_8k.txt
endif
	python3 database.py
	python3 export.py
	diff -U0 cached_io.txt bitdata_io.txt || cp -v bitdata_io.txt cached_io.txt
	diff -U0 cached_logic.txt bitdata_logic.txt || cp -v bitdata_logic.txt cached_logic.txt
	diff -U0 cached_ramb.txt bitdata_ramb.txt || cp -v bitdata_ramb.txt cached_ramb.txt
	diff -U0 cached_ramt.txt bitdata_ramt.txt || cp -v bitdata_ramt.txt cached_ramt.txt
	diff -U0 cached_ramb_8k.txt bitdata_ramb_8k.txt || cp -v bitdata_ramb_8k.txt cached_ramb_8k.txt
	diff -U0 cached_ramt_8k.txt bitdata_ramt_8k.txt || cp -v bitdata_ramt_8k.txt cached_ramt_8k.txt

timings:
ifeq ($(EIGTHK),_8k)
	cp tmedges.txt tmedges.tmp
	set -e; for f in work_*/*.vsb; do echo $$f; yosys -q -f verilog -s tmedges.ys $$f; done
	sort -u tmedges.tmp > tmedges.txt && rm -f tmedges.tmp
	python3 timings.py -t timings_hx8k.txt work_*/*.sdf > timings_hx8k.new
	mv timings_hx8k.new timings_hx8k.txt
	python3 timings.py -t timings_lp8k.txt work_*/*.slp > timings_lp8k.new
	mv timings_lp8k.new timings_lp8k.txt
else
 ifeq ($(THREEH),_384)
	cp tmedges.txt tmedges.tmp
	set -e; for f in work_*/*.vsb; do echo $$f; yosys -q -f verilog -s tmedges.ys $$f; done
	sort -u tmedges.tmp > tmedges.txt && rm -f tmedges.tmp
	python3 timings.py -t timings_lp384.txt work_*/*.slp > timings_lp384.new
	mv timings_lp384.new timings_lp384.txt
 else
	cp tmedges.txt tmedges.tmp
	set -e; for f in work_*/*.vsb; do echo $$f; yosys -q -f verilog -s tmedges.ys $$f; done
	sort -u tmedges.tmp > tmedges.txt && rm -f tmedges.tmp
	python3 timings.py -t timings_hx1k.txt work_*/*.sdf > timings_hx1k.new
	mv timings_hx1k.new timings_hx1k.txt
	python3 timings.py -t timings_lp1k.txt work_*/*.slp > timings_lp1k.new
	mv timings_lp1k.new timings_lp1k.txt
 endif
endif

timings_html:
	python3 timings.py -h tmedges.txt -t timings_hx1k.txt -l "HX1K with default temp/volt settings" > timings_hx1k.html
	python3 timings.py -h tmedges.txt -t timings_hx8k.txt -l "HX8K with default temp/volt settings" > timings_hx8k.html
	python3 timings.py -h tmedges.txt -t timings_lp1k.txt -l "LP1K with default temp/volt settings" > timings_lp1k.html
	python3 timings.py -h tmedges.txt -t timings_lp8k.txt -l "LP8K with default temp/volt settings" > timings_lp8k.html
	python3 timings.py -h tmedges.txt -t timings_lp384.txt -l "LP384 with default temp/volt settings" > timings_lp384.html

data_cached.txt: cached_io.txt cached_logic.txt cached_ramb$(EIGTHK).txt cached_ramt$(EIGTHK).txt
	gawk '{ print "io", $$0; }' cached_io.txt > data_cached.new
	gawk '{ print "logic", $$0; }' cached_logic.txt >> data_cached.new
	gawk '{ print "ramb$(EIGTHK)", $$0; }' cached_ramb$(EIGTHK).txt >> data_cached.new
	gawk '{ print "ramt$(EIGTHK)", $$0; }' cached_ramt$(EIGTHK).txt >> data_cached.new
	mv data_cached.new data_cached.txt

bitdata_io.txt: data_cached.txt $(addprefix data_,$(addsuffix .txt,$(TESTS)))
	grep ^io $^ | tr -s ' ' | tr -d '\r' | cut -f2- -d' ' | sort -u > $@

bitdata_logic.txt: data_cached.txt $(addprefix data_,$(addsuffix .txt,$(TESTS)))
	grep ^logic $^ | tr -s ' ' | tr -d '\r' | cut -f2- -d' ' | sort -u > $@

bitdata_ramb$(EIGTHK).txt: data_cached.txt $(addprefix data_,$(addsuffix .txt,$(TESTS)))
	grep ^ramb$(EIGTHK) $^ | tr -s ' ' | tr -d '\r' | cut -f2- -d' ' | sort -u > $@

bitdata_ramt$(EIGTHK).txt: data_cached.txt $(addprefix data_,$(addsuffix .txt,$(TESTS)))
	grep ^ramt$(EIGTHK) $^ | tr -s ' ' | tr -d '\r' | cut -f2- -d' ' | sort -u > $@

datafiles: $(addprefix data_,$(addsuffix .txt,$(TESTS)))

../icepack/icepack:
	$(MAKE) -C ../icepack

define data_template
data_$(1).txt: make_$(1).py ../icepack/icepack
ifeq ($(EIGTHK),_8k)
	ICE8KPINS=1 python3 make_$(1).py
	+ICEDEV=hx8k-ct256 $(MAKE) -C work_$(1)
	python3 extract.py -8 work_$(1)/*.glb > $$@
else
 ifeq ($(THREEH),_384)
	ICE384PINS=1 python3 make_$(1).py
	+ICEDEV=lp384-cm49 $(MAKE) -C work_$(1)
	python3 extract.py -3 work_$(1)/*.glb > $$@
 else
	python3 make_$(1).py
	+$(MAKE) -C work_$(1)
	python3 extract.py work_$(1)/*.glb > $$@
 endif
endif
endef

$(foreach test,$(TESTS),$(eval $(call data_template,$(test))))

%.ok: %.bin
	bash check.sh $<

check: $(addsuffix .ok,$(basename $(wildcard work_binop/*.bin)))
check: $(addsuffix .ok,$(basename $(wildcard work_pin2pin/*.bin)))
check: $(addsuffix .ok,$(basename $(wildcard work_mesh/*.bin)))
check: $(addsuffix .ok,$(basename $(wildcard work_fanout/*.bin)))
check: $(addsuffix .ok,$(basename $(wildcard work_logic/*.bin)))
check: $(addsuffix .ok,$(basename $(wildcard work_cluster/*.bin)))
check: $(addsuffix .ok,$(basename $(wildcard work_iopack/*.bin)))
check: $(addsuffix .ok,$(basename $(wildcard work_pll/*.bin)))

clean:
	rm -rf work_*
	rm -rf data_*.txt
	rm -rf bitdata_*.txt
	rm -rf database_*.txt
	rm -rf timings_*.html

.PHONY: database datafiles check clean