<> <> 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.