IPPlaceKit:
CEDAR
DEFINITIONS =
BEGIN
Components: TYPE = LIST OF IPCoTab.Component;
-- Types Declarations used in definition of IPPlaceProcs
DepthBreadthRec: TYPE = RECORD[depth, breadth: NAT];
OrderingFn:
TYPE =
PROC[top: IPTop.Ref]
RETURNS [Components,
LIST
OF DepthBreadthRec];
--Order the components to be placed and specify depth and breadth for PlaceComps
PlaceEvaluator:
TYPE =
PROC[top: IPTop.Ref, yetToPlace: Components, cutOff:
INT ←
LAST[
INT]]
RETURNS [value:
INT, prune:
BOOL ←
FALSE];
--Geometrize top and compute figure of merit (value)
-- yetToPlace # NIL => Just Geometrize, need not compute value
-- cutOff is use to do pruning
PlaceCompTGen:
TYPE =
PROC[top: IPTop.Ref, toPlace: Components]
RETURNS [OrderedRefArray.Ref];
--Only place 1 comps, but pass in all components to be placed eventually to
-- give more information to the generator
RemoveEvaluator: TYPE = PROC[top: IPTop.Ref, yetToRemove: NAT, cutOff: INT ← LAST[INT]] RETURNS [value: INT, prune: BOOL ← FALSE];
RemoveCompTGen:
TYPE =
PROC[top: IPTop.Ref, toRemove:
NAT]
RETURNS [OrderedRefArray.Ref];
--This only remove 1 component. Pass in eventual number of component toRemove
-- so that it has more information
-- Operation to execute a trial
GrowRec:
TYPE =
RECORD[co: IPCoTab.Component, chToSplit, negBnd, posBnd:
IPCTG.Channel];
--Plus any other FR<record> or R<record> in IPTopRecs
--New Records definitions should be added here
--need this because IPTopStackOps.Redo1 doesnt understand
-- this it is process by Execute below
Execute:
PROC[top: IPTop.Ref, trial:
REF];
--trial must be ref to one of the above records OR LIST OF REF
--Calls IPTopOps.Redo if trial is not a ref to one of the above record
-- Trials Generating Primitives:
EachChGrowSiteAction: TYPE = PROC[negBnd, posBnd: IPCTG.Channel] RETURNS [next, quit: BOOL ← FALSE];
EachTopGrow1SiteAction: TYPE = PROC[host: IPCoTab.Component, corner: IPCoTab.CornerTypes] RETURNS [quit: BOOL ← FALSE];
ChEnumData: TYPE = REF ChEnumDataRep;
ChEnumDataRep:
TYPE =
RECORD[
nextCh, finalCh: IPCTG.Channel, negSidePtr, posSidePtr: LIST OF REF IP.IntersectionNodeRep]; --Should be opaque and TREAT it as such
CreateChEnumData: PROC[refCh: IPCTG.Channel] RETURNS [ChEnumData];
GetChSucc:
PROC[data: ChEnumData, getXOnce:
BOOL ←
TRUE]
RETURNS [
IPCTG.Channel];
-- Get the next channel. Calling this repetetively, enumerates all channel intersecting
-- refCh above. getXOnce => enumerate cross intersection once only, else 2x
AllChGrowSites:
PROC[refCh:
IPCTG.Channel, action: EachChGrowSiteAction];
-- enumerates all places where a Grow can be performed on refCh
ChGrowSites:
PROC[refCh:
IPCTG.Channel, whichSide:
IP.PolarityTypes, action: EachChGrowSiteAction];
-- enumereate all places for grow; but only for the specified site
--Calls AllChGrowSites but apply a filter to get grow that is bounded by
-- channels spanning the same sides, so not the most efficient
AllTopGrow1Sites:
PROC[top: IPTop.Ref, action: EachTopGrow1SiteAction];
-- enumerate all places for Grow1
SideComponents:
PROC[refCh:
IPCTG.Channel, which:
IPCTG.Side, action: IPCoTab.EachComponentAction];
-- Enumerate all components on the side of a channel
-- This is different from IPCTG.Component in that
-- the component passed to action is never NIL
SideChannels:
PROC[refCh:
IPCTG.Channel, which:
IPCTG.Side, action:
IPCTG.EachChannelAction];
--Simple layer above IPCTG.Intersections
-- provided for convenience
-- Useful routines
NonActiveComps: PROC [top: IPTop.Ref, action: IPCoTab.EachComponentAction];
CountComps:
PROC[comps: Components]
RETURNS [
NAT];
-- count number of element in list of component
CopyCompsHead:
PROC[comps: Components, head:
NAT]
RETURNS [compHd, compRest: Components];
--Doesnt modify comps
GetComponents:
PROC[remTrack:
LIST
OF
REF]
RETURNS [Components];
--From track of removals to list of components
GetComponentArea:
PROC[comp: IPCoTab.Component, minusUsedCorners, minusFreeCorners:
BOOL ←
TRUE]
RETURNS [
INT];
--Get area of bounding rectangle of component
-- minusUsedCorners => subtract area of corner if used
-- minusFreeCorners => minus area of corner if it is not used
CoCornerFree:
PROC[co: IPCoTab.Component, corner: IPCoTab.CornerTypes]
RETURNS [
BOOL];
-- = (There is a bite at that corner) AND (bite is not used OR ~co.active)
ComputeZType: PROC[corner: IPCoTab.CornerTypes, refChType: IPCTG.ChType] RETURNS [IP.PolarityTypes];
--High level routines
CompactComp0:
PROC[
top: IPTop.Ref,
comp: IPCoTab.Component,
direction: IPCTG.ChType,
placeEval: PlaceEvaluator, -- Simply use as an eval function no prunning
results: OrderedRefArray.Ref,
resultsAfter: NAT,
keepInitTrack: BOOL ← TRUE, --Provided for convenience
formZOk: BOOL ← TRUE -- This means okay to formz during compaction
];
CompactComp1:
PROC[
top: IPTop.Ref,
comp: IPCoTab.Component,
direction: IPCTG.ChType,
placeEval: PlaceEvaluator, -- Simply use as an eval function no prunning
results: OrderedRefArray.Ref, -- improvement added here
resultsAfter: NAT,
keepInitTrack: BOOL ← TRUE --Provided for convenience
];
-- It is CompactComp0 on comp and its neighbours
FTPerturbTop:
PROC[
--FT = FlipT
top: IPTop.Ref,
placeEval: PlaceEvaluator, -- Simply use as an eval function no prunning
depth: NAT,
results: OrderedRefArray.Ref,
resultsAfter: NAT,
keepInitTrack: BOOL ← TRUE --Provided for convenience
];
END.