-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (101 loc) · 4.17 KB
/
Makefile
File metadata and controls
142 lines (101 loc) · 4.17 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# SPDX-FileCopyrightText: 2025 IObundle
#
# SPDX-License-Identifier: MIT
CORE := soc_linux
SIMULATOR ?= icarus
SYNTHESIZER ?= yosys
LINTER ?= spyglass
BOARD ?= iob_cyclonev_gt_dk
BUILD_DIR ?= $(shell nix-shell --run "py2hwsw $(CORE) print_build_dir")
# Soc-linux uses memory with 26 address bits and 4 bytes per word, for a total of 256 MiB.
# We typically have to use the external FPGA board's DDR memory in order to fit the entire memory.
USE_INTMEM ?= 0
USE_EXTMEM ?= 1
INIT_MEM ?= 1
VERSION ?=$(shell cat $(CORE).py | grep version | cut -d '"' -f 4)
ifneq ($(DEBUG),)
EXTRA_ARGS +=--debug_level $(DEBUG)
endif
# System parameters
ifneq ($(INIT_MEM),)
PY_PARAMS:=$(PY_PARAMS):init_mem=$(INIT_MEM)
endif
ifneq ($(USE_INTMEM),)
PY_PARAMS:=$(PY_PARAMS):use_intmem=$(USE_INTMEM)
endif
ifneq ($(USE_EXTMEM),)
PY_PARAMS:=$(PY_PARAMS):use_extmem=$(USE_EXTMEM)
endif
ifneq ($(USE_ETHERNET),)
PY_PARAMS:=$(PY_PARAMS):use_ethernet=$(USE_ETHERNET)
endif
ifneq ($(CPU),)
PY_PARAMS:=$(PY_PARAMS):cpu=$(CPU)
endif
# Remove first char (:) from PY_PARAMS
PY_PARAMS:=$(shell echo $(PY_PARAMS) | cut -c2-)
setup:
nix-shell --run "py2hwsw $(CORE) setup --no_verilog_lint --py_params '$(PY_PARAMS)' $(EXTRA_ARGS)"
pc-emul-run: clean setup
nix-shell --run "make -C ../$(CORE)_V$(VERSION)/ pc-emul-run"
pc-emul-test:
make pc-emul-run
sim-run: clean setup
nix-shell --run "make -C ../$(CORE)_V$(VERSION)/ sim-run SIMULATOR=$(SIMULATOR)"
sim-test:
make sim-run CPU=iob_vexriscv SIMULATOR=verilator
fpga-build: clean
make setup INIT_MEM=0
nix-shell --run "make -C ../$(CORE)_V$(VERSION)/ fpga-sw-build BOARD=$(BOARD)"
make -C ../$(CORE)_V$(VERSION)/ fpga-build BOARD=$(BOARD)
fpga-run:
nix-shell --run "make -C ../$(CORE)_V$(VERSION)/ fpga-sw-build BOARD=$(BOARD)"
make -C ../$(CORE)_V$(VERSION)/ fpga-run BOARD=$(BOARD)
fpga-test:
make fpga-build fpga-run BOARD=iob_cyclonev_gt_dk USE_INTMEM=0 USE_EXTMEM=1
make fpga-build fpga-run BOARD=iob_aes_ku040_db_g USE_INTMEM=0 USE_EXTMEM=1
syn-build: clean setup
nix-shell --run "make -C ../$(CORE)_V$(VERSION)/ syn-build SYNTHESIZER=$(SYNTHESIZER)"
lint-run: clean setup
nix-shell --run "make -C ../$(CORE)_V$(VERSION)/ lint-run LINTER=$(LINTER)"
doc-build: clean setup
nix-shell --run "make -C ../$(CORE)_V$(VERSION)/ doc-build"
doc-test: clean setup
nix-shell --run "make -C ../$(CORE)_V$(VERSION)/ doc-test"
test-all: pc-emul-test sim-test fpga-test syn-build lint-run doc-build doc-test
# Install board server and client
board_server_install:
make -C lib board_server_install
board_server_uninstall:
make -C lib board_server_uninstall
board_server_status:
systemctl status board_server
.PHONY: setup pc-emul-run pc-emul-test sim-run sim-test fpga-build fpga-run fpga-test syn-build lint-run doc-build doc-test test-all board_server_install board_server_uninstall board_server_status
clean:
nix-shell --run "py2hwsw $(CORE) clean --build_dir '$(BUILD_DIR)'"
@rm -rf ../*.summary ../*.rpt
@find . -name \*~ -delete
# Remove all __pycache__ folders with python bytecode
python-cache-clean:
find . -name "*__pycache__" -exec rm -rf {} \; -prune
.PHONY: clean python-cache-clean
# Tester
tester-sim-run: clean setup
nix-shell --run "make -C ../$(CORE)_V$(VERSION)/tester/ sim-run SIMULATOR=$(SIMULATOR)"
tester-fpga-run: clean setup
nix-shell --run "make -C ../$(CORE)_V$(VERSION)/tester/ fpga-sw-build BOARD=$(BOARD)"
make -C ../$(CORE)_V$(VERSION)/tester/ fpga-run BOARD=$(BOARD)
.PHONY: tester-sim-run tester-fpga-run
# Release Artifacts
release-artifacts:
nix-shell --run "make clean setup USE_INTMEM=1 USE_EXTMEM=0 INIT_MEM=1"
tar -czf $(CORE)_V$(VERSION)_INTMEM1_EXTMEM0_INITMEM1.tar.gz ../$(CORE)_V$(VERSION)
nix-shell --run "make clean setup USE_INTMEM=1 USE_EXTMEM=0 INIT_MEM=0"
tar -czf $(CORE)_V$(VERSION)_INTMEM1_EXTMEM0_INITMEM0.tar.gz ../$(CORE)_V$(VERSION)
nix-shell --run "make clean setup USE_INTMEM=1 USE_EXTMEM=1 INIT_MEM=0"
tar -czf $(CORE)_V$(VERSION)_INTMEM1_EXTMEM1_INITMEM0.tar.gz ../$(CORE)_V$(VERSION)
nix-shell --run "make clean setup USE_INTMEM=0 USE_EXTMEM=1 INIT_MEM=0"
tar -czf $(CORE)_V$(VERSION)_INTMEM0_EXTMEM1_INITMEM0.tar.gz ../$(CORE)_V$(VERSION)
.PHONY: release-artifacts
SOC_LINUX_BUILD_DIR:=$(BUILD_DIR)
include linux_targets.mk