forked from OSCPU/NutShell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
74 lines (53 loc) · 1.75 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
TOP = TopMain
FPGATOP = NutShellFPGATop
BUILD_DIR = ./build
TOP_V = $(BUILD_DIR)/$(TOP).v
SCALA_FILE = $(shell find ./src/main/scala -name '*.scala')
TEST_FILE = $(shell find ./src/test/scala -name '*.scala')
USE_READY_TO_RUN_NEMU = true
SIMTOP = top.TopMain
IMAGE ?= ready-to-run/linux.bin
DATAWIDTH ?= 64
BOARD ?= sim # sim pynq axu3cg
CORE ?= inorder # inorder ooo embedded
.DEFAULT_GOAL = verilog
help:
mill -i chiselModule.runMain top.$(TOP) --help BOARD=$(BOARD) CORE=$(CORE)
$(TOP_V): $(SCALA_FILE)
mkdir -p $(@D)
mill -i chiselModule.runMain top.$(TOP) -td $(@D) --output-file $(@F) --infer-rw $(FPGATOP) --repl-seq-mem -c:$(FPGATOP):-o:$(@D)/$(@F).conf BOARD=$(BOARD) CORE=$(CORE)
sed -i -e 's/_\(aw\|ar\|w\|r\|b\)_\(\|bits_\)/_\1/g' $@
@git log -n 1 >> .__head__
@git diff >> .__diff__
@sed -i 's/^/\/\// ' .__head__
@sed -i 's/^/\/\//' .__diff__
@cat .__head__ .__diff__ $@ > .__out__
@mv .__out__ $@
@rm .__head__ .__diff__
deploy: build/top.zip
build/top.zip: $(TOP_V)
@zip -r $@ $< $<.conf build/*.anno.json
.PHONY: deploy build/top.zip
verilog: $(TOP_V)
SIM_TOP = SimTop
SIM_TOP_V = $(BUILD_DIR)/$(SIM_TOP).v
$(SIM_TOP_V): $(SCALA_FILE) $(TEST_FILE)
mkdir -p $(@D)
mill -i chiselModule.test.runMain $(SIMTOP) -td $(@D) --output-file $(@F) BOARD=sim CORE=$(CORE)
@sed -i 's/$$fatal/xs_assert(`__LINE__)/g' $(SIM_TOP_V)
sim-verilog: $(SIM_TOP_V)
emu: sim-verilog
$(MAKE) -C ./difftest emu WITH_CHISELDB=0 WITH_CONSTANTIN=0
emu-run: sim-verilog
$(MAKE) -C ./difftest emu-run
simv: sim-verilog
$(MAKE) -C ./difftest simv WITH_CHISELDB=0 WITH_CONSTANTIN=0
init:
git submodule update --init
clean:
rm -rf $(BUILD_DIR)
bsp:
mill -i mill.bsp.BSP/install
idea:
mill -i mill.idea.GenIdea/idea
.PHONY: verilog emu clean help $(REF_SO)