#

## 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]
> >   Get [set] port number
> > 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.
> > equivalent [number]
> >   Make the port equivalent to the (other) port numbered number.
> > 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 first unused number, starting with 1, and 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.
> > 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.

> 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