Magic VLSI Layout Tool Version 8.3 *

port


Declare a label to be a subcircuit port, or manipulate port parameters.

Usage:

port [name|index] option

where option may be one of the following:
index directions
Declare a label to be a port with order number index and with allowed connection directions specified by the list directions. This is equivalent to the make option, except that the index and direction must be specified.
class [type]
Get [set] port class type (see Summary, below).
use [type]
Get [set] port use type (see Summary, below).
shape [type]
Get [set] port shape type (see Summary, below).
index [number] [-force]
Get [set] port number. All ports with the same name as the selected port are given the same number. If number is already used by a port with a different name, then the command refuses to change the index, unless -force is given, in which case all other ports with index number or higher are moved up by one, keeping their order.
name [name]
Get [set] port name. This is equivalent to setlabel text.
first
Return the first (lowest) port number used
next [number]
Return the next (higher) port number used after port number if specified, or after the currently selected port if not specified. If number or the currently selected port is the last port number used, then this command returns the value -1.
last
Return the last (highest) port number used.
connections [directions]
Get [set] port connection directions
make [index] [directions]
Declare a label to be a port with order number index and with allowed connection directions specified by the list directions. If not specified, the index is set to the index of an existing port with the same name, if there is one, or else to the first unused number, starting with 1. An index that belongs to a port with a different name, or that differs from the index of an existing port with the same name, is refused. The direction defaults to the direction of the label text. That is, if the label text is drawn to the right of the port, then connections are allowed to the right side of the port.
remove
Turn a port back into an ordinary label, removing all of its port properties.
renumber
Renumber all of the (unique) ports in the edit cell by alphabetical order of the port label text. This will ensure that the order of ports in a SPICE netlist generated by "extract" and "ext2spice" will always be the same and not depend on artifacts of the way the cell is extracted.
check
Report any port name that has more than one index, and any port index that is used by more than one port name, in the edit cell. Returns the number of such errors.
help
Print help information

Summary:

The port command turns labels into ports and manipulates the properties of those ports. The port command gives magic some understanding of "standard cells". A cell definition that contains declared ports is treated specially by the extract, ext2spice, lef, and def commands. All other commands interpret ports as ordinary labels. ext2spice only interprets ports specially if the option ext2spice subcircuits on is enabled. Cells that contain port labels are assumed in these cases to be standard cells, that is, cells which are pre-characterized, and for which the layout is not to be interpreted as a physical circuit. When writing SPICE output, a cell containing port labels that is a descendent cell of the top-level layout is written as a subcircuit call, that is, an "X" record. If the top-level cell in the layout contains ports, then the SPICE output is written as a subcircuit definition, that is, wrapped in a ".subckt . . . .ends" pair. For LEF files, a cell that contains ports is written as a macro cell, and the ports are the declared PINs of the macro. For DEF files, a cell that contains ports is written as a COMPONENT.

The "index" property of the port is used only when the cell is written into a SPICE deck as a subcircuit entry, when the ext2spice subcircuit on option is enabled (which it is by default). In that case, the subcircuit call parameters (nodes) are written in the order of the port indices, which are then assumed to match the definition for the subcircuit. Likewise, if the circuit is written as a subcircuit to a SPICE file, the order of parameters in the subcircuit definition will match the order of the port indices. Note that the actual port numbers are ignored; the port values will be written in ascending order starting with the lowest numbered port and ending with the highest numbered port.

Each port name must have exactly one index, and each index must belong to exactly one port name. Several labels may share the same port name and index; these are all part of the same port. If two different names share an index, then one of them is dropped from the subcircuit in the SPICE netlist, and if the same name has two different indexes, then one of the indexes is lost, leaving the subcircuit with too few ports. Neither problem is otherwise reported by the netlister, and both are hard to diagnose in LVS. Magic reports either problem when a cell is read, when it is extracted, and on the command port check. The port index and port make commands do not allow either problem to be created.

The "direction" property of the port has no particular meaning to magic but may be used by other programs to control the allowed direction of routes into a standard cell. The "direction" value should be a string containing one or more of the compass directions n, s, e, and/or w. The default direction when not specified is all four directions, nsew.

The "class", "use", and "shape" properties of the port have no internal meaning to magic but are used by the LEF and DEF format read and write routines, and match the LEF/DEF CLASS, USE, and SHAPE properties for macro cell pins. Valid classes are: default, input, output, tristate, bidirectional, inout, feedthrough, and feedthru. Valid uses are: default, analog, signal, digital, power, ground, and clock. Valid shapes are: default, abutment, ring, and feedthrough or feedthru.

Normally the port command operates on a selected label. However, use of the optional name or index value in front of the command option will cause the command to operate on the given label as determined by the label text (name) or port index (index). In the case of an invalid name or index, the command returns a null value (empty string) and prints an error message. If the command ends with the "-quiet" option, then no error message is printed.

Implementation Notes:

port is implemented as a built-in command in magic.

See Also:

label
lef

Return to command index

Last updated: November 11, 2021 at 10:13am