Save and Restore using ncsim (nc) and Specman
Note:
Allow pop up option in your browser to see statistics on this page
frequent count watch.
- In cases where simulation is extremely long till the point of failure, a machanism of save and restore can help a great deal. One can save the simulation state, just before the failure and re-start from this point. For complex bugs in long simulations, this is very handy in reducing the debug cycle per each trial.
- The following page instructs you, step by step, how to create a script that will: run the test to a point just before the fail, save a snap shot, and later if required restore it.
- First change your regular TCL script to create a snapshot:
run 100 us
run -clean
save chk_100 -overwrite
sn save chk_100.esv
#run
#exit
- In this example I decide to stop after 100 us and overwrite a check point, if one exists.
- From a command line verify that the check point was created:
ncls -64BIT -all
architecture WORK.TXC_TOP_TB:HTWTESTBENCH (COD) <0x39dfadc2>
snapshot work.chk_100:htwtestbench (SSS)
snapshot work.txc_top_tb:htwtestbench (SSS)
- If the simulation is realy long, prepare the check point over night. When you come in, the next day, and a new iteration of simulation run is required, do the following:
irun -gui -64bit -r work.chk_100:htwtestbench -input vcd_wave.tcl
#The TCL merely contains wave generation command and specman restore:
sn res chk_100.esv
probe -create -vcd -var -all -depth 2
- I used irun for simulation and I also use it for the restore invocation.
- Debugger Tip: sometimes you stop the debugger from an interactive batch terminal. If it stops in specman prompt, you may want to return to NC prompt to store the simulation state. So you need to add a break point "b sim" and then hit c (continue).
- For verification environments, which do not use irun, use the following.
- First create the checkpoint in the usual mode and create two files for ncsim and specman.
- If you don't know where the system saved the ncsim checkpoint, bring it up using GUI and do:
simulation restart from checkpoint.
It runs: restart my_lib_loc.chk_100:module
It should be able to find it and once loaded a TCL command is printed so you can cut it to your own TCL script.
- I have included all parameters required to store both checkpoints in the command line rather than in the TCL file.
specrun -p "res -retain chk_100.esv" ncsim -batch pm40_40_88_lib.chk_100:configuration -input pini.tcl
- Last is the TCL file. As mentioned above the checkpoint parameters are already given in the command line, so I merely check that the restored simulation is started in the time, that I created the checkpoint.
simple TCL file to verify start on checkpoint time
-
Recently I have worked with an environment that fires up specmann differently:
The new way is by setting some environment variables and than launch ncsim. Once I stopped
in the debug mode, save the checkpoint is the same, but you have to pay attention to NC response messages for
names of snapshots and locations:
run -clean
save chkpini -overwrite
Saved snapshot enet120_ss_tb_lib.chkpini:module
sn save chkpini.esv
sve_env_u-@24034: sve.pre_save(chkpini,)
changes
First is specman pre-commands:
export SPECMAN_PRE_COMMANDS="res -retain chkpini.esv"
Second is the ncsim command:
ncsim -status -NBASYNC -nowarn DLCPTH:DLCIML:DLNCML +x_off -dumpstack -nocifcheck -cdslib cds.lib -hdlvar hdl.var -logfile ncsim.log enet120_ss_tb_lib.chkpini:module
| |