-
Notifications
You must be signed in to change notification settings - Fork 98
Expand file tree
/
Copy pathemu.mk
More file actions
82 lines (64 loc) · 2.27 KB
/
emu.mk
File metadata and controls
82 lines (64 loc) · 2.27 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
#***************************************************************************************
# Copyright (c) 2020-2025 Institute of Computing Technology, Chinese Academy of Sciences
# Copyright (c) 2025 Beijing Institute of Open Source Chip
#
# DiffTest is licensed under Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
#
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
# MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
#
# See the Mulan PSL v2 for more details.
#***************************************************************************************
EMU_ELF_NAME = emu
# the target is named as fuzzer for clarity in fuzzing
ifneq ($(FUZZER_LIB), )
EMU_ELF_NAME = fuzzer
endif
EMU = $(BUILD_DIR)/$(EMU_ELF_NAME)
EMU_TOP = SimTop
EMU_CSRC_DIR = $(abspath ./src/test/csrc/emu)
EMU_CONFIG_DIR = $(abspath ./config)
EMU_CXXFILES = $(SIM_CXXFILES) $(shell find $(EMU_CSRC_DIR) -name "*.cpp")
EMU_CXXFLAGS = $(SIM_CXXFLAGS) -I$(EMU_CSRC_DIR)
EMU_HEADERS := $(shell find $(SIM_CSRC_DIR) -name "*.h") \
$(shell find $(DIFFTEST_CSRC_DIR) -name "*.h") \
$(shell find $(EMU_CSRC_DIR) -name "*.h")
########## Supported Configuration Options ##########
# trace (waveform)
EMU_TRACE ?=
# trace (waveform) underscore values
EMU_TRACE_ALL ?=
# multi-threading RTL-simulation
EMU_THREADS ?= 0
ifneq ($(EMU_THREADS),0)
EMU_CXXFLAGS += -DEMU_THREAD=$(EMU_THREADS)
endif
# RTL-level savable models
EMU_SNAPSHOT ?=
ifeq ($(EMU_SNAPSHOT),1)
EMU_CXXFLAGS += -DVM_SAVABLE
endif
# RTL-level structural coverage (instrumented by RTL simulators)
EMU_COVERAGE ?=
# optimization level for RTL simulators
EMU_OPTIMIZE ?= -O3
include verilator.mk
include gsim.mk
########## Emu build recipes ##########
emu-verilator: verilator-emu
@ln -sf $(VERILATOR_TARGET) $(EMU)
emu-gsim: gsim-emu
@ln -sf $(GSIM_EMU_TARGET) $(EMU)
# By default, when no simulator is specified, emu refers to verilator-emu
emu:
ifeq ($(GSIM),1)
@$(MAKE) emu-gsim
else
@$(MAKE) emu-verilator
endif
emu-mk: verilator-emu-mk
clean-obj: verilator-clean-obj gsim-clean-obj