Sinix.mesa 
Copyright © 1985, 1986 by Xerox Corporation. All rights reversed.
Created by Bertrand Serlet August 15, 1985 11:14:27 am PDT
Bertrand Serlet December 8, 1986 7:20:47 pm PST
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;
Sinix: CEDAR DEFINITIONS = BEGIN
Theory
Sinix (reduced Spinifex) is an extractor taking 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.
This interface defines what is the result of the extraction, and a few functions to manipulate or create the Core Data Structure.
The extractor promotes public all internal wires that cross the cell boundary (for cells).
As ever
CellType: TYPE = Core.CellType;
Wire: TYPE = Core.Wire;
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.
ExtractAbut: ExtractProc;
A faster proc than ExtractCell for objects of type PWObjects.abut*Class
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 $InstanceName property and 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 its own geometry.
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 (see CoreGeometry.FlattenAtomic) which extract as one electric component.
Result is a Wire decorated with its own geometry.
Name of the wire is taken from the $InstanceName property and satellites. Only one name source is allowed.
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
equalProc: PROC [Object, CD.PropList, REF, CD.PropList, REF] RETURNS [BOOL],  -- called with the properties and userData for the previous call and the ones 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 [CD.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.
];
LayerRange: TYPE = RECORD [min, max: NAT];
min and max are included
FusionByNameMethod: TYPE = {layout, none, schematics};
AlwaysFalse: PROC [obj: CD.Object, properties1: CD.PropList, userData1: REF, properties2: CD.PropList, userData2: REF] RETURNS [BOOLFALSE];
CompareProps: PROC [obj: CD.Object, properties1: CD.PropList, userData1: REF, properties2: CD.PropList, userData2: REF] RETURNS [BOOL];
DefaultInstanceLayer: PROC [CD.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, actual, subPublic: Wire];
name is the name of the object being extracted.
wire and subPublic are the two wires that have mismatching structures.
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].
Private details
SisyphCmdsImpl depends on the way Sinix caches extraction. It is obviously wrong, and will be removed as soon as possible.
Cache: PRIVATE TYPE = REF CacheRec;
CacheRec: PRIVATE TYPE = RECORD [
mode: Mode, properties: CD.PropList ← NIL, userData: REFNIL,
result: REF, props: Properties ← NIL
];
cacheProp: PRIVATE ATOM;
FuseProperties: PRIVATE PROC [mode: Sinix.Mode, fused, root: Wire, name: ROPE];
name is the name of the cell being extracted.
May raise FusionPropMismatch.
END.