forked from chipsalliance/rocket-chip
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefrag
76 lines (61 loc) · 2.83 KB
/
Makefrag
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
# check RISCV environment variable
ifndef RISCV
$(error Please set environment variable RISCV. Please take a look at README)
endif
MODEL ?= Top
PROJECT := rocketchip
CXX ?= g++
CXXFLAGS := -O1
CHISEL_VERSION=2
SBT := CHISEL_SUBMODULE="chisel$(CHISEL_VERSION)" java -Xmx2048M -Xss8M -XX:MaxPermSize=256M -jar sbt-launch.jar
SHELL := /bin/bash
ifeq ($(CHISEL_VERSION),2)
CHISEL_ARGS := $(PROJECT) $(MODEL) $(CONFIG) --W0W --minimumCompatibility 3.0.0 --backend $(BACKEND) --configName $(CONFIG) --compileInitializationUnoptimized --targetDir $(generated_dir)
else
CHISEL_ARGS := --W0W --minimumCompatibility 3.0.0 --backend $(BACKEND) --configName $(CONFIG) --compileInitializationUnoptimized --targetDir $(generated_dir)
endif
src_path = src/main/scala
default_submodules = . junctions uncore hardfloat rocket zscale groundtest context-dependent-environments
chisel_srcs = $(addprefix $(base_dir)/,$(addsuffix /$(src_path)/*.scala,$(default_submodules) $(ROCKETCHIP_ADDONS)))
disasm := 2>
which_disasm := $(shell which spike-dasm 2> /dev/null)
ifneq ($(which_disasm),)
disasm := 3>&1 1>&2 2>&3 | $(which_disasm) $(DISASM_EXTENSION) >
endif
timeout_cycles = 100000000
#--------------------------------------------------------------------
# DRAMSim2
#--------------------------------------------------------------------
DRAMSIM_OBJS := $(patsubst %.cpp,%.o,$(wildcard $(base_dir)/dramsim2/*.cpp))
$(DRAMSIM_OBJS): %.o: %.cpp
$(CXX) $(CXXFLAGS) -DNO_STORAGE -DNO_OUTPUT -Dmain=nomain -c -o $@ $<
$(sim_dir)/libdramsim.a: $(DRAMSIM_OBJS)
ar rcs $@ $^
#--------------------------------------------------------------------
# Build Tests
#--------------------------------------------------------------------
%.hex:
$(MAKE) -C $(dir $@) $(notdir $@)
%.riscv.hex: %.riscv
$(MAKE) -C $(dir $@) $(notdir $@)
#---------------------------------------------------------------------
# Constants Header Files
#---------------------------------------------------------------------
params_file = $(generated_dir)/$(MODEL).$(CONFIG).prm
consts_header = $(generated_dir)/consts.$(CONFIG).h
scr_header = $(generated_dir)/$(MODEL).$(CONFIG).scr_map.h
$(consts_header): $(params_file)
echo "#ifndef __CONST_H__" > $@
echo "#define __CONST_H__" >> $@
sed -r 's/\(([A-Za-z0-9_]+),([A-Za-z0-9_]+)\)/#define \1 \2/' $< >> $@
echo "#define TBFRAG \"$(MODEL).$(CONFIG).tb.cpp\"" >> $@
echo "#endif // __CONST_H__" >> $@
params_file_debug = $(generated_dir_debug)/$(MODEL).$(CONFIG).prm
consts_header_debug = $(generated_dir_debug)/consts.$(CONFIG).h
$(consts_header_debug): $(params_file_debug)
echo "#ifndef __CONST_H__" > $@
echo "#define __CONST_H__" >> $@
sed -r 's/\(([A-Za-z0-9_]+),([A-Za-z0-9_]+)\)/#define \1 \2/' $< >> $@
echo "#define TBFRAG \"$(MODEL).$(CONFIG).tb.cpp\"" >> $@
echo "#endif // __CONST_H__" >> $@
scr_header_debug = $(generated_dir_debug)/$(MODEL).$(CONFIG).scr_map.h