#

## xor

Perform exclusive-or between the current cell and the indicated destination cell. The destination cell is overwritten with the result.

### Usage:

> xor [option] cellname

> > where cellname is the name of a cell definition to be compared against, and into which the compared geometry will be placed. option may be one of -nolabels, -nosubcircuit, or -novendor, similar to the "flatten" command.

### Summary:

> The xor command compares the current edit cell against the target cell cellname by flattening and exclusive-or, replacing the target cell paint as it works. The result is an empty cell if the two cells have exactly the same geometry; otherwise, paint remains in the target cell where the geometry of the current edit cell does not match the geometry of the target cell.

> The target cell is assumed to be flattened already. That is, to compare hierarchical layout layout1 to hierarchical layout layout2, one would normally do:

> > `load layout1`
> > `flatten dest`
> > `load layout2`
> > `xor dest`

> This will result in cell dest containing geometry mismatches between cell layout1 and cell layout2.

> The options allow selective flattening, as follows:

> -nolabels
>   Prevents magic from copying labels into the flattened cell. Otherwise, magic flattens labels by prepending the cell hierarchy to each label as it copies it into the flat cell.
> -nosubcircuit
>   Prevents magic from flattening cells declared to be subcircuits (by the presence of ports in the cell). These cells are retained as subcells in the flattened version.
> -novendor
>   Prevents magic from flattening cells that are vendor cells, that is, cells that are generated by reading GDS using the gds readonly option, or which have the appropriate property values set.
> In effect, xor is just the command flatten called with a special paint translation table that erases paint in the target when painted with the same type from the source.

> Note that cellname is a top-level cell but is not displayed or saved subsequent to the xor command. The usual procedure is to follow the command "xor cellname" with "load cellname", to view the new compared layout.

> Also note that a technology file's paint and erase tables can interfere with strict XOR function results. Typical paint and erase rules will tend to generate a result that is useful for a yes-no answer (cells either match or not), and for finding places in mismatched cells where differences occur. But it may not be possible to determine exactly what the difference is from the xor output. For a "proper" XOR function, use a techfile that does not have interacting types and planes, and draws contact cuts on separate planes rather than using magic's contact types (which automatically have interacting paint and erase rules).

### Implementation Notes:

> xor is implemented as a built-in command in magic, available from magic version 8.1.64.

Return to command index

Last updated: March 7, 2020 at 1:06pm