From 5d95607192380be5cc62592efac52814a0e090df Mon Sep 17 00:00:00 2001 From: Julian Blake Kongslie Date: Tue, 23 Mar 2021 12:22:38 -0700 Subject: Initial commit. --- Makefile | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d270ffb --- /dev/null +++ b/Makefile @@ -0,0 +1,37 @@ +VERILOG := $(wildcard **.sv) +HEADERS := $(wildcard **.svh) +CPPSRCS := $(wildcard **.cpp) +COLLATERAL := $(wildcard **.hex) + +QUARTUS ?= /opt/quartus-lite/20.1.1.720/ + +QUARTUS_SH := $(QUARTUS)/quartus/bin/quartus_sh + +sim: build/Vtop + $< +.PHONY: sim + +gui: build/toycpu.qpf + cd build; $(QUARTUS_SH) --gui toycpu +.PHONY: gui + +qpf: build/toycpu.qpf +.PHONY: qpf + +pof: build/toycpu.pof +.PHONY: pof + +build/Vtop: $(VERILOG) $(HEADERS) $(CPPSRCS) $(COLLATERAL) + @mkdir -p build + verilator +1800-2017ext+sv -Wall -Wno-BLKSEQ -O3 --Mdir build --trace --cc --build --exe --top-module top $(VERILOG) $(CPPSRCS) + +build/toycpu.pof: build/toycpu.qpf $(VERILOG) $(COLLATERAL) + cd build; $(QUARTUS_SH) --flow compile toycpu + +build/toycpu.qpf: init.tcl + @mkdir -p build + cd build; $(QUARTUS_SH) -t ../$< $(addprefix $(PWD),$(VERILOG)) + +clean: + rm -rf build +.PHONY: clean -- cgit v1.2.3