7 set sim_top = testbench;
8 set arg_tool = "NCSim"; # By default NCSim is used as simulation tool
9 set arg_wave = 0; # By default waveform is not recorded
10 set arg_verb = 0; # By default basic display on monitor (no verbose)
11 set arg_test = 0; # By default all testcases are simulated
14 # GETTING PARAMETERS FROM COMMAND LINE
15 #######################################
21 echo " Verification without any argument:"
24 while ($cur_arg <= $#argv)
26 switch ("$argv[$cur_arg]")
36 set arg_tool = "ModelSim";
37 echo " $argv[$cur_arg] - ModelSim tool"
40 set arg_tool = "ModelSim";
41 echo " $argv[$cur_arg] - ModelSim tool"
46 echo " $argv[$cur_arg] - Waveform"
50 echo " $argv[$cur_arg] - Waveform"
55 echo " $argv[$cur_arg] - Verbose"
59 echo " $argv[$cur_arg] - Verbose"
63 if (-e ../../../bench/verilog/testcases/$argv[$cur_arg].v) then
64 set arg_test = $argv[$cur_arg];
65 echo " $argv[$cur_arg] - Testcase"
69 echo " Invalid verification argument: $argv[$cur_arg]"
93 if (-e ./file_list.lst) then
94 rm -rf ./file_list.lst
96 if (-e ../bin/cds.lib) then
99 if (-e ../bin/hdl.var) then
100 rm -rf ../bin/hdl.var
102 if (-e ./compile.args) then
103 rm -rf ./compile.args
105 if (-e ./elab.args) then
108 if (-e ./sim.args) then
111 if (-e ./sim.tcl) then
114 if (-e ./sim.do) then
118 # Projects, Libraries and Logs
119 if (-e ./uart.mpf) then
125 if (-e ./INCA_libs/worklib) then
126 rm -rf ./INCA_libs/worklib
130 # PREPARING FILE LIST
131 ######################
134 echo "../../../rtl/verilog/uart_top.v" >> ./file_list.lst
135 echo "../../../rtl/verilog/uart_wb.v" >> ./file_list.lst
136 echo "../../../rtl/verilog/uart_transmitter.v" >> ./file_list.lst
137 echo "../../../rtl/verilog/uart_receiver.v" >> ./file_list.lst
138 echo "../../../rtl/verilog/uart_tfifo.v" >> ./file_list.lst
139 echo "../../../rtl/verilog/uart_rfifo.v" >> ./file_list.lst
140 echo "../../../rtl/verilog/uart_regs.v" >> ./file_list.lst
141 echo "../../../rtl/verilog/uart_debug_if.v" >> ./file_list.lst
144 if ($arg_test == 0) then
146 foreach testcase (../../../bench/verilog/testcases/uart*.v)
147 if ($i == $cur_test_num) then
148 set testcase_i = $testcase:t:r
152 set max_test_num = $i;
154 set testcase_i = $arg_test;
155 set max_test_num = 1;
157 echo "//////////////////////////////////////////////////" > ./file_list.lst
158 echo "// File created within script ${0}" >> ./file_list.lst
159 echo "// path: $cwd" >> ./file_list.lst
160 echo "// user: $user" >> ./file_list.lst
161 echo "//////////////////////////////////////////////////" >> ./file_list.lst
162 echo "../../../bench/verilog/testcases/$testcase_i.v" >> ./file_list.lst
163 # Delete vawe out file for this testcase, if it already exists
164 if (-e ../out/$testcase_i.wlf) then
165 rm -rf ../out/$testcase_i.wlf
167 # Delete log out file for this testcase, if it already exists
168 if (-e ../log/$testcase_i.log) then
169 rm -rf ../log/$testcase_i.log
173 echo "../../../bench/verilog/uart_testbench.v" >> ./file_list.lst
174 echo "../../../bench/verilog/wb_master_model.v" >> ./file_list.lst
175 echo "../../../bench/verilog/uart_device.v" >> ./file_list.lst
176 echo "../../../bench/verilog/uart_testbench_utilities.v" >> ./file_list.lst
177 echo "../../../bench/verilog/uart_wb_utilities.v" >> ./file_list.lst
178 echo "../../../bench/verilog/uart_device_utilities.v" >> ./file_list.lst
181 # COMPILING & ELABORATING
182 ##########################
184 if ("$arg_tool" == "NCSim") then
186 # cds.lib library file
187 echo "//////////////////////////////////////////////////" > ../bin/cds.lib
188 echo "// File created within script ${0}" >> ../bin/cds.lib
189 echo "// path: $cwd" >> ../bin/cds.lib
190 echo "// user: $0" >> ../bin/cds.lib
191 echo "//////////////////////////////////////////////////" >> ../bin/cds.lib
192 echo "DEFINE worklib ./INCA_libs/worklib" >> ../bin/cds.lib
194 # hdl.var variable file
195 echo "//////////////////////////////////////////////////" > ../bin/hdl.var
196 echo "// File created within script ${0}" >> ../bin/hdl.var
197 echo "// path: $cwd" >> ../bin/hdl.var
198 echo "// user: $0" >> ../bin/hdl.var
199 echo "//////////////////////////////////////////////////" >> ../bin/hdl.var
200 echo "INCLUDE \$CDS_INST_DIR/tools/inca/files/hdl.var" >> ../bin/hdl.var
201 echo "DEFINE WORK worklib" >> ../bin/hdl.var
203 # compile.args argument file
204 echo "//////////////////////////////////////////////////" > ./compile.args
205 echo "// File created within script ${0}" >> ./compile.args
206 echo "// path: $cwd" >> ./compile.args
207 echo "// user: $0" >> ./compile.args
208 echo "//////////////////////////////////////////////////" >> ./compile.args
209 echo "-CDSLIB ../bin/cds.lib" >> ./compile.args
210 echo "-HDLVAR ../bin/hdl.var" >> ./compile.args
211 echo "-MESSAGES" >> ./compile.args
212 echo "-NOCOPYRIGHT" >> ./compile.args
213 echo "-INCDIR ../../../rtl/verilog" >> ./compile.args
214 echo "-INCDIR ../../../bench/verilog" >> ./compile.args
215 echo "-INCDIR ../../../bench/verilog/testcases" >> ./compile.args
216 if ($arg_verb == 1) then
217 echo "-DEFINE VERBOSE" >> ./compile.args
219 cat ./file_list.lst >> ./compile.args
222 ncvlog -LOGFILE ../log/$testcase_i.compile.log -f ./compile.args #> /dev/null
224 # elab.args argument file
225 echo "//////////////////////////////////////////////////" > ./elab.args
226 echo "// File created within script ${0}" >> ./elab.args
227 echo "// path: $cwd" >> ./elab.args
228 echo "// user: $0" >> ./elab.args
229 echo "//////////////////////////////////////////////////" >> ./elab.args
230 echo "-CDSLIB ../bin/cds.lib" >> ./elab.args
231 echo "-HDLVAR ../bin/hdl.var" >> ./elab.args
232 echo "-MESSAGES" >> ./elab.args
233 echo "-NOCOPYRIGHT" >> ./elab.args
234 echo "-NOTIMINGCHECKS" >> ./elab.args
235 echo "-SNAPSHOT worklib.testbench:rtl" >> ./elab.args
236 echo "-NO_TCHK_MSG" >> ./elab.args
237 echo "-ACCESS +RWC" >> ./elab.args
238 echo "worklib.$sim_top" >> ./elab.args
241 ncelab -LOGFILE ../log/$testcase_i.elab.log -f ./elab.args #> /dev/null
244 # compile.args argument file
245 echo "+libext+.v" >> ./compile.args
246 echo "-y ../../../rtl/verilog" >> ./compile.args
247 echo "-y ../../../bench/verilog" >> ./compile.args
248 echo "-y ../../../bench/verilog/testcases" >> ./compile.args
249 echo "-work ./work" >> ./compile.args
250 echo "+incdir+../../../rtl/verilog" >> ./compile.args
251 echo "+incdir+../../../bench/verilog" >> ./compile.args
252 echo '+define+LOG_DIR=\"../log/$testcase_i\"' >> ./compile.args
253 if ($arg_verb == 1) then
254 echo "+define+VERBOSE" >> ./compile.args
256 cat ./file_list.lst >> ./compile.args
259 # echo "project new ./ testbench ./work" >> ./sim.do
263 # echo "vlog -f ./compile.args" >> ./sim.do
264 vlog -f ./compile.args
271 if ("$arg_tool" == "NCSim") then
273 # sim.args argument file
274 echo "//////////////////////////////////////////////////" > ./sim.args
275 echo "// File created within script ${0}" >> ./sim.args
276 echo "// path: $cwd" >> ./sim.args
277 echo "// user: $0" >> ./sim.args
278 echo "//////////////////////////////////////////////////" >> ./sim.args
279 echo "-CDSLIB ../bin/cds.lib" >> ./sim.args
280 echo "-HDLVAR ../bin/hdl.var" >> ./sim.args
281 echo "-MESSAGES" >> ./sim.args
282 echo "-NOCOPYRIGHT" >> ./sim.args
283 echo "-INPUT ./sim.tcl" >> ./sim.args
284 echo "worklib.testbench:rtl" >> ./sim.args
287 echo "//////////////////////////////////////////////////" > ./sim.tcl
288 echo "// File created within script ${0}" >> ./sim.tcl
289 echo "// path: $cwd" >> ./sim.tcl
290 echo "// user: $0" >> ./sim.tcl
291 echo "//////////////////////////////////////////////////" >> ./sim.tcl
293 echo "database -open waves -shm -into ../out/waves.shm" >> ./sim.tcl
294 echo "probe -create -database waves $sim_top -shm -all -depth all" >> ./sim.tcl
295 echo "run" >> ./sim.tcl
297 echo "run" >> ./sim.tcl
299 echo "quit" >> ./sim.tcl
302 ncsim -LICQUEUE -LOGFILE ../log/$testcase_i.sim.log -f ./sim.args
306 echo "vsim work.testbench work.testbench_utilities work.uart_wb_utilities work.uart_device_utilities work.testcase -wlf ../out/$testcase_i.wlf" >> ./sim.do
308 echo "log -r -internal -ports /testbench/*" >> ./sim.do
310 echo "run -all" >> ./sim.do
318 if ($cur_test_num < $max_test_num) then
330 echo " Valid verification arguments:"
331 echo " 'help' / '-h' : This help is displayed"
332 echo " 'modelsim' / '-m' : ModelSim simulation tool is used, otherwise"
333 echo " NCSim is used (default)"
334 echo " 'waveform' / '-w' : Waveform output is recorded, otherwise"
335 echo " NO waveform is recorded (default)"
336 echo " 'verbose' / '-v' : Verbose display on monitor, otherwise"
337 echo " basic display on monitor (default)"
338 echo " '\042testcase\042' : Testcase which is going to be simulated, otherwise"
339 echo " ALL testcases are simulated - regression (default);"
340 echo " Available testcases:"
341 foreach testcase (../../../bench/verilog/testcases/uart*.v)
342 echo " "$testcase:t:r