Product Documentation
Spectre AMS Designer and Xcelium Simulator Mixed-Signal User Guide
Product Version 22.09, September 2022

save

The Tcl save command creates a snapshot of the current simulation state. You can then use the restart command to load the saved snapshot and resume simulation.

You may only issue the save command when the simulator is at certain points in its execution cycle.

If your files are very large, you might encounter a limit on the size of a file. If a library database exceeds this limit, you cannot add objects to the database. If you save many snapshot checkpoints to unique views in a single library, this file size limit could be exceeded. If you reach this limit, you can:

  • Use save -overwrite to overwrite an existing snapshot. For example,
    xcelium> save -simulation -overwrite snap1
  • Save snapshots to a separate library. For example,
    mkdir xcelium.d/snaplib
    xmsim -f xmsim.args
    xcelium> run 1000 ns
    xcelium> save -simulation snaplib.snap1
    xcelium> run 1000 ns
    xcelium> save -simulation snaplib.snap2
  • Remove snapshots using the xmrm utility. For example,
     xmrm -snapshot worklib.snap1

save Command Syntax

save -simulation <snapshot_name>
     [-overwrite]

     -environment [filename]
     -commands [filename]

save Command Options

This section describes the options that you can use with the Tcl save command.

-simulation
snapshot_name

Creates a snapshot of the current simulation state. The snapshot also contains the analog control options in effect at the time of the save. This option is the default. 

You must specify a snapshot name with the save command. The snapshot name can be specified using the [lib.]cell[:view] notation, or, if you want the snapshot to be a new view of the currently loaded cell, you can specify just the view name preceded by a colon. For example, if you are simulating worklib.top:rtl,

  • save ckpt1                   Saves worklib.ckpt1:rt
  • save top:ckpt1     Saves worklib.top:ckpt1
  • save otherlib.top    Saves otherlib.top:rtl
  • save :ckpt1                 Saves worklib.top:ckpt1

The snapshot name must be a simple name containing only letters, numbers, and underscores.

By default, the saved snapshot is saved either in the library you specify or in the work library (if you do not specify a library).

-overwrite

Overwrites an existing snapshot.

-environment [filename]

Creates a Tcl script that captures the current breakpoints, databases, probes, aliases, and predefined Tcl variable values. The filename argument is optional. If no filename is specified, the script is written to standard output.

The state of the Tcl debug environment is not part of the simulation that is saved in a snapshot. To save the debug environment, you must issue a separate save -environment command. This command creates a Tcl script that captures the current breakpoints, databases, probes, aliases, and predefined Tcl variable values. You can then restore the environment by executing this script with the Tcl source command, or you can use the -input option when you start the simulator.

For example:

xcelium> save :ckpt1
xcelium> save -environment ckpt1.tcl
xcelium> restart :ckpt1
xcelium> source ckpt1.tcl

or

xcelium> -tcl cell:ckpt1 -input ckpt1.tcl)

These scripts are meant to be sourced into an empty environment (that is, an environment with no breakpoints, no probes, no databases). If you start the simulator, set some breakpoints and probes, and then source a script that contains commands to set breakpoints and probes, the simulator will probably generate errors telling you that some commands in the script could not be executed. These errors are due to name conflicts. For example, you may have set a breakpoint that received the default name "1", and the command in the script is trying to create a breakpoint with the same name. You can, of course, give your breakpoints unique names to avoid this problem. You can also edit the scripts to make them work the way you would like them to work.

-commands [filename]

save -commands is the same as save -environment.

save Command Examples

The section includes the examples of how the save command in the following scenarios: 

How to Save a Snapshot of the Current Simulation State

The following command saves the simulation state in lib . cell :ckpt1, where lib is the name of the current work library, and cell is the cell name of the currently loaded snapshot.

xcelium> save -simulation :ckpt1

The following command saves the simulation state in lib .top:ckpt1.

xcelium> save top:ckpt1

The following command saves the simulation state in lib .ckpt1: view_name, where view_name is the view name that is currently being simulated.

xcelium> save ckpt1

How to Use the save -environment Command

The following example illustrates how to use the save -environment command.The right column annotates the behavior of each command.

Commands 

Notes 

xcelium -tcl hardrive
xmsim: v2.1.(p1): (c) Copyright 1995 - 2003 Cadence Design Systems

Loading snapshot worklib.hardrive:module .... Done

Start the simulator.

xcelium> stop -create -line 32
Created stop 1
xcelium> stop -create -object hardrive.clkCreated stop 2
xcelium> probe -create -shm hardrive.data
Created default SHM database xcelium.shm
Created probe 1

Set a line breakpoint, an object breakpoint, and create a probe. The probe command creates a default SHM database.

xcelium> run
0 FS + 0 (stop 2: hardrive.clk = 0)./hardrive.v:13 clk = 0;


xcelium> run
50 NS + 0 (stop 2: hardrive.clk = 1)./hardrive.v:16 always #50 clk = ~clk;


xcelium> save -environment env1.env

Save the debug settings in a file called env1.env.

xcelium> more env1.env

set assert_report_level {note}
set assert_stop_level {error}
set autoscope {yes}
set display_unit {auto}
set tcl_prompt1 {puts -nonewline "xmsim> "}
set tcl_prompt2 {puts -nonewline "> "}
set time_unit {module}set vlog_format {%h}
set assert_1164_warnings {yes}
stop -create -name 1 -line 32 hardrive
stop -create -name 2 -object hardrive.clk
database -open -shm -into xcelium.shm xcelium.shm
-defaultprobe -create -name 1 -database xcelium.shm
hardrive.datascope -set hardrive

