SCNetUtilImpl:
CEDAR PROGRAM
IMPORTS SCInstUtil, SCNetUtil, SCUtil
EXPORTS SCNetUtil
SHARES SC =
BEGIN
find nets attached to component
NetsOnInst:
PUBLIC PROCEDURE[insts: SCPrivate.InstanceList]
RETURNS [nets: SCPrivate.NetList ←
NIL] =
BEGIN
PinProc: SCInstUtil.EachPinProc = {
IF netPin.net #
NIL THEN {
net: SCPrivate.Net ← NIL;
FOR netList: SCPrivate.NetList ← nets, netList.rest
WHILE netList #
NIL AND net #
NIL DO
IF netList.first = netPin.net THEN net ← netList.first;
ENDLOOP;
IF net # NIL THEN nets ← CONS[net, nets]}};
FOR instList: SCPrivate.InstanceList ← insts, instList.rest
WHILE instList #
NIL DO
inst: SCPrivate.Instance ← instList.first;
[] ← SCInstUtil.EnumeratePinsOnInst[inst, PinProc];
ENDLOOP;
END;
determine components on net
InstsOnNets:
PUBLIC PROCEDURE[nets: SCPrivate.NetList]
RETURNS [insts: SCPrivate.InstanceList ←
NIL] = {
InstProc: SCNetUtil.EachInstProc = {
IF instance #
NIL THEN insts ←
CONS[instance, insts]};
[] ← SCNetUtil.EnumerateInstsOnNets[nets, InstProc]};
determine components on net
EnumerateInstsOnNets:
PUBLIC PROCEDURE[nets: SCPrivate.NetList, eachInst: SCNetUtil.EachInstProc]
RETURNS [quit:
BOOL ←
FALSE] = {
PinProc: SCNetUtil.EachPinProc = {
instance: SCPrivate.Instance ← netPin.instance;
IF instance #
NIL THEN {
found: BOOLEAN ← FALSE;
FOR instanceList: SCPrivate.InstanceList ← insts, instanceList.rest
WHILE instanceList #
NIL AND ~found
DO
IF instanceList.first = instance THEN found ← TRUE;
ENDLOOP;
IF ~found
THEN
{insts ← CONS[instance, insts]; quit ← eachInst[instance]}}};
insts: SCPrivate.InstanceList ← NIL;
FOR netList: SCPrivate.NetList ← nets, netList.rest
WHILE netList #
NIL AND ~quit
DO
[] ← SCNetUtil.EnumeratePinsOnNet[netList.first, PinProc];
ENDLOOP;
};
EnumerateNets:
PUBLIC PROC [handle:
SC.Handle, eachNet: SCNetUtil.EachNetProc]
RETURNS [quit:
BOOL ← FALSE] = {
structureData: SCPrivate.StructureData ← NARROW[handle.structureData];
nets: SCPrivate.Nets ← structureData.nets;
FOR n:
NAT IN [1 .. nets.count]
WHILE ~quit
DO
quit ← eachNet[n, nets.nets[n]];
ENDLOOP;
};
EnumeratePinsOnNet:
PUBLIC PROC [net: SCPrivate.Net, eachPin: SCNetUtil.EachPinProc]
RETURNS [quit:
BOOL ←
FALSE] = {
FOR pinList: SCPrivate.NetPinsList ← net.pins, pinList.rest
WHILE pinList #
NIL AND ~quit
DO
quit ← eachPin[pinList.first];
ENDLOOP};
AddConnection:
PUBLIC PROCEDURE [handle:
SC.Handle, net: SCPrivate.Net, instance: SCPrivate.Instance, pin: SCPrivate.ObjectPin, pinIndex:
NAT] = {
netPin: SCPrivate.NetPin ← NEW[SCPrivate.NetPinRec];
netPin.instance ← instance;
netPin.pin ← pin;
instance.pinNets.n[pinIndex] ← [pin, net];
net.pins ← CONS[netPin, net.pins]};
RemoveConnection:
PUBLIC PROCEDURE [handle:
SC.Handle, net: SCPrivate.Net, instance: SCPrivate.Instance, pin: SCPrivate.ObjectPin, pinIndex:
NAT] = {
};
DefineNet:
PUBLIC PROCEDURE [handle:
SC.Handle, netName: Rope.
ROPE]
RETURNS [net: SCPrivate.Net ← NIL] = {
define a net
structureData: SCPrivate.StructureData ← NARROW[handle.structureData];
rules: Route.DesignRules ← handle.rules.rowRules;
nets: SCPrivate.Nets ← structureData.nets;
acBus: SCPrivate.AcBus ← SCUtil.FindBus[handle, netName];
nets.count ← nets.count + 1;
net ← NEW[SCPrivate.NetRec ← [name: netName, netNum: nets.count, trunkWidth: rules.trunkWidth, branchWidth: rules.branchWidth, pinsOnChan: 0, chanConnect: ALL[none]]];
net.netNum ← nets.count;
nets.nets[nets.count] ← net;
get signals to roue without feedthrus
IF acBus = NIL THEN net.feedThrusAllowed ← TRUE
ELSE {net.feedThrusAllowed ←
FALSE; acBus.net ← net};
net.ftsOnRow ← RTSets.RTMdSetEmpty;
net.rowExits[left] ← net.rowExits[right] ← RTSets.RTMdSetEmpty};
remove the fts on a net list
RemoveFtsOnNet:
PUBLIC PROCEDURE[handle:
SC.Handle, net: SCPrivate.Net] = {
EachPin: SCNetUtil.EachPinProc = {
IF netPin.pinClass = compPin
THEN {
IF netPin.instance.whichClass # ft THEN pinList ← CONS [netPin, pinList]
ELSE pinList ← CONS [netPin, pinList]}};
pinList: SCPrivate.NetPinsList ← NIL;
[] ← SCNetUtil.EnumeratePinsOnNet[net, EachPin];
net.pins ← pinList};
END.