summaryrefslogtreecommitdiff
path: root/Makefile
blob: 9eff3efa2402b87f2e9e10efa3e375877e0490b7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
VERILOG := $(wildcard **.sv)
HEADERS := $(wildcard **.svh)
CPPSRCS := $(wildcard **.cpp)
COLLATERAL := $(wildcard **.hex)

OPTS ?=

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 $(OPTS) --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