diff options
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d270ffb --- /dev/null +++ b/Makefile | |||
| @@ -0,0 +1,37 @@ | |||
| 1 | VERILOG := $(wildcard **.sv) | ||
| 2 | HEADERS := $(wildcard **.svh) | ||
| 3 | CPPSRCS := $(wildcard **.cpp) | ||
| 4 | COLLATERAL := $(wildcard **.hex) | ||
| 5 | |||
| 6 | QUARTUS ?= /opt/quartus-lite/20.1.1.720/ | ||
| 7 | |||
| 8 | QUARTUS_SH := $(QUARTUS)/quartus/bin/quartus_sh | ||
| 9 | |||
| 10 | sim: build/Vtop | ||
| 11 | $< | ||
| 12 | .PHONY: sim | ||
| 13 | |||
| 14 | gui: build/toycpu.qpf | ||
| 15 | cd build; $(QUARTUS_SH) --gui toycpu | ||
| 16 | .PHONY: gui | ||
| 17 | |||
| 18 | qpf: build/toycpu.qpf | ||
| 19 | .PHONY: qpf | ||
| 20 | |||
| 21 | pof: build/toycpu.pof | ||
| 22 | .PHONY: pof | ||
| 23 | |||
| 24 | build/Vtop: $(VERILOG) $(HEADERS) $(CPPSRCS) $(COLLATERAL) | ||
| 25 | @mkdir -p build | ||
| 26 | verilator +1800-2017ext+sv -Wall -Wno-BLKSEQ -O3 --Mdir build --trace --cc --build --exe --top-module top $(VERILOG) $(CPPSRCS) | ||
| 27 | |||
| 28 | build/toycpu.pof: build/toycpu.qpf $(VERILOG) $(COLLATERAL) | ||
| 29 | cd build; $(QUARTUS_SH) --flow compile toycpu | ||
| 30 | |||
| 31 | build/toycpu.qpf: init.tcl | ||
| 32 | @mkdir -p build | ||
| 33 | cd build; $(QUARTUS_SH) -t ../$< $(addprefix $(PWD),$(VERILOG)) | ||
| 34 | |||
| 35 | clean: | ||
| 36 | rm -rf build | ||
| 37 | .PHONY: clean | ||
