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