updated wiki url
[debian/gnuradio] / usrp2 / fpga / opencores / spi / sim / rtl_sim / run / run_sim
1 #!/bin/csh -f
2
3 set current_par = 0
4 set output_waveform = 0
5 while ( $current_par < $# )
6     @ current_par = $current_par + 1
7     case wave:
8         @ output_waveform = 1
9         breaksw
10     default:
11         echo 'Unknown option "'$argv[$current_par]'"!'
12         exit
13         breaksw
14     endsw
15 end
16
17 echo "TEST: spi"
18
19 #echo "-CDSLIB ./cds.lib"               > ncvlog.args
20 #echo "-HDLVAR ./hdl.var"              >> ncvlog.args
21 echo "-MESSAGES"                       > ncvlog.args
22 echo "-INCDIR ../../../bench/verilog" >> ncvlog.args
23 echo "-INCDIR ../../../rtl/verilog"   >> ncvlog.args
24 echo "-NOCOPYRIGHT"                   >> ncvlog.args
25 echo "-UPDATE"                        >> ncvlog.args
26 echo "-LOGFILE ncvlog.log"            >> ncvlog.args
27
28 foreach filename ( `cat ./rtl.fl` )
29     echo "../../../rtl/verilog/"$filename >> ncvlog.args
30 end
31
32 foreach filename ( `cat ./sim.fl` )
33     echo "../../../bench/verilog/"$filename >> ncvlog.args
34 end
35
36 ncvlog -f ncvlog.args
37 if ($status != 0) then
38   echo "STATUS: failed"
39   exit
40 endif
41
42
43 echo "-MESSAGES"                             > ncelab.args
44 echo "-NOCOPYRIGHT"                         >> ncelab.args
45 #echo "-CDSLIB ./cds.lib"                    >> ncelab.args
46 #echo "-HDLVAR ./hdl.var"                    >> ncelab.args
47 echo "-LOGFILE ncelab.log"                  >> ncelab.args
48 echo "-SNAPSHOT worklib.tb_spi_top:v"       >> ncelab.args
49 echo "-NOTIMINGCHECKS"                      >> ncelab.args
50 echo "-ACCESS +RWC"                         >> ncelab.args
51 echo "tb_spi_top"                           >> ncelab.args
52
53 ncelab -f ncelab.args
54 if ($status != 0) then
55   echo "STATUS: failed"
56   exit
57 endif
58
59
60 echo "-MESSAGES"                   > ncsim.args
61 echo "-NOCOPYRIGHT"               >> ncsim.args
62 #echo "-CDSLIB ./cds.lib"          >> ncsim.args
63 #echo "-HDLVAR ./hdl.var"          >> ncsim.args
64 echo "-INPUT ncsim.tcl"           >> ncsim.args
65 echo "-LOGFILE ncsim.log"         >> ncsim.args
66 echo "worklib.tb_spi_top:v"       >> ncsim.args
67
68 if ( $output_waveform ) then
69     echo "database -open waves -shm -into ../out/wav"                         > ./ncsim.tcl
70     echo "probe -create -database waves -shm tb_spi_top -all -depth all"      >> ./ncsim.tcl
71     echo "stop -create -time 25000000 -relative"                              >> ./ncsim.tcl
72     echo "run"                                                                >> ./ncsim.tcl
73 else
74     echo "stop -create -time 25000000 -relative"                              >> ./ncsim.tcl
75     echo "run"  > ./ncsim.tcl
76 endif
77
78 echo "exit" >> ncsim.tcl
79
80 ncsim -LICQUEUE -f ./ncsim.args
81
82 set exit_line_nb = `sed -n '/exit/=' < ./ncsim.log`
83
84 set dead_line_nb = 0
85
86 if ( $exit_line_nb ) then
87
88   @ dead_line_nb = $exit_line_nb - 1
89   set exit_line=`sed -n $exit_line_nb's/exit/&/gp' < ./ncsim.log`
90   set dead_line=`sed -n $dead_line_nb's/report/&/gp' < ./ncsim.log`
91
92   if ( "$dead_line" == "report (deaddead)" ) then
93     if ( "$exit_line" == "exit (00000000)"   ) then
94       echo "STATUS: passed"  #|tee -a ./run_sim.log 2>&1
95     else
96       echo "STATUS: failed"  #|tee -a ./run_sim.log 2>&1
97     endif
98   else
99     echo "STATUS: failed"
100   endif
101
102 endif
103
104 exit
105
106
107
108