next up previous contents index
Next: The dumpnodes Command Up: Input and Output Commands Previous: Input and Output Commands   Contents   Index


The codeblock Command

The codeblock command manipulates codeblocks.

codeblock [-options] [filename]
A codeblock is a stored executable structure derived from a script file. Being internal representations, codeblocks execute more efficiently than script files. A codeblock generally has the same name as the script file from which it was derived.

Option characters, which may be grouped or given as separate tokens, following a '-' character, are listed below.

p print the text of a block (synonym t)
d delete the block (synonym f)
a add a block
b bind the block to the ``controls'' of the current circuit
be bind the block to the ``execs'' of the current circuit
c list bound codeblocks of the current circuit

If no filename is given, and neither of the bind options is given, all of the blocks in the internal list are listed by name, and their commands are printed if p is given, and the blocks are deleted if d is given. In the latter case, the current circuit codeblock references become empty.

If no filename is given and one of the bind options is given, the respective bound codeblock reference in the current circuit is removed. Only one of b or be can be given.

In either case, if c is given, the bound codeblocks in the current circuit are listed, after other operations. The a option is ignored if no filename is given.

The bound codeblocks for the current circuit are also listed in the listing command.

Otherwise, when a name is given, the named file/block is acted on. If no option is given, the add option is assumed. Added blocks overwrite existing blocks of the same name. The options all apply if given, and the operations are performed in the order

p (if a not given)
d
a
p (if a given)
b or be
c

When a command is entered in response to a prompt or in a script (or another codeblock), the blocks are checked first, then the WRspice internal commands, then scripts, then vectors (for the implicit let in vector = something) and finally operating system commands if unixcom is set.

Thus, once a codeblock has been added, it can be executed by simply entering its name, as if it were a shell command. If a name conflicts with an internal command or script, the codeblock has precedence.

A codeblock can be ``bound'' to the current circuit with the b and be options. If be, the block is bound as an ``exec'' codeblock, and if b is given, the block is bound as a ``control'' codeblock. Each circuit has one of each type, which are by default derived from the .exec and .control statements from the circuit file. Binding an external codeblock overrides the blocks obtained from the file. If no filename was given, the existing binding is deleted from the current circuit, according to whether the b or be was given. Separate calls are required to unbind both blocks.

Note: Bound codeblocks are parameter expanded, named codeblocks are not. In a named codeblock, parameters are available through the @parmname (special vector) syntax.

Operating range and Monte Carlo analysis can make use of ``bound'' codeblocks. In both types of analysis, the ``controls'' codeblock execution sets a variable indicating whether the circuit simulated properly according to user specified criteria. When a margin analysis file is input, the lines between .control and .endc become the default controls codeblock. Similarly, the lines between .exec and .endc become the default exec codeblock. A bound codeblock will always supersede the default codeblock.


next up previous contents index
Next: The dumpnodes Command Up: Input and Output Commands Previous: Input and Output Commands   Contents   Index
Stephen R. Whiteley 2024-10-26