-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmakefile.def
160 lines (147 loc) · 7.47 KB
/
makefile.def
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
####### Bluespec defs ########
BSC = bsc
SCRATCH = ~/scratch/mpapamic/
VLOG = build
XST_DIR = ${SCRATCH}/xst_runs
DC_DIR = ${SCRATCH}/dc_runs
#XST_DIR = /scratch/mpapamic/xst_runs
#XST_DIR = /home/mpapamic/xst_runs
#SYN_DIR = /scratch/mpapamic/synplify_runs
SYN_DIR = /home/mpapamic/synplify_runs
VCS_DIR = ${SCRATCH}/vcs_runs
#VCS_DIR = ./vcs_runs
#VCS_DIR = /scratch/mpapamic/vcs_runs
OBJDIR = ./obj
IMPORT_DIRS = $(shell find . -name ".svn" -prune -o -name "build" -prune -o -type d -exec echo -ne "{}:" \;)
ALLDIRS = $(shell find . -name ".svn" -prune -o -name "*.c*" -exec dirname {} \; | uniq)
IMPORT = $(OBJDIR):${BLUESPEC_HOME}/lib/Prelude:${BLUESPEC_HOME}/lib/Libraries:$(IMPORT_DIRS)+
# With this set of options I was able to compile the largest design. (16x16, 8VCs). Make sure you run on machines with 16GB memory. 16x16 8VCs requires 11.4GB of RAM.
#GLOBAL_FLAGS = -opt-undetermined-vals -unspecified-to 0 -resource-simple -Xc++ -O0 -u -simdir $(OBJDIR) -bdir $(OBJDIR) -p $(IMPORT) -check-assert -vdir $(VLOG) +RTS -K3072M -H8192M -RTS -v95 -no-warn-action-shadowing
# Erics flags
GLOBAL_FLAGS = -relax-method-earliness -opt-undetermined-vals -unspecified-to X -resource-simple -Xc++ -O0 -u -simdir $(OBJDIR) -bdir $(OBJDIR) -p $(IMPORT) -check-assert -vdir $(VLOG) +RTS -K3072M -H8192M -RTS -v95 -no-warn-action-shadowing
#GLOBAL_FLAGS = -opt-undetermined-vals -unspecified-to X -scheduler-effort 1 -resource-simple -Xc++ -O0 -u -simdir $(OBJDIR) -bdir $(OBJDIR) -p $(IMPORT) -check-assert -vdir $(VLOG) +RTS -K3072M -H8192M -RTS -v95 -no-warn-action-shadowing
#GLOBAL_FLAGS = -unspecified-to X -scheduler-effort 1 -Xc++ -O0 -u -simdir $(OBJDIR) -bdir $(OBJDIR) -p $(IMPORT) -check-assert -vdir $(VLOG) +RTS -K1024M -RTS -v95 -no-warn-action-shadowing
#GLOBAL_FLAGS = -unspecified-to X -scheduler-effort 1 -Xc++ -O0 -u -simdir $(OBJDIR) -bdir $(OBJDIR) -p $(IMPORT) -check-assert -vdir $(VLOG) +RTS -K500000000 -RTS -v95 -no-warn-action-shadowing
#GLOBAL_FLAGS = -unspecified-to X -scheduler-effort 1 -Xc++ -O0 -Xc++ -fPIC -u -simdir $(OBJDIR) -bdir $(OBJDIR) -p $(IMPORT) -check-assert -vdir $(VLOG) +RTS -K500000000 -RTS -v95 -no-warn-action-shadowing
#GLOBAL_FLAGS = -unspecified-to X -steps-warn-interval 1000 -v -show-stats -scheduler-effort 0 -Xc++ -O0 -u -simdir $(OBJDIR) -bdir $(OBJDIR) -p $(IMPORT) -check-assert -vdir $(VLOG) +RTS -K500000000 -RTS -v95 -no-warn-action-shadowing
BSC_vsim = bsc $(GLOBAL_FLAGS) -verilog -steps 10000000
#BSC_vsim = bsc $(GLOBAL_FLAGS) -verilog -g
BSC_bsim = bsc $(GLOBAL_FLAGS) -show-schedule -D __NOSYNTH__=1 -sim +RTS -K50000000 -RTS -steps 10000000 -g
timestamp = `date +%F_%H%M`
fixed_timestamp := $(shell date +%F_%H%M)
logdir = logs
####### GCC defs ########
GCC = gcc
G++ = g++
OPTS = -Wall -O3 -funroll-loops -DNS_STANDALONE -DLOG_RESULTS
INCL = -I./cfg/ \
-I./swlib/ \
-I./swlib/hashlib \
-I./swlib/easy_opt \
-I./swlib/timing \
-I./rtl/Stats \
-I./rtl/Coprims \
-I./sw/Netsim \
-I./sw/Netsim/testing \
-I./sw/Dramsim
####### Functions ########
define vsim_compile
@echo Compiling $(strip $(1)) from file $(2) into simulatable Verilog
@mkdir -p ${OBJDIR}
@${BSC_vsim} ${GLOBAL_FLAGS} ${USER_FLAGS} -g ${1} ${2}
endef
#define vsim_compile_dbg_ref
#@echo Compiling $(strip $(1)) from file $(2) into simulatable Verilog
#@${BSC_vsim} -D EN_DBG_REF ${GLOBAL_FLAGS} -g ${1} ${2}
#endef
#
#define vsim_compile_dbg_ref
#@echo Compiling $(strip $(1)) from file $(2) into simulatable Verilog
#@${BSC_vsim} -D EN_DBG_REF ${GLOBAL_FLAGS} -g ${1} ${2}
#endef
define bsim_compile
@echo Compiling $(strip $(1)) from file $(2) into .o file
rm -f $(OBJDIR)/schedule.o $(OBJDIR)/mk*.o $(OBJDIR)/$(strip $(1)).o
@${BSC_bsim} ${1} ${2}
@touch $(OBJDIR)/non.o
@${BSC} -sim ${GLOBAL_FLAGS} ${USER_FLAGS} -o ${1} -e ${1} $(OBJDIR)/*.ba $(OBJDIR)/*.o
endef
define xst_compile
@echo Compiling for xst
mkdir -p ${XST_DIR}/$(strip $(1))_${fixed_timestamp}
cp -r ${VLOG}/* ${XST_DIR}/$(strip $(1))_${fixed_timestamp}
./scripts/compile_xst.sh ${XST_DIR}/$(strip $(1))_${fixed_timestamp} $(strip $(1)) $(2)
@echo Finished synthesis in directory: ${XST_DIR}/$(strip $(1))_${fixed_timestamp}
./scripts/getSynthStats.sh ${XST_DIR}/$(strip $(1))_${fixed_timestamp}
endef
define map_compile
@echo Compiling for xst
mkdir -p ${XST_DIR}/$(strip $(1))_${fixed_timestamp}
cp -r ${VLOG}/* ${XST_DIR}/$(strip $(1))_${fixed_timestamp}
./scripts/compile_xst.sh ${XST_DIR}/$(strip $(1))_${fixed_timestamp} $(strip $(1)) $(2)
@echo Finished synthesis in directory: ${XST_DIR}/$(strip $(1))_${fixed_timestamp}
@echo Running MAP to extract detailed resource usage stats
./scripts/getMapStats.sh ${XST_DIR}/$(strip $(1))_${fixed_timestamp} $(strip $(1)) $(2)
./scripts/getSynthStats.sh ${XST_DIR}/$(strip $(1))_${fixed_timestamp}
endef
define dc_compile
@echo Compiling with Synopsys DC
mkdir -p ${DC_DIR}/$(strip $(1))_${fixed_timestamp}
cp -r ${VLOG}/* ${DC_DIR}/$(strip $(1))_${fixed_timestamp}
./scripts/synth_dc.sh ${DC_DIR}/$(strip $(1))_${fixed_timestamp} $(strip $(1)) $(2)
@echo Finished synthesis in directory: ${DC_DIR}/$(strip $(1))_${fixed_timestamp}
#./scripts/getSynthStats.sh ${DC_DIR}/$(strip $(1))_${fixed_timestamp}
endef
# define xst_compile_speed2
# @echo Compiling for xst
# mkdir -p ${XST_DIR}/$(strip $(1))_${timestamp}
# cp -r ${VLOG}/* ${XST_DIR}/$(strip $(1))_${timestamp}
# ./scripts/compile_xst_speed2.sh ${XST_DIR}/$(strip $(1))_${timestamp} $(strip $(1))
# endef
#
# define xst_compile_speed3
# @echo Compiling for xst
# mkdir -p ${XST_DIR}/$(strip $(1))_${timestamp}
# cp -r ${VLOG}/* ${XST_DIR}/$(strip $(1))_${timestamp}
# ./scripts/compile_xst_speed3.sh ${XST_DIR}/$(strip $(1))_${timestamp} $(strip $(1))
# endef
#
# define xst_compile_xupv5
# @echo Compiling for xst
# mkdir -p ${XST_DIR}_xupv5/$(strip $(1))_${timestamp}
# cp -r ${VLOG}/* ${XST_DIR}_xupv5/$(strip $(1))_${timestamp}
# ./scripts/compile_xst_xupv5.sh ${XST_DIR}_xupv5/$(strip $(1))_${timestamp} $(strip $(1))
# endef
#
# define xst_compile_xupv5_speed2
# @echo Compiling for xst
# mkdir -p ${XST_DIR}_xupv5/$(strip $(1))_${timestamp}
# cp -r ${VLOG}/* ${XST_DIR}_xupv5/$(strip $(1))_${timestamp}
# ./scripts/compile_xst_xupv5_speed2.sh ${XST_DIR}_xupv5/$(strip $(1))_${timestamp} $(strip $(1))
# endef
#
# define xst_compile_xupv5_speed3
# @echo Compiling for xst
# mkdir -p ${XST_DIR}_xupv5/$(strip $(1))_${timestamp}
# cp -r ${VLOG}/* ${XST_DIR}_xupv5/$(strip $(1))_${timestamp}
# ./scripts/compile_xst_xupv5_speed3.sh ${XST_DIR}_xupv5/$(strip $(1))_${timestamp} $(strip $(1))
# endef
define vcs_compile
@echo Compiling for vcs
mkdir -p ${VCS_DIR}/$(strip $(1))_${timestamp}
cp -r ${VLOG}/* ${VCS_DIR}/$(strip $(1))_${timestamp}
./scripts/compile_vcs.sh ${VCS_DIR}/$(strip $(1))_${timestamp} $(strip $(1))
#./scripts/dovcs.sh ${VCS_DIR}/$(strip $(1))_${timestamp} $(strip $(1))
endef
define csrc
buildrepo \
$(patsubst %.c,$(OBJDIR)/%.o,$(shell find ${1} -maxdepth 1 -name "*.c")) \
$(patsubst %.cpp,$(OBJDIR)/%.o,$(shell find ${1} -maxdepth 1 -name "*.cpp"))
endef
#$(shell find ${1} -maxdepth 1 -name "*.c" -exec sh -c "echo {} | sed 's/\.c/.o/g'" \;) \
#$(patsubst %.cpp,$(OBJDIR)/%.o,$(shell find ${1} -maxdepth 1 -name "*.cpp" -exec sh -c "echo {} | sed 's/\.cpp/.o/g'" \;))
#GLOBAL_FLAGS = -verbose -u -unspecified-to X -O -show-schedule -vdir verilog
#GLOBAL_FLAGS = -u -vdir verilog -check-assert -verbose -show-stats -inline-simple
#GLOBAL_FLAGS = -u -vdir verilog -unspecified-to X -check-assert -verbose -opt-undetermined-vals
# -scheduler-effort 0
# -one-module-per-file