2017-07-29 22:01:39 +08:00
|
|
|
|
2017-08-07 21:13:27 +08:00
|
|
|
# ---- iCE40 HX8K Breakout Board ----
|
|
|
|
|
2018-10-01 20:00:21 +08:00
|
|
|
hx8ksim: hx8kdemo_tb.vvp hx8kdemo_fw.hex
|
|
|
|
vvp -N $< +firmware=hx8kdemo_fw.hex
|
2017-08-08 04:36:58 +08:00
|
|
|
|
2018-10-01 20:00:21 +08:00
|
|
|
hx8ksynsim: hx8kdemo_syn_tb.vvp hx8kdemo_fw.hex
|
2019-02-12 06:13:05 +08:00
|
|
|
vvp -N $< +firmware=hx8kdemo_fw.hex
|
2017-08-08 04:36:58 +08:00
|
|
|
|
2017-08-12 01:30:53 +08:00
|
|
|
hx8kdemo.blif: hx8kdemo.v spimemio.v simpleuart.v picosoc.v ../picorv32.v
|
2017-08-07 21:13:27 +08:00
|
|
|
yosys -ql hx8kdemo.log -p 'synth_ice40 -top hx8kdemo -blif hx8kdemo.blif' $^
|
|
|
|
|
2017-08-12 01:30:53 +08:00
|
|
|
hx8kdemo_tb.vvp: hx8kdemo_tb.v hx8kdemo.v spimemio.v simpleuart.v picosoc.v ../picorv32.v spiflash.v
|
2017-11-12 02:49:01 +08:00
|
|
|
iverilog -s testbench -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v`
|
2017-08-08 04:36:58 +08:00
|
|
|
|
|
|
|
hx8kdemo_syn_tb.vvp: hx8kdemo_tb.v hx8kdemo_syn.v spiflash.v
|
|
|
|
iverilog -s testbench -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v`
|
|
|
|
|
|
|
|
hx8kdemo_syn.v: hx8kdemo.blif
|
|
|
|
yosys -p 'read_blif -wideports hx8kdemo.blif; write_verilog hx8kdemo_syn.v'
|
|
|
|
|
2017-08-07 21:13:27 +08:00
|
|
|
hx8kdemo.asc: hx8kdemo.pcf hx8kdemo.blif
|
|
|
|
arachne-pnr -d 8k -o hx8kdemo.asc -p hx8kdemo.pcf hx8kdemo.blif
|
|
|
|
|
|
|
|
hx8kdemo.bin: hx8kdemo.asc
|
|
|
|
icetime -d hx8k -c 12 -mtr hx8kdemo.rpt hx8kdemo.asc
|
|
|
|
icepack hx8kdemo.asc hx8kdemo.bin
|
|
|
|
|
2018-08-31 04:27:34 +08:00
|
|
|
hx8kprog: hx8kdemo.bin hx8kdemo_fw.bin
|
2017-09-22 01:45:41 +08:00
|
|
|
iceprog hx8kdemo.bin
|
2018-08-31 04:27:34 +08:00
|
|
|
iceprog -o 1M hx8kdemo_fw.bin
|
2017-09-22 01:45:41 +08:00
|
|
|
|
2018-08-31 04:27:34 +08:00
|
|
|
hx8kprog_fw: hx8kdemo_fw.bin
|
|
|
|
iceprog -o 1M hx8kdemo_fw.bin
|
2017-09-22 01:45:41 +08:00
|
|
|
|
2019-02-12 06:44:47 +08:00
|
|
|
hx8kprog_sections.lds: sections.lds
|
|
|
|
riscv32-unknown-elf-cpp -P -DHX8KDEMO -o $@ $^
|
|
|
|
|
|
|
|
hx8kdemo_fw.elf: hx8kdemo_sections.lds start.s firmware.c
|
|
|
|
riscv32-unknown-elf-gcc -DHX8KDEMO -march=rv32imc -Wl,-Bstatic,-T,hx8kdemo_sections.lds,--strip-debug -ffreestanding -nostdlib -o hx8kdemo_fw.elf start.s firmware.c
|
2018-08-19 19:38:59 +08:00
|
|
|
|
|
|
|
hx8kdemo_fw.hex: hx8kdemo_fw.elf
|
|
|
|
riscv32-unknown-elf-objcopy -O verilog hx8kdemo_fw.elf hx8kdemo_fw.hex
|
|
|
|
|
|
|
|
hx8kdemo_fw.bin: hx8kdemo_fw.elf
|
|
|
|
riscv32-unknown-elf-objcopy -O binary hx8kdemo_fw.elf hx8kdemo_fw.bin
|
|
|
|
|
2018-08-19 02:17:21 +08:00
|
|
|
# ---- iCE40 IceBreaker Board ----
|
|
|
|
|
2018-10-01 20:00:21 +08:00
|
|
|
icebsim: icebreaker_tb.vvp icebreaker_fw.hex
|
|
|
|
vvp -N $< +firmware=icebreaker_fw.hex
|
2018-08-19 02:17:21 +08:00
|
|
|
|
2018-10-01 20:00:21 +08:00
|
|
|
icebsynsim: icebreaker_syn_tb.vvp icebreaker_fw.hex
|
|
|
|
vvp -N $< +firmware=icebreaker_fw.hex
|
2018-08-19 02:17:21 +08:00
|
|
|
|
2019-02-12 06:13:05 +08:00
|
|
|
icebreaker.json: icebreaker.v ice40up5k_spram.v spimemio.v simpleuart.v picosoc.v ../picorv32.v
|
2018-08-19 02:17:21 +08:00
|
|
|
yosys -ql icebreaker.log -p 'synth_ice40 -top icebreaker -json icebreaker.json' $^
|
|
|
|
|
2019-02-12 06:13:05 +08:00
|
|
|
icebreaker_tb.vvp: icebreaker_tb.v icebreaker.v ice40up5k_spram.v spimemio.v simpleuart.v picosoc.v ../picorv32.v spiflash.v
|
2018-08-19 02:17:21 +08:00
|
|
|
iverilog -s testbench -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v`
|
|
|
|
|
|
|
|
icebreaker_syn_tb.vvp: icebreaker_tb.v icebreaker_syn.v spiflash.v
|
|
|
|
iverilog -s testbench -o $@ $^ `yosys-config --datdir/ice40/cells_sim.v`
|
|
|
|
|
|
|
|
icebreaker_syn.v: icebreaker.json
|
|
|
|
yosys -p 'read_json icebreaker.json; write_verilog icebreaker_syn.v'
|
|
|
|
|
|
|
|
icebreaker.asc: icebreaker.pcf icebreaker.json
|
|
|
|
nextpnr-ice40 --freq 13 --up5k --asc icebreaker.asc --pcf icebreaker.pcf --json icebreaker.json
|
|
|
|
|
|
|
|
icebreaker.bin: icebreaker.asc
|
|
|
|
icetime -d up5k -c 12 -mtr icebreaker.rpt icebreaker.asc
|
|
|
|
icepack icebreaker.asc icebreaker.bin
|
|
|
|
|
2018-08-19 19:38:59 +08:00
|
|
|
icebprog: icebreaker.bin icebreaker_fw.bin
|
2018-08-19 02:17:21 +08:00
|
|
|
iceprog icebreaker.bin
|
2018-08-19 19:38:59 +08:00
|
|
|
iceprog -o 1M icebreaker_fw.bin
|
2018-08-19 02:17:21 +08:00
|
|
|
|
2018-08-19 19:38:59 +08:00
|
|
|
icebprog_fw: icebreaker_fw.bin
|
|
|
|
iceprog -o 1M icebreaker_fw.bin
|
2017-08-07 21:13:27 +08:00
|
|
|
|
2019-02-12 06:44:47 +08:00
|
|
|
icebreaker_sections.lds: sections.lds
|
|
|
|
riscv32-unknown-elf-cpp -P -DICEBREAKER -o $@ $^
|
|
|
|
|
|
|
|
icebreaker_fw.elf: icebreaker_sections.lds start.s firmware.c
|
|
|
|
riscv32-unknown-elf-gcc -DICEBREAKER -march=rv32ic -Wl,-Bstatic,-T,icebreaker_sections.lds,--strip-debug -ffreestanding -nostdlib -o icebreaker_fw.elf start.s firmware.c
|
2017-07-29 22:01:39 +08:00
|
|
|
|
2018-08-19 19:38:59 +08:00
|
|
|
icebreaker_fw.hex: icebreaker_fw.elf
|
|
|
|
riscv32-unknown-elf-objcopy -O verilog icebreaker_fw.elf icebreaker_fw.hex
|
2017-07-29 22:01:39 +08:00
|
|
|
|
2018-08-19 19:38:59 +08:00
|
|
|
icebreaker_fw.bin: icebreaker_fw.elf
|
|
|
|
riscv32-unknown-elf-objcopy -O binary icebreaker_fw.elf icebreaker_fw.bin
|
2017-07-29 22:01:39 +08:00
|
|
|
|
2017-09-22 01:45:41 +08:00
|
|
|
# ---- Testbench for SPI Flash Model ----
|
|
|
|
|
|
|
|
spiflash_tb: spiflash_tb.vvp firmware.hex
|
|
|
|
vvp -N $<
|
|
|
|
|
|
|
|
spiflash_tb.vvp: spiflash.v spiflash_tb.v
|
|
|
|
iverilog -s testbench -o $@ $^
|
|
|
|
|
2017-10-01 21:45:46 +08:00
|
|
|
# ---- ASIC Synthesis Tests ----
|
|
|
|
|
|
|
|
cmos.log: spimemio.v simpleuart.v picosoc.v ../picorv32.v
|
|
|
|
yosys -l cmos.log -p 'synth -top picosoc; abc -g cmos2; opt -fast; stat' $^
|
|
|
|
|
2017-08-07 21:13:27 +08:00
|
|
|
# ---- Clean ----
|
2017-07-29 22:01:39 +08:00
|
|
|
|
|
|
|
clean:
|
2017-08-05 23:08:16 +08:00
|
|
|
rm -f testbench.vvp testbench.vcd spiflash_tb.vvp spiflash_tb.vcd
|
2018-08-19 19:38:59 +08:00
|
|
|
rm -f hx8kdemo_fw.elf hx8kdemo_fw.hex hx8kdemo_fw.bin cmos.log
|
|
|
|
rm -f icebreaker_fw.elf icebreaker_fw.hex icebreaker_fw.bin
|
2017-08-07 21:13:27 +08:00
|
|
|
rm -f hx8kdemo.blif hx8kdemo.log hx8kdemo.asc hx8kdemo.rpt hx8kdemo.bin
|
2017-08-08 04:36:58 +08:00
|
|
|
rm -f hx8kdemo_syn.v hx8kdemo_syn_tb.vvp hx8kdemo_tb.vvp
|
2018-08-19 02:17:21 +08:00
|
|
|
rm -f icebreaker.json icebreaker.log icebreaker.asc icebreaker.rpt icebreaker.bin
|
|
|
|
rm -f icebreaker_syn.v icebreaker_syn_tb.vvp icebreaker_tb.vvp
|
2017-07-29 22:01:39 +08:00
|
|
|
|
2018-08-19 02:17:21 +08:00
|
|
|
.PHONY: spiflash_tb clean
|
|
|
|
.PHONY: hx8kprog hx8kprog_fw hx8ksim hx8ksynsim
|
|
|
|
.PHONY: icebprog icebprog_fw icebsim icebsynsim
|