LichenDataImpl1C.Mesa
Last tweaked by Mike Spreitzer on July 16, 1988 9:19:24 pm PDT
DIRECTORY AbSets, BasicTime, BiRels, Convert, IntStuff, LichenDataStructure, LichenIntBasics, List, Rope, SetBasics;
LichenDataImpl1C: CEDAR PROGRAM
IMPORTS BiRels, IntStuff, SetBasics
EXPORTS LichenDataStructure
=
BEGIN OPEN IB:LichenIntBasics, IB, LichenDataStructure, Sets:AbSets;
ClassOfPart: PUBLIC PROC [part: Part] RETURNS [PartClass] ~ {
WITH part SELECT FROM
p: Port => RETURN [p];
w: Wire => RETURN [w];
ci: CellInstance => RETURN [i];
ENDCASE => ERROR};
Sub: PUBLIC PROC [d: Design, x: PW, i: LNAT] RETURNS [PW] ~ {
kids: Seq ~ BiRels.DeRef[d.sub.ApplyA[x].MA];
RETURN [kids.ApplyI[i].MA]};
PWRank: PUBLIC PROC [d: Design, x: PW] RETURNS [NAT] ~ {
mv: Sets.MaybeValue ~ d.sub.ApplyA[x];
IF NOT mv.found THEN RETURN [0];
{kids: Seq ~ BiRels.VB[mv.it];
max: NAT ← 0;
FOR i: INT IN [0 .. kids.Size.EN) DO
kid: PW ~ kids.ApplyI[i].MA;
max ← MAX[max, PWRank[d, kid]];
ENDLOOP;
RETURN [max + 1]}};
Start: PROC ~ {
RETURN};
Start[];
END.