
default: top.v inouts.pcf
	yosys -q -p "synth_ice40 -blif i2c_kbd_alt.blif" top.v i2c_slave.v matrix_kbd.v ram.v simple_filter.v uart.v descriptors.v
	arachne-pnr -d 1k -P tq144 -p inouts.pcf i2c_kbd_alt.blif -o i2c_kbd_alt.asc
#	yosys -p "synth_ice40 -json i2_kbd_alt.json" top.v i2c_slave.v matrix_kbd.v ram.v simple_filter.v uart.v descriptors.v
#	nextpnr-ice40 --hx1k --json i2_kbd_alt.json --pcf inouts.pcf --asc i2c_kbd_alt.asc
	icebox_explain i2c_kbd_alt.asc > i2c_kbd_alt.ex
	icepack i2c_kbd_alt.asc i2c_kbd_alt.bin

nextpnr: top.v inouts.pcf
#	yosys -q -p "synth_ice40 -blif i2c_kbd_alt.blif" top.v i2c_slave.v matrix_kbd.v ram.v simple_filter.v uart.v descriptors.v
#	arachne-pnr -p inouts.pcf i2c_kbd_alt.blif -o i2c_kbd_alt.asc
	yosys -p "synth_ice40 -json i2_kbd_alt.json" top.v i2c_slave.v matrix_kbd.v ram.v simple_filter.v uart.v descriptors.v
	nextpnr-ice40 --hx1k --json i2_kbd_alt.json --pcf inouts.pcf --asc i2c_kbd_alt.asc
	icebox_explain i2c_kbd_alt.asc > i2c_kbd_alt.ex
	icepack i2c_kbd_alt.asc i2c_kbd_alt.bin

burn:
	iceprog -d i:0x0403:0x6010 i2c_kbd_alt.bin

burn0:
	iceprog -d i:0x0403:0x6010:0 i2c_kbd_alt.bin

burn1:
	iceprog -d i:0x0403:0x6010:1 i2c_kbd_alt.bin

clean:
	rm -f i2c_kbd_alt.blif i2c_kbd_alt.asc i2c_kbd_alt.ex i2c_kbd_alt.bin i2_kbd_alt.json

time:
	icetime -tmd hx1k i2c_kbd_alt.asc
