forked from PorterLu/SUSTemu
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
117 lines (92 loc) · 3.6 KB
/
Makefile
File metadata and controls
117 lines (92 loc) · 3.6 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
.PHONY: all run clean menuconfig bench bench-functional bench-inorder bench-bpred bench-ooo bench-dhrystone bench-dual
PWD = $(shell pwd)
OBJ_DIR = $(PWD)/build
TARGET = $(OBJ_DIR)/sustemu
ASRCS = $(shell find ./src -name "*.S")
CSRCS = $(shell find ./src -name "*.c")
CXXSRCS = $(shell find ./src -name "*.cc")
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
OBJS = $(CSRCS:%.c=$(OBJ_DIR)/%.o) $(CXXSRCS:%.cc=$(OBJ_DIR)/%.o) $(ASRCS:%.S=$(OBJ_DIR)/%.o)
INC_PATH := $(abspath $(shell find ./include -maxdepth 1))
INC_PATH := $(filter-out $(abspath ./include/config), $(INC_PATH))
INC_PATH += $(abspath ./include/generated)
CXX = g++
CC = gcc
LD = g++
AS = gcc
INC_PATH := $(addprefix -I,$(INC_PATH))
LOG_FILE = log.txt
IMG_FILE = os_test/os.elf
IMG_BIN = os_test/os.bin
LIBS = -lSDL2 -lreadline
CFLAGS = -O2 -Wall -Werror -MMD $(INC_PATH)
CXXFLAGS = $(shell llvm-config-11 --cxxflags)
CXXFLAGS += $(shell llvm-config-11 --libs)
CXXFLAGS += -std=c++14 -fno-exceptions -fPIE
CXXFLAGS += $(CFLAGS)
ASFLAGS = -MMD -O0 $(INC_PATH)
LDFLAGS = -O2 $(LIBS) -lLLVM-11
all: $(TARGET)
@echo $< over
test: all
make -C ./test
./build/sustemu -b -e ./test/kernel.elf -l log.txt ./test/kernel.bin
bench: all
make -C ./test
@echo "=== Functional mode ==="
./build/sustemu -b -e ./test/kernel.elf ./test/kernel.bin
@echo "=== In-order pipeline (no branch predictor) ==="
./build/sustemu -b --inorder -e ./test/kernel.elf ./test/kernel.bin
@echo "=== In-order pipeline + BTB/Tournament branch predictor ==="
./build/sustemu -b --inorder --bpred -e ./test/kernel.elf ./test/kernel.bin
@echo "=== OOO engine (Tomasulo + ROB) + BTB/Tournament branch predictor ==="
./build/sustemu -b --ooo --bpred -e ./test/kernel.elf ./test/kernel.bin
bench-functional: all
make -C ./test
./build/sustemu -b -e ./test/kernel.elf ./test/kernel.bin
bench-inorder: all
make -C ./test
./build/sustemu -b --inorder -e ./test/kernel.elf ./test/kernel.bin
bench-bpred: all
make -C ./test
./build/sustemu -b --inorder --bpred -e ./test/kernel.elf ./test/kernel.bin
bench-ooo: all
make -C ./test/dhrystone
@echo "=== OOO engine (Tomasulo + ROB) + BTB/Tournament branch predictor — Dhrystone ==="
./build/sustemu -b --ooo --bpred -e ./test/dhrystone/dhrystone.elf -l /dev/null ./test/dhrystone/dhrystone.bin
bench-dhrystone: all
make -C ./test/dhrystone
@echo "=== Dhrystone 2.1 — Functional mode ==="
./build/sustemu -b -e ./test/dhrystone/dhrystone.elf -l /dev/null ./test/dhrystone/dhrystone.bin
@echo "=== Dhrystone 2.1 — In-order pipeline + bpred ==="
./build/sustemu -b --inorder --bpred -e ./test/dhrystone/dhrystone.elf -l /dev/null ./test/dhrystone/dhrystone.bin
@echo "=== Dhrystone 2.1 — OOO engine + bpred ==="
./build/sustemu -b --ooo --bpred -e ./test/dhrystone/dhrystone.elf -l /dev/null ./test/dhrystone/dhrystone.bin
bench-dual: all
make -C ./test/dual
@echo "=== Dual-core OOO + bpred — each hart runs independent Dhrystone ==="
./build/sustemu -b --ooo --bpred --dual -e ./test/dual/dual.elf -l /dev/null ./test/dual/dual.bin
$(TARGET): $(OBJS)
@$(LD) -o $@ $(OBJS) $(LDFLAGS) $(LIBS)
$(OBJ_DIR)/%.o: %.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(LIBS) -c -o $@ $<
$(OBJ_DIR)/%.o: %.cc
mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -c -o $@ $<
$(OBJ_DIR)/%.o: %.S
mkdir -p $(dir $@)
$(AS) $(ASFLAGS) -c -o $@ $<
run: $(TARGET)
$(TARGET) -l $(LOG_FILE) -e $(IMG_FILE) $(IMG_BIN)
clean:
rm $(OBJ_DIR) -rf
find ./ -name "*.o" | xargs rm -rf
find ./ -name "*.d" | xargs rm -rf
rm $(LOG_FILE) -rf
make -C ./test clean
menuconfig:
mkdir -p ./build
mconf Kconfig
conf --syncconfig Kconfig
-include $(CSRCS:%.c=%.d) $(CXXSRCS:%.cc=%.d) $(ASRCS:%.S=%.d)