-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
53 lines (41 loc) · 1.48 KB
/
Makefile
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
# This file is modified from:
# https://github.com/georgeyhere/Toast-RV32i/blob/main/Makefile
RISCV_PREFIX = /opt/riscv
SHELL := /bin/bash
IVERILOG = iverilog
VVP = vvp
TOOL_PREFIX = $(RISCV_PREFIX)/bin/riscv64-unknown-elf-
PATH:=$(PATH):$(RISCV_PREFIX)
WORKSPACE = $(shell pwd)
CPU_MODULES = $(shell ls $(WORKSPACE)/rtl/*.v)
CPU_TESTBENCH = $(WORKSPACE)/testbench.v
RISCV_MEMS = $(shell ls $(WORKSPACE)/mem/hex/*.hex)
IVERILOG_FLAGS += -Wall
alltests: testbench.vvp
@echo "==========================================================="
@echo "Running testbench.vvp with all riscv-tests."
$(VVP) -N $< $(RISCV_MEMS) -I$(WORKSPACE)/mem/hex +runall
@echo ""
@echo ""
alltests_vcd: testbench.vvp
@echo "==========================================================="
@echo "Running testbench.vvp with all riscv-tests and vcd output."
$(VVP) -N $< $(RISCV_MEMS) -I$(WORKSPACE)/mem/hex +runall +vcd
@echo ""
@echo ""
testbench.vvp: gen_mem
@echo "==========================================================="
@echo "Generating testbench.vvp"
$(IVERILOG) $(IVERILOG_FLAGS) -o $@ $(CPU_MODULES) $(CPU_TESTBENCH) \
-I$(WORKSPACE)/rtl -I$(WORKSPACE)/mem/hex
@echo ""
@echo ""
gen_mem:
@echo "==========================================================="
@echo "Compiling, linking, and generate mem files for riscv-tests."
@echo "Memory files will be placed into /mem/"
@echo "Dump files will be placed into /mem/dump"
chmod +x ./script/memgen.sh
source ./script/memgen.sh
@echo ""
@echo ""