PipalSinix.mesa
Copyright Ó 1985, 1986, 1987, 1988 by Xerox Corporation. All rights reversed.
Created by Bertrand Serlet August 15, 1985 11:14:27 am PDT
Bertrand Serlet April 15, 1988 10:58:20 pm PDT
Pradeep Sindhu December 2, 1985 6:42:37 pm PST
Jean-Marc Frailong June 20, 1986 7:15:22 pm PDT
DIRECTORY
Core, CoreClasses, IO,
Pipal, PipalConnect, PipalCore,
RefTab;
PipalSinix: 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 PipalCore.
The extractor promotes public all internal wires that cross the cell boundary (for cells), and may be others (depending on the Mode).
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;
layoutMode: Mode;
Default extraction mode for layout.
schematicsMode: Mode;
Default extraction mode for schematics.
rawLayoutMode: Mode;
Raw extraction mode for layout.
Extraction
Context: TYPE = REF;
ExtractProc:
TYPE =
PROC [object: Pipal.Object, mode: Mode, context: Context ←
NIL]
RETURNS [result:
REF, props: Core.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 Core.Wire. The returned wire is decorated with mode.decoration.portsProp. There might be a name. The returned wire is always copied by Sinix, so caching should not be feared... Dagness is considered. props must be NIL.
- a LIST OF Core.Wire. The returned wires are decorated with mode.decoration.portsProp. 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. props must be NIL.
- a Core.CellType. The returned cellType has its public decorated with mode.decoration. Returned props allows putting properties on CellInstances.
An arbitrary REF (context) is passed recursively.
Extract: ExtractProc;
First looks for the cache on the object, and returns it if found. Otherwise the mode.extractMethod is applied to the object. If no method is found, ExtractConnectized is applied instead.
Some ExtractProcs
Annotations allow special extraction when the key is mode.extractAnnotationProp. Then the value must be an atom correponding to a registered ExtractProc.
RegisterExtractProc:
PROC [key:
ATOM, extractProc: ExtractProc];
Each ExtractProc must be registered, in order to be annotated.
FetchExtractProc:
PROC [key:
ATOM]
RETURNS [extractProc: ExtractProc ←
NIL];
All the following ExtractProcs are registred under the atom named as the proc (i.e. ExtractNull has been registred with the key $ExtractNull). For "less global" extract functions, the convention is the prefix the name of the atom with the name of the module defining the ExtractProc.
ExtractConnectized: ExtractProc;
Connectizes and extracts according to the connector type.
ExtractCellAsWire: ExtractProc;
Used for primitive objects which extract as one electric component.
ExtractNull: ExtractProc;
Used for all objects that are invisible when extracted.
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: Core.CellType, name: Core.ROPE ← NIL, props: Core.Properties ← NIL] RETURNS [icon: Core.CellType];
Exceptions
Extract functions, in particular ExtractCell, may raise the following exceptions.
InternalBug:
SIGNAL [];
Please notify maintainors.
CallerBug:
SIGNAL [];
Something is obviously wrong in client code.
FusionPropMismatch:
SIGNAL [object: Pipal.Object, prop:
ATOM, value1, value2:
REF];
object is the object being extracted.
prop is the property for which the mismatch occurs.
value1 and value2 are the values mismatching.
FusionStructureMismatch:
SIGNAL [object: Pipal.Object, wire1, wire2: Core.Wire];
object is the object being extracted.
wire1 and wire2 are the two wires that have mismatching structures.
StructureMismatch:
SIGNAL [object: Pipal.Object, index:
NAT, actual, subPublic: Core.WireSeq];
object is the object being extracted.
wire and subPublic are the two wires that have mismatching structures in the instance index.
FusionByNameMismatch:
SIGNAL [object: Pipal.Object, msg: Core.
ROPE, wire: Core.Wire];
object is the object being extracted.
msg is the error message when fusing by name.
wire is the wire being considered.
StructuralLoop:
SIGNAL [object: Pipal.Object, wire: Core.Wire];
object is the object being extracted.
wire is the wire that provokes a loop in the Core.Wire structure [probably].
Mode Details
ModeRec:
TYPE =
RECORD [
decoration: PipalCore.Decoration,
to store/retrieve decorations
extractMethod: Pipal.Method,
must be the method of an ExtractProc previously registered.
connectMode: PipalConnect.Mode,
extractAnnotationProp: ATOM,
objectEqual:
PROC [Pipal.Object, Context, Context]
RETURNS [
BOOL],
called with the context for the previous call to ExtractCell and brothers and the one for this call and returns TRUE if they are "Equal".
postProcessFused: PostProcessProc
PostProcessProc:
TYPE =
PROC [mode: Mode, object: Pipal.Object, context: Context, fused: RefTab.Ref, instances:
LIST
OF CoreClasses.CellInstance];
SchematicsFusionByName:
PUBLIC PostProcessProc;
CreateRoot: PROC [fused: RefTab.Ref, size: NAT] RETURNS [wire: Core.Wire];
RootWire: PROC [fused: RefTab.Ref, wire: Core.Wire] RETURNS [rootWire: Core.Wire];
EnumerateRoots: PUBLIC PROC [fused: RefTab.Ref, each: PROC [wire: Core.Wire]];
StructuredFusion: PROC [mode: Mode, object: Pipal.Object, fused: RefTab.Ref, wire1, wire2: Core.Wire] RETURNS [wire: Core.Wire];
Other Private Details
PutF:
PROC [format: Core.
ROPE, v1, v2, v3, v4, v5:
IO.Value ← [null[]]];
Like IO.PutF, but pays attention to internal flag for redirecting Extract progress report.
NonCachingExtract:
PRIVATE ExtractProc;
ExtractProc that does not cache its results.
Can be used for implementing an ExtractProc needing to call recursively Extract and then to modify in place the result.
Of course, use with care!
END.