Sinix.mesa 
Copyright Ó 1985, 1986, 1987 by Xerox Corporation. All rights reversed.
Created by Bertrand Serlet August 15, 1985 11:14:27 am PDT
Bertrand Serlet September 15, 1987 7:23:40 pm PDT
Pradeep Sindhu December 2, 1985 6:42:37 pm PST
Jean-Marc Frailong June 20, 1986 7:15:22 pm PDT
DIRECTORY CD, Core, CoreGeometry, IO;
Sinix: CEDAR DEFINITIONS = BEGIN
Theory
Sinix is an multi purpose extractor that coverts pictures into meaningful Core data structures. Sinix takes into account properties on the layout to produce a Core description with enough back-pointers to the geometry to be able to do DRC, compute strays for the circuit simulator, or generate geometric information for the router. The data structure resulting of extraction, Decorated Core, is described by the interface CoreGeometry.
The extractor promotes public all internal wires that cross the cell boundary (for cells), and may be others (depending on the Mode).
As ever
CellType: TYPE = Core.CellType;
Wire: TYPE = Core.Wire;
WireSeq: TYPE = Core.WireSeq;
Wires: TYPE = Core.Wires;
Object: TYPE = CD.Object;
Properties: TYPE = Core.Properties;
ROPE: TYPE = Core.ROPE;
Extraction Framework
ExtractProc: TYPE = PROC [obj: Object, mode: Mode, properties: CD.PropList ← NIL, userData: REFNIL] RETURNS [result: REF, props: Properties ← NIL];
The atom extractProcProp is the property that users can set on objects, instances or on object classes. Its value is an ATOM corresponding to a registered ExtractProc. The dispatch function Extract uses it, and is soforth programmed in an Object Oriented style.
The result must be one of the following:
- NIL. The object should be forgotten completely.
- a Wire. The returned wire is decorated with mode.decoration.pinsProp. There might be a name. The returned wire is always copied by Sinix, so caching should not be feared... Dagness is considered.
- a LIST OF Wire. The returned wires are decorated with mode.decoration.pinsProp. There might be a name. The returned wire are always copied by Sinix, so caching should not be feared... Dagness is considered across returned wires.
- a CellType. The returned cellType has its public decorated with mode.decoration.
Properties is passed recursively to allow access to instances properties, and the returned props allows putting properties on CellInstances (props on Wire are discarded) (pending problem for Wire properties ...).
An arbitrary REF (userData) is passed recursively.
Extract: ExtractProc;
First looks for the cache on the object, and returns it if found. Otherwise a search for the ExtractProc to apply is made, first by searching for extractProcProp on the given properties, then on the object, and finally on the object class. If no proc is found, calls ExtractExpand.
Object satellites are added to the Object properties under the key satellitesProp.
Caching is done (but clients can also do their own caching).
RegisterExtractProc: PROC [key: ATOM, extractProc: ExtractProc];
Each ExtractProc must be registered, in order to be useful!
Basic ExtractProcs
All the following ExtractProcs are registred under the atom named as the proc (i.e. ExtractCell has been registred with the key $ExtractCell). For "less global" extract functions, the convention is the prefix the name of the atom with the name of the module defining the ExtractProc.
ExtractCell: ExtractProc;
The interesting one!
Instance satellites are added to the sub-instance properties under the key satellitesProp.
Uses the object cache.
ExtractAbut: ExtractProc;
A faster proc than ExtractCell for objects of type PW.abut*Class.
Uses the object cache.
ExtractRotation: ExtractProc;
A faster proc than ExtractCell for objects of type PW.rotationClass
ExtractExpand: ExtractProc;
Expands the object and calls again Extract.
ExtractRect: ExtractProc;
For rectangles which extract as one electric component.
Result is a Wire decorated with its own geometry.
Name of the wire is taken from the $SignalName property and from satellites. Only one name source is allowed.
If layer is shadeLayer, errorLayer, backgroundLayer, outlineLayer, selectionLayer or commentLayer, result is NIL.
ExtractPin: ExtractProc;
For symbolic objects such as pins, segments or marks.
Result is a Wire decorated with a special variety of Symbolic Object.
The wire gets the name of the symbolic object.
It is an error to have satellites (object or instance satellite) on such an object.
ExtractAtomic: ExtractProc;
Used for primitive objects which extract as one electric component.
Result is a Wire decorated with its own geometry.
Name of the wire is taken from the $SignalName property and from satellites. Only one name source is allowed.
ExtractWellAtomic: ExtractProc;
Used for primitive objects which extract as two electric components.
Result is a list of two Wires decorated with their corresponding geometry (well / non well).
Name of the paint wire is taken from the $SignalName property and from satellites. Only one name source is allowed.
ExtractTransistor: ExtractProc;
Uses Saguaro to extract transistors in a technology independent manner.
ExtractRouting: ExtractProc;
Extracts routing cells in a very lazy way.
ExtractTiling: ExtractProc;
Extracts tiling cells by watching neighbors.
Uses the object cache.
ExtractIndirect: ExtractProc;
Used for indirect objects extraction.
ExtractCellAsWire: ExtractProc;
Can be used for extracting a whole CD cell as a Core Wire, decorated with all the instances of the CD Cell. Useful for Pads. Wizards only.
ExtractNull: ExtractProc;
Used for all objects that are invisible when extracted.
Extraction mode
Extraction is technology-independent, and even better Mode-independent. However decorations must be different for every mode, and so there is a Mode argument in this Mode-independent extractor ...
Mode: TYPE = REF ModeRec;
ModeRec: TYPE = RECORD [
decoration: CoreGeometry.Decoration,
to store/retrieve decorations
extractProcProp: ATOM,
must be the key of an ExtractProc previously registered.
The name of this property appears in numerous designs and so should not be changed.
instanceEqualProc: PROC [Object, CD.PropList, REF, CD.PropList, REF] RETURNS [BOOL],
called with the properties and userData for the previous call to Extract and the ones for this call and returns TRUE if they are "Equal".
objectEqualProc: PROC [Object, REF, REF] RETURNS [BOOL],
called with the userData for the previous call to ExtractCell and brothers and the one for this call and returns TRUE if they are "Equal".
nbOfLayers: NAT ← 1,
determines the number of interesting layers corresponding to subinstances of obj. Efficiency hack: should be defaulted for clients unaware of implementation details.
instanceLayer: PROC [CoreGeometry.Instance] RETURNS [LayerRange],
determines the [min .. max] layers corresponding to a subinstance of obj. Efficiency hack: should be set to DefaultInstanceLayer for clients unaware of implementation details.
userData: PROC [CD.Design] RETURNS [REF] ← NIL,
Return the default user data according to current design (used by Sisyph)
fusionByName: FusionByNameMethod ← layout,
Specifies which kind of fusion by name should be done [this is slightly orthogonal to the concept of mode-independent extraction, but life is hard].
touchProc: CoreGeometry.TouchProc,
Specifies if two decorations touch and provoke a geometric fusion.
nameProc: PROC [Object, REF] RETURNS [ROPE]
Returns the name of the object.
];
LayerRange: TYPE = RECORD [min, max: NAT];
min and max are included
FusionByNameMethod: TYPE = {layout, none, schematics};
AlwaysTrue: PROC [Object, REF, REF] RETURNS [BOOLTRUE];
CompareProperties: PROC [obj: Object, properties1: CD.PropList, userData1: REF, properties2: CD.PropList, userData2: REF] RETURNS [BOOL];
DefaultName: PROC [obj: Object, userData: REF] RETURNS [ROPE];
DefaultInstanceLayer: PROC [CoreGeometry.Instance] RETURNS [LayerRange];
satellitesProp: ATOM;
Value (of type LIST OF ROPE) contains the satellites. That way, satellites are passed around as part as the properties.
Exceptions
Extract functions, in particular ExtractCell, may raise the following exceptions.
InternalBug: SIGNAL [name: ROPE];
Please notify maintainors.
name is the name of the object being extracted (if available).
CallerBug: SIGNAL [];
Something is obviously wrong in client code.
FusionPropMismatch: SIGNAL [name: ROPE, prop: ATOM, value1, value2: REF];
name is the name of the object being extracted.
prop is the property for which the mismatch occurs.
value1 and value2 are the values mismatching.
FusionStructureMismatch: SIGNAL [name: ROPE, wire1, wire2: Wire];
name is the name of the object being extracted.
wire1 and wire2 are the two wires that have mismatching structures.
StructureMismatch: SIGNAL [name: ROPE, index: NAT, actual, subPublic: WireSeq];
name is the name of the object being extracted.
wire and subPublic are the two wires that have mismatching structures in the instance index.
FusionByNameMismatch: SIGNAL [name, msg: ROPE, wire: Wire];
name is the name of the object being extracted.
msg is the error message when fusing by name.
wire is the wire being considered.
StructuralLoop: SIGNAL [name: ROPE, wire: Wire];
name is the name of the object being extracted.
wire is the wire that provokes a loop in the Wire structure [probably].
Icon class
An icon cell type has the same Core data structure as some other cell type but has a new property list.
iconClass: Core.CellClass;
CreateIcon: PROC [cellType: CellType, name: ROPENIL, props: Core.Properties ← NIL] RETURNS [icon: CellType];
Private details
PutF: PROC [format: ROPE, v1, v2, v3, v4, v5: IO.Value ← [null[]]];
Like IO.PutF, but pays attention to internal flag for redirecting Extract progress report.
FlushCache: PROC [obj: Object];
Sinix Caches are stored on objects.
NameFromSatellites: PROC [obj: Object, properties: CD.PropList] RETURNS [name: ROPENIL];
Returns a name from the satellites or the $SignalName property.
Might raise FusionPropMismatch.
FuseProperties: PRIVATE PROC [mode: Sinix.Mode, fused, root: Wire, name: ROPE];
name is the name of the cell being extracted.
May raise FusionPropMismatch.
END.