Look at the file contents.

xcelium> exit

Exit from the simulator.

foghorn% xmsim -tcl hardrivexcelium: v1.2.(b9): (c) Copyright 1995 - 2000 Cadence Design Systems

Loading snapshot worklib.hardrive:module .................... Done

Restart the simulator.

xcelium> stop -showNo stops set

The new session has no breakpoints.

xcelium> source env1.env

Source the env1.env file.

xcelium> stop -show1 Enabled Line: ./hardrive.v:32 (scope: hardrive)2 Enabled Object hardrive.clkxcelium> probe -show1 Enabled hardrive.data (database: xcelium.shm) -shmxcelium> database -showxcelium.shm Enabled (file: xcelium.shm) (SHM) (default)

Show the status of breakpoints, probes, and databases.

How to Use save, restart, and analog

You can use the save, restart , and analog commands during transient analysis of a mixed-signal simulation in interactive mode (under -tcl or -gui). In non-interactive mode or if there is other analysis after the transient analysis specified analog control file, these commands are ignored when the simulation has reached the analog stop time of the transient analysis.

The analog -stop option is ignored with a warning message when .probe is used in the analog control file.

The following example illustrates how to use the save, restart and analog commands in interactive mode. The right column annotates the behavior of each command.

Commands 

Notes 

xcelium> database -open waves -into waves.shm -default
Created default SHM database waves

Open a default SHM database called waves.

xcelium> probe -create -all
Created probe 1

Probe all signals in the current scope.

xcelium> stop -create -time -absolute 200ns
Created stop 1

Create a breakpoint at absolute time 200ns.

xcelium> run
200 NS + 0 (stop 1)

Run until 200ns.

xcelium> analog -show
vabstol = 1.000000e-06 (alterable)
iabstol = 1.000000e-12 (alterable)
reltol = 1.000000e-03 (alterable)
stop = 14 us (alterable)

Examine the tolerance values and stop time.

xcelium> save :ckpt1
Saved snapshot amslib.top:ckpt1

Save the first snapshot

xcelium> analog -stop 20 us

Lengthen the simulation.

xcelium> analog -reltol 5e-03

Change the reltol value.

xcelium> analog -show
vabstol = 1.000000e-06 (alterable)
iabstol = 1.000000e-12 (alterable)
reltol = 5.000000e-03 (alterable)
stop = 20 us (alterable)

Examine the new values.

xcelium> stop -create -time -absolute 400ns
Created stop 2

Create another breakpoint.

xcelium> run
400 NS + 0 (stop 2)

Run until 400ns.

xcelium> save :ckpt2
Saved snapshot amslib.top:ckpt2

Save the second snapshot.

xcelium> restart :ckpt1
Loaded snapshot amslib.top:ckpt1

Reload the first snapshot.

xcelium> analog -show
vabstol = 1.000000e-06 (alterable)
iabstol = 1.000000e-12 (alterable)
reltol = 1.000000e-03 (alterable)
stop = 14 us (alterable)

Check that tolerance values and stop time are the same values you had originally...

xcelium> time
200 NS

...and that you are back at 200ns in the simulation.

xcelium> restart :ckpt2
Loaded snapshot amslib.top:ckpt2

Now reload the second snapshot.

xcelium> analog -show
vabstol = 1.000000e-06 (alterable)
iabstol = 1.000000e-12 (alterable)
reltol = 5.000000e-03 (alterable)
stop = 20 us (alterable)

Check for the changed reltol value and the lengthened simulation.

xcelium> time
400 NS

Run to 400ns, again!

xcelium> run
200 NSRan until 600 NS + 0

Run another 200ns.

xcelium> restart :ckpt1
Loaded snapshot amslib.top:ckpt1

Switch back to the first snapshot.

xcelium> time
200 NS

Check where you are.

xcelium> run
The analog simulator has reached stop time, please use analog -stop <new stop time> to extend the analog stop time.

Simulation complete via transient analysis stoptime at time 14 US Memory Usage - 19.4M program + 13.5M data = 32.9M total CPU Usage - 0.6s system + 3.6s user = 4.2s total (1.1% cpu)

Run until analog stop time.

xcelium> analog -stop 100us

At analog stop time, you can still lengthen the simulation.

xcelium> run

The analog simulator has reached stop time, please use analog -stop <new stop time>' to extend the analog stop time.

Simulation complete via transient analysis stoptime at time 100 US

Memory Usage - 19.4M program + 13.5M data = 32.9M total CPU Usage - 0.6s system + 23.6s user = 24.2s total (1.1% cpu

Run until analog stop time.

xcelium> restart :ckpt1
Loaded snapshot amslib.top:ckpt1

At analog stop time, you can still restart a snapshot.

xcelium> exit
Number of accepted tran steps = 3161.

Initial condition solution time = 200 ms.
**** AMSD: Mixed-Signal Activity Statistics ****
Number of A-to-D events: 24
   Number of A-to-D events in IEs:            0
    Number of D-to-A events:                  16
    Number of D-to-A events in IEs:  0
    Number of VHDL-AMS Breaks:  0

Intrinsic tran analysis time = 3.5 s.

Total time required for tran analysis tran1 was 23.7 s.

Exit and complete the simulation.

Related Topics



 ⠀
X