file ///StdCell/SCChanUtilImpl.mesa
chan utility routines
DIRECTORY
RTSets,
SC,
SCChanUtil,
SCInstUtil,
SCNetUtil,
SCPrivate,
SCRowUtil;
SCChanUtilImpl: CEDAR PROGRAM
IMPORTS SCChanUtil, SCInstUtil, SCNetUtil, SCRowUtil
EXPORTS SCChanUtil
SHARES SC =
BEGIN
clear routing data
ClearRouteDat: PUBLIC PROCEDURE [handle: SC.Handle] = {
RowProc: SCRowUtil.EachRowProc = {
lgRow.nFtsOnRow ← 0;
lgRow.dimInvalid ← TRUE};
NetProc: SCNetUtil.EachNetProc = {
net.ftsOnRow ← RTSets.RTMdSetEmpty;
net.chanExits[left] ← net.chanExits[right] ← RTSets.RTMdSetEmpty};
[] ← SCRowUtil.EnumerateRows[handle, RowProc];
[] ← SCNetUtil.EnumerateNets[handle, NetProc]};
initialize the channel widths
InitChanWidths: PUBLIC PROCEDURE [handle: SC.Handle] = {
RowChanProc: SCChanUtil.EachRowChanProc = {
rowChan.chanWidth ← rowChan.initChanWidth};
SideChanProc: SCChanUtil.EachSideChanProc = {
sideChan.sideChanWidth ← sideChan.initSideChanWidth};
[] ← SCChanUtil.EnumerateRowChans[handle, RowChanProc];
[] ← SCChanUtil.EnumerateSideChans[handle, SideChanProc]};
EnumerateRowChans: PUBLIC PROC [handle: SC.Handle, eachRowChan: SCChanUtil.EachRowChanProc] RETURNS [quit: BOOLFALSE] = {
layoutData: SCPrivate.LayoutData ← NARROW[handle.layoutData];
rowChans: SCPrivate.RowChans ← layoutData.rowChans;
FOR chan: NAT IN [1 .. rowChans.count] WHILE ~quit DO
quit ← eachRowChan[chan, rowChans.chans[chan]];
ENDLOOP};
EnumerateSideChans: PUBLIC PROC [handle: SC.Handle, eachSideChan: SCChanUtil.EachSideChanProc] RETURNS [quit: BOOLFALSE] = {
layoutData: SCPrivate.LayoutData ← NARROW[handle.layoutData];
sideChans: SCPrivate.SideChans ← layoutData.sideChans;
FOR lrSide: SCPrivate.LRSide IN SCPrivate.LRSide WHILE ~quit DO
quit ← eachSideChan[lrSide, sideChans[lrSide]];
ENDLOOP};
EnumerateExits: PUBLIC PROC [handle: SC.Handle, rowChan: SCPrivate.RowChan, lrSide: SCPrivate.LRSide, eachExit: SCChanUtil.EachExitProc] RETURNS [quit: BOOLFALSE] = {
FOR exit: NAT IN [1 .. rowChan.numExits[lrSide]] WHILE ~quit DO
quit ← eachExit[exit, lrSide, rowChan, rowChan.exits[lrSide][exit]];
ENDLOOP};
EnumeratePinsOnChan: PUBLIC PROC [handle: SC.Handle, chan: SCPrivate.MaxChanSr, action: SCChanUtil.EachPinProc] = {
side: SC.Side;
row: NAT;
ForEachPin: SCInstUtil.EachPinProc = {
[] ← action[instance, netPin, side]};
ForEachIntInstance: SCRowUtil.EachInstProc = {
[] ← SCInstUtil.EnumeratePinsOnInst[instance, ForEachPin]};
side ← top; row ← chan - 1;
[] ← SCRowUtil.EnumerateAllInstsOnRow[handle, row, ForEachIntInstance];
side ← bottom; row ← chan;
[] ← SCRowUtil.EnumerateAllInstsOnRow[handle, row, ForEachIntInstance]};
END.