Makefile
9.04 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
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
#
# This makefile has rules for making both the executables
# which make up the simulator, and for running test cases.
#
BBDEPTH = ../../..
include $(BBDEPTH)/BBdefs
# Directory to store verilog output files (sim and c files).
# User can overide this variable on make command line, ie.
# 'make SIMDIR=/tmp' or environment variable.
SIMDIR ?= .
# simulator definitions;
SIMDEFS ?=
# run-time dump flags;
SIMDUMP ?=
# gate level;
SIMFIX ?=
SIMGATE ?=
SIMSDF ?=
# paths to vendor library;
VLIB = lib/verilog
SLIB = lib/sdf
# C include directories;
LCINCS =
GCINCS =
# C compiler options
OPTIMIZER = -g
LCOPTS = -fullwarn
# all vcs dirt;
VCSDIRT = $(VCS_NAME).log \
$(SIMDIR)/c.* \
$(SIMDIR)/sim.* \
tokens.v
# path to bcp pli library;
LIBBCPPLI = $(BBDEPTH)/lib/libbcppli
# override global vcs flags:
GVCSOPTS = -l $(VCS_NAME).log \
-M -Mupdate \
+define+SIM \
$(SIMDEFS) \
-V
# build from rtl or gate level;
# BBV is all synthesizable code;
ifdef SIMSDF
BBSDF = +define+SIMSDF
else
BBSDF =
endif
ifdef SIMFIX
BBGATE = fixes
BBFIX = +define+BBFIX
else
BBGATE = syn
BBFIX =
endif
ifdef SIMGATE
BBV = \
-v $(BBDEPTH)/hw/chip/$(BBGATE)/bb.v \
-v $(BBDEPTH)/hw/chip/bcp/rsp/src/rsp_dummy.v \
-v $(BBDEPTH)/hw/chip/bcp/rdp/src/rdp_dummy.v \
-v $(BBDEPTH)/hw/chip/bcp/ai/src/ai_dummy.v \
-v $(BBDEPTH)/hw/chip/bcp/vi/src/vi_dummy.v \
-y $(BBDEPTH)/hw/chip/$(SLIB)/nec.15/memories \
-y $(BBDEPTH)/hw/chip/$(SLIB)/nec.15/special \
+2state \
+optconfigfile+twostate.cfg \
+define+SIMGATE $(BBSDF) $(BBFIX)
else
BBV = \
-y $(BBDEPTH)/hw/chip/bcp/src \
-y $(BBDEPTH)/hw/chip/bcp/jtag/src \
-y $(BBDEPTH)/hw/chip/bcp/rdp/src \
-y $(BBDEPTH)/hw/chip/bcp/ri/src \
-y $(BBDEPTH)/hw/chip/bcp/rsp/src \
-y $(BBDEPTH)/hw/chip/bcp/ar/src \
-y $(BBDEPTH)/hw/chip/bcp/mi/src \
-y $(BBDEPTH)/hw/chip/bcp/vi/src \
-y $(BBDEPTH)/hw/chip/bcp/ui/src \
-y $(BBDEPTH)/hw/chip/bcp/ai/src \
-y $(BBDEPTH)/hw/chip/bcp/pi/src \
-y $(BBDEPTH)/hw/chip/bcp/si/src \
-y $(BBDEPTH)/hw/chip/bcp/cs/src \
-y $(BBDEPTH)/hw/chip/bcp/ew/src \
-y $(BBDEPTH)/hw/chip/bcp/ep/src \
-y $(BBDEPTH)/hw/chip/bcp/cv/src \
-y $(BBDEPTH)/hw/chip/bcp/st/src \
-y $(BBDEPTH)/hw/chip/bcp/tc/src \
-y $(BBDEPTH)/hw/chip/bcp/tm/src \
-y $(BBDEPTH)/hw/chip/bcp/tf/src \
-y $(BBDEPTH)/hw/chip/bcp/cc/src \
-y $(BBDEPTH)/hw/chip/bcp/bl/src \
-y $(BBDEPTH)/hw/chip/bcp/at/src \
-y $(BBDEPTH)/hw/chip/bcp/bl/src \
-y $(BBDEPTH)/hw/chip/bcp/ms/src \
-y $(BBDEPTH)/hw/chip/bcp/rsp/src \
-y $(BBDEPTH)/hw/chip/bcp/su/src \
-y $(BBDEPTH)/hw/chip/bcp/vu/src \
-y $(BBDEPTH)/hw/chip/bcp/ls/src \
-y $(BBDEPTH)/hw/chip/bcp/io/src \
-y $(BBDEPTH)/hw/chip/bcp/sb/src \
-v $(BBDEPTH)/hw/chip/$(VLIB)/ricoh_encoder/A5C382CORE.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/virage/vtestena.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/virage/v16x32wrap.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/virage/v64x32wrap.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/virage/NMS_16x32/nms_sc_16x32.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/virage/NMS_16x32/nvco_nc15gfh_16x32.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/virage/NMS_64x32/nms_sc_64x32.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/virage/NMS_64x32/nvco_nc15gfh_64x32.v \
-y $(BBDEPTH)/hw/chip/$(VLIB)/jlib \
-y $(BBDEPTH)/hw/chip/$(VLIB)/usb_pad \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec.15/memories \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec.15/special \
-y $(BBDEPTH)/hw/chip/lib/usb_arc/verilog \
-y $(BBDEPTH)/hw/chip/lib/cast/aes_cbc_d/src \
-y $(BBDEPTH)/hw/chip/src
endif
# vcs options for behavioral simulator;
# models only in below definition;
LVCSOPTS = $(BBV) \
-y $(BBDEPTH)/hw/chip/vsim \
-y $(BBDEPTH)/hw/chip/vsim/monitors \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec.15/verilog_udp \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec.15/scan \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec.15/clockdriver \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec.15/gating \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec.15/iobuffer \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec.15/oscillator \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec.15/primitive \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec.15/nec_bscan \
-y $(BBDEPTH)/hw/chip/$(VLIB)/nec.15/testact \
-y $(BBDEPTH)/hw/chip/$(VLIB)/micron \
-y $(BBDEPTH)/hw/chip/$(VLIB)/cbus \
-y $(BBDEPTH)/hw/chip/$(VLIB)/dbus \
-y $(BBDEPTH)/hw/chip/$(VLIB)/ri \
-y $(BBDEPTH)/hw/chip/$(VLIB)/jchan \
-y $(BBDEPTH)/hw/chip/$(VLIB)/mjctrl \
-y $(BBDEPTH)/hw/chip/$(VLIB)/lctrl \
-y $(BBDEPTH)/hw/chip/$(VLIB)/flash \
-y $(BBDEPTH)/hw/chip/$(VLIB)/samsung/km29u64 \
-y $(BBDEPTH)/hw/chip/$(VLIB)/samsung/km29u128 \
-y $(BBDEPTH)/hw/chip/$(VLIB)/samsung/km29u256 \
-y $(BBDEPTH)/hw/chip/$(VLIB)/samsung/km29u512 \
-y $(BBDEPTH)/hw/chip/$(VLIB)/toshiba/flash \
-v $(BBDEPTH)/hw/chip/$(VLIB)/virage/nvcp_nc15gfh.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/virage/NMS_16x32/nvrm_nc15gfh_16x32.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/virage/NMS_64x32/nvrm_nc15gfh_64x32.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/usb_pad/usb_arc_term.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/usb_pad/usb_bb_term.v \
-v $(BBDEPTH)/hw/chip/$(VLIB)/usb_pad/usb_hostio.v \
-v $(BBDEPTH)/hw/chip/lib/usb_arc/verilog/vusb_host_ctl.v \
-v $(BBDEPTH)/hw/chip/lib/usb_arc/verilog/vusb_otg_lpbck.v \
+libext+.v+.vp+.VP+.vzd+.vmd \
+incdir+$(BBDEPTH)/hw/chip/include \
+incdir+$(BBDEPTH)/hw/chip/bcp/su/src \
+incdir+$(BBDEPTH)/hw/chip/bcp/vu/src \
+incdir+$(BBDEPTH)/hw/chip/bcp/ms/src \
+incdir+$(BBDEPTH)/hw/chip/lib/usb_arc/verilog \
+race=all \
+vcs+lic+wait
# additional vcs options for ipc version;
# use pli interface;
IPCOPTS = +acc +librescan \
+define+RSP_MON \
+define+RSP_PRESENT \
+define+MSPAN_MON
IPCCPUOPTS = +acc +librescan
# additional vcs options for cpu version;
CPUOPTS =
# default target is to build the simulator for verilog tests;
TARGETS = sim.v
default install: $(TARGETS)
# help
help: _always
@echo "clean - clean up all vcs temporaries"
@echo "sim.v - build verilog simulator"
@echo "sim.v.vpd - convert verilog.dump into vpd"
@echo "sim.ipc - build ipc simulator"
@echo "sim.ipc.vpd - convert verilog.dump into vpd"
# clean all vcs files;
clean-vcs: _always
$(RM) -rf $(VCSDIRT)
# thorough clean;
clean: clean-vcs
# include BB common rules;
include $(BBDEPTH)/BBrules
# always dependency;
_always:
# compile the behavioral simulator;
sim.v: _always
$(VCS) $(VCSOPTS) \
-v $(BBDEPTH)/hw/chip/vsim/r4300uni.v \
-Mdir=$(SIMDIR)/c.v \
-P $(LIBBCPPLI)/bcppli.tab $(LIBBCPPLI)/libbcppli.a \
-o $(SIMDIR)/$@ \
vsim.v
sim.v.vpd: verilog.dump
$(VCD2VPD) verilog.dump $@
# run various tests;
test_si: _always
./sim.v +vcs+lic+wait \
+seed=`date +%s` \
+cpu_mon +cbus_mon +ri_mon +mem_mon +lctrl_mon +jctrl_mon \
$(SIMDUMP) +dump_cpu +dump_si +dump_pi +dump_vsim \
+test_si > si.log
$(VCD2VPD) verilog.dump si.vpd
CLKOPTS=
ifdef TOSHIBA
CLKOPTS = +sysclk=10400
endif
test_pi: _always
./sim.v +vcs+lic+wait \
+seed=`date +%s` \
+cpu_mon +cbus_mon +ri_mon +mem_mon +fl_mon \
$(SIMDUMP) $(CLKOPTS)\
+test_pi > pi.log
$(VCD2VPD) verilog.dump pi.vpd
test_mi: _always
./sim.v +vcs+lic+wait \
+seed=`date +%s` \
+cpu_mon +cbus_mon +ri_mon +mem_mon \
$(SIMDUMP) +dump_mi +dump_vsim \
+test_mi > mi.log
$(VCD2VPD) verilog.dump mi.vpd
test_mem_rand: _always
./sim.v +vcs+lic+wait \
+seed=`date +%s` \
+cpu_mon +cbus_mon +ri_mon +mem_mon \
$(SIMDUMP) +dump_cpu +dump_mi +dump_vsim +dump_ri \
+test_mem_rand > mi.log
$(VCD2VPD) verilog.dump mi.vpd
test_sp: _always
./sim.v +vcs+lic+wait \
+seed=`date +%s` \
+cpu_mon +cbus_mon +ri_mon +mem_mon \
$(SIMDUMP) +dump_cpu +dump_mi +dump_vsim +dump_rsp \
+test_sp > sp.log
$(VCD2VPD) verilog.dump sp.vpd
test_vi: _always
./sim.v +vcs+lic+wait \
+seed=`date +%s` \
+cpu_mon +cbus_mon +ri_mon +mem_mon \
$(SIMDUMP) +dump_cpu +dump_mi +dump_vsim +dump_vi \
+test_vi > vi.log
$(VCD2VPD) verilog.dump vi.vpd
# compile ipc simulator;
sim.ipc: _always
$(VCS) $(VCSOPTS) $(IPCOPTS) \
-v $(BBDEPTH)/hw/chip/vsim/r4300uni.v \
-Mdir=$(SIMDIR)/c.ipc \
+define+IPC \
-P $(LIBBCPPLI)/bcppli.tab $(LIBBCPPLI)/libbcppli.a \
-o $(SIMDIR)/$@ \
vsim.v
sim.ipc.vpd: verilog.dump
$(VCD2VPD) verilog.dump $@
# compile cpu simulator;
sim.cpu: _always
$(VCS) $(VCSOPTS) $(CPUOPTS) \
-y $(BBDEPTH)/hw/chip/$(VLIB)/r4300 \
-Mdir=$(SIMDIR)/c.cpu \
+define+SIMCPU \
-P $(LIBBCPPLI)/bcppli.tab $(LIBBCPPLI)/libbcppli.a \
-o $(SIMDIR)/$@ \
vsim.v
sim.cpu.ipc: _always
$(VCS) $(VCSOPTS) $(IPCCPUOPTS) \
-y $(BBDEPTH)/hw/chip/$(VLIB)/r4300 \
-Mdir=$(SIMDIR)/c.cpu \
+define+SIMCPU \
+define+IPC \
-P $(LIBBCPPLI)/bcppli.tab $(LIBBCPPLI)/libbcppli.a \
-o $(SIMDIR)/$@ \
vsim.v
sim.cpu.vpd: verilog.dump
$(VCD2VPD) verilog.dump $@
# run cpu test;
test_cpu: _always
./sim.cpu +vcs+lic+wait \
+seed=`date +%s` \
+cpu_mon +cbus_mon +ri_mon +mem_mon \
$(SIMDUMP) \
> cpu.log
# grep out known race problems;
grep_race: _always
grep -v '^0 ' race.out \
| grep -v nec.15 \
| grep -v lib.verilog.micron \
| grep -v lib.verilog.virage.NMS_16x32 \
| grep -v lib.verilog.virage.NMS_64x32 \
| grep -v lib.verilog.virage.nvcp_nc15gfh.v \
| grep -v nvco_nc15gfh_16x32.v \
| grep -v nvco_nc15gfh_64x32.v \
| grep -v lib.verilog.samsung \
| grep -v lib.usb_arc.verilog \