-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
56 lines (44 loc) · 2.42 KB
/
Makefile
File metadata and controls
56 lines (44 loc) · 2.42 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
ifndef TRISTAN_ROOT
$(error TRISTAN_ROOT is not set. Source sourceme.bash first: source sourceme.bash)
endif
ifndef WFG_ROOT
$(error WFG_ROOT is not set. Source sourceme.bash first: source sourceme.bash)
endif
PYTHON ?= python3
TOOLCHAIN_PREFIX ?= riscv32-unknown-elf-
CORE ?= cv32e40x
# ── Source files ───────────────────────────────────────────────────────────────
CV32E40X_SRC_FILES += $(TRISTAN_ROOT)/core/cv32e40x_soc.f
CVA6_SRC_FILES += $(TRISTAN_ROOT)/core/cva6_soc.f
_ := $(info Running with Core: $(CORE))
# ── Testbench ──────────────────────────────────────────────────────────────────
TESTBENCH += $(TRISTAN_ROOT)/core/testbench/top_tb.sv
# ── Cocotb configuration ───────────────────────────────────────────────────────
SIM ?= verilator
TOPLEVEL_LANG ?= verilog
TOPLEVEL = top_tb
MODULE = top_tb
export PYTHONPATH := $(PYTHONPATH):$(TRISTAN_ROOT)/core/testbench/
# ── Select Core to Use ─────────────────────────────────────────────────────────
ifeq ($(CORE),cv32e40x)
SRC_FILES := $(CV32E40X_SRC_FILES)
endif
ifeq ($(CORE),cv32a60x)
SRC_FILES := $(CVA6_SRC_FILES)
endif
ifeq ($(SIM),verilator)
COMPILE_ARGS := -f $(SRC_FILES) $(TESTBENCH)
EXTRA_ARGS += --no-timing\
--Wno-fatal\
--trace\
--trace-structs\
-j 0
endif
include $(shell cocotb-config --makefiles)/Makefile.sim
# ── Firmware ───────────────────────────────────────────────────────────────────
firmware:
cd $(WFG_ROOT)/firmware && $(MAKE) riscv && cp riscv/firmware.mem $(TRISTAN_ROOT)/
# ── Cleanup ────────────────────────────────────────────────────────────────────
clean::
rm -rf sim_build results.xml *.vcd *.fst *.fst.hier *.log
.PHONY: firmware