Product Documentation
Spectre Classic Simulator, Spectre APS, Spectre X, Spectre XPS, Spectre FMC Analysis, and Legato Reliability Solution User Guide
Product Version 23.1, September 2023

20


Managing Files

This chapter discusses the following topics:

About Spectre Filename Specification

Many analysis statements require a filename as a parameter value for the input or output of data. It is often easier to keep track of output files if these filename parameter values are related to some other filename, typically the input filename.

The Spectre® circuit simulator’s filename specification features help you manage your data by letting you systematically specify or modify filenames. With the Spectre simulator, you can easily identify data from multiple simulation runs or from single runs containing repeated similar analyses. You can modify input filenames so that you can easily identify the output file from a specific simulation or analysis. You can also construct output filenames in ways that prevent accidental overwriting of data.

Creating Filenames That Help You Manage Data

The Spectre simulator helps you keep track of simulation data by letting you create filenames that are variants of input filenames. For example, with Spectre, you can

In this section, you will learn how to use the various Spectre features for creating filenames.

Creating Filenames by Modifying Input Filenames

The Spectre simulator gives you predefined percent codes you can put in your filenames. These predefined codes let you construct filenames that add defining characteristics, such as date or time, to input filenames. You specify predefined percent codes with a percent character (%) followed by an uppercase letter. The uppercase letter tells the Spectre simulator how to construct the filename. You can use percent codes in environment variables, in spectre command parameters, or in your netlist—wherever you need to specify filenames for simulation results.

For example, %C is the predefined percent code for the name of the input circuit file. If your circuit file is named opamp1 and you place the following -raw setting for your UNIX environment variable

setenv SPECTRE_DEFAULTS "-raw %C.raw" 

the Spectre simulator sends simulation results to the directory named opamp1.raw.

Description of Spectre Predefined Percent Codes

These are the percent code that can help you organize your simulation data:

%A

%A is replaced by the name of the current analysis that is running.

If it is specified in a device statement, it is expanded to a blank string because there is no current analysis.

%B

%B is replaced by 64bit for 64-bit version of the software.

%C

%C is replaced by the input circuit filename, as it is used in the command line. If the circuit filename is opamp1, the specification %C.raw generates a file named opamp1.raw.

When the Spectre simulator does not know the name of the input file, as when the circuit is read from the standard input (from a pipe or from a redirected file), the Spectre simulator substitutes the name stdin for %C.

%D     

%D is replaced by the date when the program started. For example, the specification %D.opamp1 might generate a file named 94-09-19.opamp1.

The date is in year-month-day format. All leading zeros are included. This format generates filenames that you can sort alphabetically into chronological order.

%F

%F is replaced by the completed analysis name. For example, if you have file named mc1-005_dc1, the specification spectre_%F.dc will expand to spectre_mc1-005_dc1.dc.

%H

%H is replaced by the host name (network name) of the system on which the Spectre simulator is running.

%M

%M is replaced by the current CMIVersion.

%P

%P is replaced by the process ID.

The process ID is a unique integer assigned to the Spectre process by the operating system.

%S

%S is replaced by the simulator name. For example, the specification %S.opamp1 might generate a file named spectre.opamp1.

If you use a different name or a symbolic link with a different name to access a copy of the executable program, the new name becomes the program name.

%T

%T is replaced by the time when the program started. For example, the specification %T.opamp1 might generate a file named 14:44:07.opamp1.

Time is in 24-hour format, and all leading zeros are included. This format generates filenames that sort alphabetically into chronological order.

%V

%V is replaced by the simulator version string. For example, the specification out_%V.raw might generate a file named out_1.0.2.raw.

%I

%I is replaced by the installation directory.

%O

%I is replaced by the operating platform.

%U

%U is replaced by the username.

%%

This specifies the % character by itself.

This option lets you use percent characters in filenames. Two percent characters (%%) in a filename specification produce a single percent character in the filename, which is not interpreted as a percent code indicator.    

The predefined percent codes feature does not perform recursive substitutions. For example, if you have an input file named A%SD.xyz and you create an output file with the percent code designation %C.raw, the Spectre simulator creates the output file A%SDxyz.raw. The Spectre simulator does not substitute the simulator name for %S in this case.

Customizing Percent Codes

You can define your own percent codes or redefine existing codes with the +%<X> option of the spectre command. Names of customized percent codes can be any single uppercase or lowercase letter. You can define percent codes in two ways:

For example, if you type in the following instruction at the command line

spectre +%E opamp1 test3

the Spectre simulator runs a simulation for circuit test3. During this simulation, the Spectre simulator substitutes the name opamp1 for any %E it finds in results filename specifications.

You undefine customized percent codes with the -%<X> spectre command option. For example, if you customize percent codes with the SPECTRE_DEFAULTS environment variable, you might want to undefine them for a given simulation run. To do this, you include the -%<X> command line option in the spectre command that starts the simulation. Undefined percent codes return to predefined values. If an undefined percent code has no predefined value, it is treated like an empty string.

Creating Filenames from Parts of Input Filenames

Colon modifiers (:x) create filenames from parts of input filenames. You can use colon modifiers with all percent codes except the %% code.

For example, if you apply %C:r.raw to the input filename opamp.ckt

%C is the input filename (opamp.ckt)

:r is the root of the input filename (opamp)

.raw is the new filename extension

The result is the output filename opamp.raw. In this example, (:r) is the colon modifier.

Definitions of Colon Modifiers

The Spectre simulator recognizes the following colon modifiers:

Modifier Description

:r

Signifies the root (base name) of the given path for the file

:e

Signifies the extension for the given path of the file

:h

Signifies the head of the given path for any portion of the file before the last /

:t

Signifies the tail of the given path for any portion of the file after the last /

::

Signifies the (:) character itself; use two consecutive colons (::) to place a single colon in an output filename that is not read as a percent code modifier

Any character except a modifier after a colon (:) signals the end of modifications. The Spectre simulator appends both the colon and the character to the filename.

The Spectre simulator applies a chain of colon modifiers in the sequence you specify them. For example, if you apply %C:e.%C:r:t to the input filename
/circuits/opamp.ckt

%C:e is the extension (ckt) of the input filename

%C:r is the root (/circuits/opamp) of the input filename

:t is the tail of the input filename after the last / (opamp.ckt)

The result is the output filename ckt.opamp.

If the input filename does not contain a slash and a period, the modifiers :t and :r return the whole filename, and the modifier :h returns a period.

Examples of Colon Modifier Use

The following table shows the various filenames you can generate from an input filename (%C) of /users/maxwell/circuits/opamp.ckt:

Colon Modifier Comments Output Filename Result

%C

Input filename

/users/maxwell/circuits/opamp.ckt

%C:r

Root of the input filename

/users/maxwell/circuits/opamp

%C:e

Extension of the input filename

ckt

%C:h

Head of the input filename

/users/maxwell/circuits

%C:t

Tail of the input filename

opamp.ckt

%C::

Second colon is appended to the input filename and the end of the modification

/users/maxwell/circuits/opamp.ckt:

%C:h:h

The head of %C:h (such a recursive use of :h might be useful if you want to direct your output to a different directory from that of the input file)

/users/maxwell

%C:t:r

The root of %C:t

opamp

%C:r:t

The tail of %C:r

opamp

/tmp%C:t:r.raw

The suffix .raw is appended to the root of %C:t, and the full path is altered to put opamp.raw in the
/tmp file.

/tmp/opamp.raw

%C:e.%C:r:t

Extension of %C followed by the tail of %C:r

ckt.opamp


Return to top
 ⠀
X