LichenPads.Mesa
Last tweaked by Mike Spreitzer on July 1, 1988 10:21:40 am PDT
DIRECTORY AbSets, BiRelBasics, BiRels, FS, IntStuff, IO, LichenDataOps, LichenDataStructure, LichenIntBasics, Rope, SetBasics;
LichenPads: CEDAR PROGRAM
IMPORTS AbSets, BiRels, FS, IO, LichenDataOps, LichenDataStructure
=
BEGIN OPEN IS:IntStuff, LIB:LichenIntBasics, LIB, LichenDataStructure, LichenDataOps, Sets:AbSets;
ReadSteppyNameSet: PROC [fileName: ROPE] RETURNS [found: BOOL, set: Set] ~ {
in: IO.STREAM ~ FS.StreamOpen[fileName !FS.Error => GOTO DontExist];
found ← TRUE;
set ← Sets.CreateHashSet[steppyNameSpace];
DO
[] ← in.SkipWhitespace[];
IF in.EndOf[] THEN EXIT;
{asRope: ROPE ~ in.GetRopeLiteral[];
steppy: SteppyName ~ ParseSteppyName[asRope];
[] ← set.AddElt[SnV[steppy]];
}ENDLOOP;
in.Close[];
RETURN;
EXITS DontExist => {found ← FALSE; set ← nilSet}};
ExtractNamed: PROC [ct: CellType, names: Set] RETURNS [newPorts: Set] ~ {
wires: Set ~ ct.fullName[w].Image[names, rightToLeft].CreateHashCopy[];
IF wires.Size # names.Size THEN ERROR;
newPorts ← FullySfwdlyExportWires[ct, wires];
RETURN};
ExtractPads: PROC [d: Design] RETURNS [exCells: BiRel, newPorts: Set] ~ {
ct: CellType ~ d.root;
padTypeNames: Set ~ Sets.RopesMatching[["pad*", FALSE, star]];
padTypes: Set ~ d.ctName.Image[padTypeNames, rightToLeft].CreateHashCopy[];
pads: Set ~ d.ciType.Image[padTypes, rightToLeft].Intersection[ct.Subcells].CreateHashCopy[];
ex: BiRel ~ d.ciType.Intersection[BiRels.CreateProduct[[pads, padTypes]]];
wires: Set ~ d.iwConns.Image[pads].CreateHashCopy[];
exCells ← ct.fullName[i].Invert.Compose[ex.Compose[d.ctName, [TRUE, FALSE]], [FALSE, TRUE]].CreateHashCopy[];
newPorts ← FullySfwdlyExportWires[ct, wires];
DeleteInsts[d, pads, TRUE];
RETURN};
END.