~ruther/yosys-sim-testing

ref: 74fa352c9d0aa60c75c7cce0e09cadd345a44e44 yosys-sim-testing/projects/counter/Makefile -rw-r--r-- 1.7 KiB
74fa352c — Rutherther Initial commit a month ago
                                                                                
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
YOSYS?=yosys
NEXTPNR?=nextpnr-ice40
NEXTPNR_ARGS=--hx1k --package tq144
CELLS?=`yosys-config --datdir/ice40/cells_sim.v`

VLOG?=vlog
VCOM?=vcom
VSIM?=vsim

TOP?=counter

.PHONY: logs
logs: out/counter-pre-synth.log out/counter-post-synth.log out/counter-post-pnr.log

out/counter-synth.json: src/counter.vhd
	$(YOSYS) -p "ghdl $^ -e counter; hierarchy -check -top counter; proc; synth_ice40; write_json $@"
out/counter-synth.v: out/counter-synth.json
	$(YOSYS) -p "read_json $<; write_verilog $@"

out/counter-pnr.asc: out/counter-synth.json
	$(NEXTPNR) $(NEXTPNR_ARGS) --top counter --json $< --pcf counter.pcf --asc $@

out/counter-pnr.json: out/counter-synth.json
	$(NEXTPNR) $(NEXTPNR_ARGS) --top counter --json $< --pcf counter.pcf --write $@

out/counter-pnr.v: out/counter-pnr.json
	$(YOSYS) -p "read_json $<; write_verilog $@"
	sed -i 's/module top/module counter/' $@

out/counter-pnr.sdf: out/counter-synth.json
	$(NEXTPNR) $(NEXTPNR_ARGS) --top counter --json $< --pcf counter.pcf --sdf $@

out/counter-pre-synth.log: src/counter.vhd tb/counter_tb.vhd
	rm -rf work transcript
	$(VCOM) -2008 $^
	$(VSIM) counter_tb -batch -do 'run -all; quit' -logfile $@
	rm -rf work transcript

out/counter-post-synth.log: out/counter-synth.v tb/counter_tb.vhd
	rm -rf work transcript
	$(VLOG) -sv $< $(CELLS)
	$(VCOM) -2008 tb/counter_tb.vhd
	$(VSIM) counter_tb -t 1ps -batch -do 'run -all; quit' -logfile $@
	rm -rf work transcript

out/counter-post-pnr.log: out/counter-pnr.v out/counter-pnr.sdf
	rm -rf work transcript
	$(VLOG) -sv $< $(CELLS)
	$(VCOM) -2008 tb/counter_tb.vhd
	$(VSIM) counter_tb -t 1ps -batch -do 'run -all; quit' -logfile $@ -sdfmax dut/=out/counter-pnr.sdf -suppress 3250,12090,12088
Do not follow this link