// Basic run module for SIL-route aid get "route.defs" manifest [ //User must fill in the parameters below //All coordinates are in 25 mil grid units //Under no circumstances delete any of the parameters listed MAXics=0 //Maximum number of ICs allowed on the board MaxYPinCoor=0 //Largest Y-coordinate (used for LevelTransform) NumVCCPins=0 //Number of VCC pins defined for the board NumVEEPins=0 //Number of VEE pins defined for the board NumVDDPins=0 //Number of VDD pins defined for the board NumEPins=0 //Number of E pins defined for the board NumCPins=0 //Number of C pins defined for the board NumGNDPins=0 //Number of GND pins defined for the board NumICPins=0 //Number of IC pins (Non-trace wired pins) defined for the board CconnsAreVertical=true //True if cable connectors are vertical and false if horizontal //The following coordinates are in X if vertical and Y if horizontal conns CableMin=-1 //The minimum coordinate a C pin may have CableMax=-1 //The maximum coordinate a C pin may have EconnsAreVertical=true //True if edge connectors are vertical and false if horizontal EdgeMin=-1 //The minimum coordinate an E pin may have EdgeMax=-1 //The maximum coordinate an E pin may have Xorigin=0 //The X-coor of column 1, row 1 of the pin table Yorigin=0 //The Y-coor of column 1, row 1 of the pin table //calibration points CalPt1x=0 //The X-coor of calibration point 1 CalPt1y=0 //The Y-coor of calibration point 1 CalPt2x=0 //The X-coor of calibration point 2 CalPt2y=0 //The Y-coor of calibration point 2 CalPt3x=0 //The X-coor of calibration point 3 CalPt3y=0 //The Y-coor of calibration point 3 CalPt4x=0 //The X-coor of calibration point 4 CalPt4y=0 //The Y-coor of calibration point 4 //End of User Parameters(0,7168)\68b ] //Check items in bold italic face to see if parameters are that which are desired manifest [ VCCPintype=1 VEEPintype=2 VDDPintype=3 GNDPintype=4 ICPintype=5 firstEPin=1 firstCPin=firstEPin+NumEPins firstGNDPin=firstCPin+NumCPins firstVCCPin=firstGNDPin+NumGNDPins firstVDDPin=firstVCCPin+NumVCCPins firstVEEPin=firstVDDPin+NumVDDPins firstICPin=firstVEEPin+NumVEEPins maxpin=firstICPin+NumICPins ] static [ maxICs = MAXics ; boardInterfaceVersion = interfaceVersion ] let DeclareInitialNets(BuildTWNet, BuildTermNet, BuildConnector) be [ (635)\4bi82BI if NumEPins ne 0 then BuildConnector("E",NumEPins, EPinPos) if NumCPins ne 0 then BuildConnector("C",NumCPins, CPinPos) if NumGNDPins ne 0 then BuildTWNet("GND",NumGNDPins,GNDPinPos) if NumVCCPins ne 0 then BuildTWNet("VCC",NumVCCPins,VCCPinPos) if NumVDDPins ne 0 then BuildTWNet("VDD",NumVDDPins,VDDPinPos) if NumVEEPins ne 0 then BuildTWNet("VEE",NumVEEPins,VEEPinPos)l4269 ] and ZeroTablePoint(point) = selecton point into [ case 0: "Board Name" case 1: "Z-1" case 2: "Z-2" case 3: "Z-3" case 4: "Z-4" default: empty l4269\9bi10BI ] and LevelTransform(level,x,y,px,py,pName,pPullComponents,pWire;numargs na)=valof [ DefaultArgs(lv na,-1,0,0,lv na,lv na,lv na,lv na,lv na) switchon level into [l4269 case TopLevel:l5539 @px = x @py= MaxYPinCoor-y //if you wish to define the board from the component side, replace this with "@py=y" @pName = "Component side" @pPullComponents = true //pull components for any disconnects on this side @pWire = false resultis truel6809\6bi1BI6bi13BI2bi84BI11bi14BI21bi4BI62bi5BI case BottomLevel:l5539 @px = x @py = y //if you wish to define the board from the component side, replace this with "@py=MaxYPinCoor-y" @pName = "Wiring side" @pPullComponents = false @pWire = true resultis truel6809\6bi1BI7bi99BI11bi11BI21bi5BI10bi4BI default: resultis falsel5539 ]l4269 ] and EPinPos(icinst,pin,px,py)=valof [ if pin gr NumEPins then [ SwatN("Illegal E-pin ",pin,0,0); resultis illegal ] //if you wish to disable any E-pins, add the code: // "if pin eq Pnum1 % pin eq Pnum2 ... %pin eq PnumN then resultis illegal" //replace Pnum1, Pnum2...PnumN with the N E-pin numbers you wish to disable. //Note that you enter 101 if you wish to disable E101. let res=FindConnPos(Econns,pin,px,py) if res eq illegal then SwatN("Illegal E-pin ",pin,0,0) resultis resl4269\79bi259BI ] and CPinPos(icinst,pin,px,py)=valof [ if pin gr NumCPins then [ SwatN("Illegal C-pin ",pin,0,0); resultis illegal ] //if you wish to disable any C-pins, add the code: // "if pin eq Pnum1 % pin eq Pnum2 ... %pin eq PnumN then resultis illegal" //replace Pnum1, Pnum2...PnumN with the N C-pin numbers you wish to disable. //Note that you enter 101 if you wish to disable C101. let res=FindConnPos(Cconns,pin,px,py) if res eq illegal then SwatN("Illegal C-pin ",pin,0,0) resultis resl4269\79bi259BI ] and FindConnPos(cv,pin,px,py)=valof [ if cv>>Cspecs.NumOfSpecs eq 0 then resultis illegal for i=1 to cv>>Cspecs.NumOfSpecs do [ //look at each defined connectorl4269 let cp=Conns>>Cdescs.Num^(cv>>Cspecs.ConnNum^i) //points to connector descriptor let MinCol1Num=cv>>Cspecs.Pin1Col1Num^i let NumsConsec=cp>>Cdesc.NumsConsec let MaxCol1Num=MinCol1Num+((cp>>Cdesc.NumPinsCol1-1)*(NumsConsec ? 1,2)*(cp>>Cdesc.NumsDescending ? -1,1)) if cp>>Cdesc.NumsDescending then [ //nums are descending, swap to get rightl5539 let swap=MaxCol1Num MaxCol1Num=MinCol1Num MinCol1Num=swapl6809 ] if (pin ge MinCol1Num) & (pin le MaxCol1Num) & ((NumsConsec) % (((pin-MinCol1Num) rem 2) eq 0)) then [ //pin is in this connectorl5539 @px=cv>>Cspecs.Xcoor^i @py=cv>>Cspecs.Ycoor^i let off=0 test cp>>Cdesc.NumsDescending ifso [ off=(MaxCol1Num-pin)*cp>>Cdesc.DispBetPins ] ifnot [ off=(pin-MinCol1Num)*cp>>Cdesc.DispBetPins ] if not NumsConsec then off=off/2 //every other pin number test cp>>Cdesc.ConnIsVert ifso [ @py=@py+off ] ifnot [ @px=@px+off ] resultis absolutel6809 ] //end pin is in this connector let MinCol2Num=cv>>Cspecs.Pin1Col2Num^i let MaxCol2Num=MinCol2Num+((cp>>Cdesc.NumPinsCol2-1)*(NumsConsec ? 1,2)*(cp>>Cdesc.NumsDescending ? -1,1)) if cp>>Cdesc.NumsDescending then [ //nums are descending, swap to get rightl5539 let swap=MaxCol2Num MaxCol2Num=MinCol2Num MinCol2Num=swapl6809 ] if (pin ge MinCol2Num) & (pin le MaxCol2Num) & ((NumsConsec) % (((pin-MinCol2Num) rem 2) eq 0)) then [ //pin is in this connectorl5539 @px=cv>>Cspecs.Xcoor^i @py=cv>>Cspecs.Ycoor^i let off=0 test cp>>Cdesc.NumsDescending ifso [ off=(MaxCol2Num-pin)*cp>>Cdesc.DispBetPins ] ifnot [ off=(pin-MinCol2Num)*cp>>Cdesc.DispBetPins ] if not NumsConsec then off=off/2 //every other pin number off=off+(cp>>Cdesc.DispNeg ? -cp>>Cdesc.Disp4sec, cp>>Cdesc.Disp4sec) test cp>>Cdesc.ConnIsVert ifso [ @px=@px+cp>>Cdesc.DispBetRC; @py=@py+off ] ifnot [ @py=@py+cp>>Cdesc.DispBetRC; @px=@px+off ] resultis absolutel6809 ] //end pin is in this connectorl5539 ] //end look at each defined connector resultis illegal //pin not definedl4269 ] //end FindConnPos  //The following defines the parameters used to describe information associated with each trace-wired net:l3392d3008  //noDisconnect means a disconnection is not needed when using this pin as a signal pin. Use Disconnect if the opposite is desiredl3392d3008\2b12B79b10B  //noReconnect means on a rework, do not fix (ie. solder) a previously cut (disconnected) trace-wired pin, rather, go to the nearest existing pin of this type. Use Reconnect if the opposite is desiredl3392d3008\2b11B151b9B  //TopLevel means this trace wiring is on the side defined as TopLevel in LevelTransform...Usually the component sidel3392d3008\2b8B  //BottomLevel means this trace wiring is on the side defined as TopLevel in LevelTransform...Usually the component sidel3392d3008\2b11B and VCCPinPos(icinst,pin,px,py,pInfo; numargs na) = valof [ DefaultArgs(lv na, -4,lv na) @pInfo = noDisconnect+noReconnect+TopLevel if (pin le 0) % (pin gr NumVCCPins) then [l4269\38bi33BI SwatN("Illegal VCC pin",pin,0,0) resultis illegall5539 ] GetXY4Pin(VCCPins,pin,VCCPintype,px,py) resultis absolutel4269 ] and VEEPinPos(icinst,pin,px,py,pInfo; numargs na) = valof [ DefaultArgs(lv na, -4,lv na) @pInfo = noDisconnect+noReconnect+TopLevel if (pin le 0) % (pin gr NumVEEPins) then [l4269\38bi33BI SwatN("Illegal VCC pin",pin,0,0) resultis illegall5539 ] GetXY4Pin(VEEPins,pin,VEEPintype,px,py) resultis absolutel4269 ] and VDDPinPos(icinst,pin,px,py,pInfo; numargs na) = valof [ DefaultArgs(lv na, -4,lv na) @pInfo = noDisconnect+noReconnect+TopLevel if (pin le 0) % (pin gr NumVDDPins) then [l4269\38bi33BI SwatN("Illegal VDD pin",pin,0,0) resultis illegall5539 ] GetXY4Pin(VDDPins,pin,VDDPintype,px,py) resultis absolutel4269 ] and GNDPinPos(icinst,pin,px,py,pInfo; numargs na) = valof [ DefaultArgs(lv na, -4,lv na) @pInfo = Disconnect+noReconnect+TopLevel if (pin le 0) % (pin gr NumGNDPins) then [l4269\38bi31BI SwatN("Illegal VEE pin",pin,0,0) resultis illegall5539 ] GetXY4Pin(GndPins,pin,GNDPintype,px,py) resultis absolutel4269 ] and BoardPinCoord(string,icinst,pinNo,px,py) = valof [ let vop1,hop1 = nil,nil let numpins = Npins(icinst) switchon (Icclass(icinst)>>icclass.PinOffset)(icinst,pinNo,lv vop1,lv hop1) into [l4269 case absolute:l5539 @px = vop1 @py = hop1 resultis truel6809 case relative:l5539 resultis (FindCoordFromString(string,px,py,vop1,hop1,numpins) eq absolute)l6809 default: resultis falsel5539 ]l4269 ] and FindCoordFromString(s,px,py,vop1,hop1,numpins; numargs na) = valof [ // vop1 is the "vertical offset" from pin 1, that is, the offset along the 0.1' // spacing: hop1 is the :horizontal offset: from 1. In a standard 16-pin DIP, // for pin 2 vop1=4 and hop1=0 and for pin 16, vop1=0 and hop1=12. For this // board, vop1 grow in the -x direction hop1 in the +y direction. // s can be of form or // s (meaning vertically offset *0.1 or // ^s (meaning vertically offset *0.1) or // _s (meaning horizontal offset *0.1) or // #s a special form "Z-s" is for ZeroTable point // %s for insert IC upside down  DefaultArgs(lv na,3,0,0,20) let zchar = s>>str.char^1 let znum = s>>str.char^3 if zchar eq $Z do [l4269 if znum eq $1 do [ @px= CalPt1x ; @py = CalPt1y ] if znum eq $2 do [ @px= CalPt2x ; @py = CalPt2y ] if znum eq $3 do [ @px = CalPt3x ; @py = CalPt3y ] if znum eq $4 do [ @px = CalPt4x ; @py = CalPt4y ] resultis absolutel5539 ] let bpVOffset,bpHOffset = 0,0 let i,c,offsetIsVertical = 0,$#,nil while i le s>>str.length & (c ls $a %c gr $z) do [l4269 if c eq $^ % c eq $_ % c eq $# % c eq $% then [l5539\31bi9BI offsetIsVertical = not(c eq $_) //to disengage code to allow ICs to be inserted upside down, remove all code that is bold italic face if c eq $% then [ //code to insert IC upside downl6809\31bi102BI1bi vop1=numpins*2-4-vop1 hop1=((hop1 eq 0)?(numpins le 20?12,24),0)l8079\bi ] i = i+1 c = s>>str.char^i loopl6809\bi2BI ] if c ge $0 & c le $9 then [l5539 let bpOffset = 0 while i le s>>str.length & c ge $0 & c le $9 do [l6809 bpOffset = 10*bpOffset+c-$0 i = i+1 c = s>>str.char^il8079 ] @(offsetIsVertical? lv bpVOffset, lv bpHOffset) = bpOffset offsetIsVertical = true loopl6809 ] resultis illegall5539 ] vop1 = vop1-4*bpVOffset //Vertical displacement currently in the -y direction...change sign to + if +y direction is desired hop1 = hop1+4*bpHOffset //horizontal displacement is currently in the +x direction...change sign to - if -x direction is desired // IC position of the form if i gr s>>str.length % c ls $a % c gr $z then resultis illegal let alph,num = c,0 while i ls s>>str.length do [l4269\3bi257BI i = i+1 ; let c = s>>str.char^i if (c ls $0)%(c gr $9) then resultis illegal num = 10*num+(c-$0)l5539 ] //change alpha to numeric alph=alph-$a+1 if (alph gr NumDipRows) % (num ls 1) % (num gr NumDipCols) then resultis illegal //find dip descriptor let DescPtr=DipColVec>>DipCols.ColDescPtr^num let DipNum=DescPtr>>DipRow.DipDescNum^alph if DipNum eq 0 then resultis illegal //not a dip site let DipPtr=DipDesc>>DipVec.DipDnum^DipNum //DipPtr points to the dip configurations at this site...see if this site allows the dip //specified and if so, check the x-y offsets. If all is OK then stuff the coordinates //in the x-y let Ycoor=4*DescPtr>>DipRow.Ycoor^alph //put in 25 mil grid coor let Xcoor=2*DipColVec>>DipCols.Xcoor^num for i=1 to MaxDips do [ //check for the number of pins allowedl4269 if DipPtr>>DipDesc.NumPins^i eq numpins then [ //valid dip site for this number of pinsl5539 vop1=vop1+4*DipPtr>>DipDesc.Yoffset^i hop1=hop1+4*DipPtr>>DipDesc.Xoffset^i if (vop1 gr (DipPtr>>DipDesc.MaxYoffset*4)) % (vop1 ls 0) then resultis illegal if (hop1 gr (DipPtr>>DipDesc.MaxXoffset*4)) % (hop1 ls 0) then resultis illegal @px=Xcoor+hop1+Xorigin-2 @py=Ycoor+vop1+Yorigin-4 resultis absolutel6809 ]l5539 ] //if we get this far, dip with numpins not allowed at this site resultis illegall4269 ] and FindIndexFromCoord(x,y,picclass,pPinNo; numargs na) = valof [ static [ hotIndex = -1; maxpin = 0] DefaultArgs(lv na, -2,lv na , lv na) if maxpin eq 0 then maxpin = FIFC(-1,-1) let result = FIFC(x,y,picclass,pPinNo) if result ls 0 % result gr maxpin then SwatN("Illegal index..",result,x,y) if result eq hotIndex then CallSwat("Hot index computed...") resultis resultl4269 ] and FIFC(x,y,picclass,pPinNo;numargs na) = valof [ // Given coordinates x,y return pin index. // picclass is set to the icclass describing the trace wire net // and pPinNo is set to the number of the pin within the trace // wire net.  if x eq -1 & y eq -1 then resultis maxpin DefaultArgs(lv na, -2, lv na, lv na) @picclass = empty // Test for C connector if (CconnsAreVertical & x le CableMax & x ge CableMin) % ((not CconnsAreVertical) & y le CableMax & y ge CableMin) then [l4269 resultis FIFC4conn(Cconns,x,y,firstCPin)l5539 ]l4269 // Test for edge connector if (EconnsAreVertical & x le EdgeMax & x ge EdgeMin) % ((not EconnsAreVertical) & y le EdgeMax & y ge EdgeMin) thenl4269 [l4269 resultis FIFC4conn(Econns,x,y,firstEPin)l5539 ] let dx=x-Xorigin if (dx rem 2) ne 0 then resultis 0 dx=(dx/2)+1 //column number let dy=y-Yorigin if (dy rem 4) ne 0 then resultis 0 dy=(dy/4)+1 //row number if dy le 0 % dx le 0 % dy gr NumPinRows % dx gr NumPinCols then resultis 0 let DescPtr=PinCols>>Cols.Cnum^dx if DescPtr eq 0 then resultis 0 if not GetBit(DescPtr,dy) then resultis 0 //count number of defined pins to this one in the column descriptor let cnt=0 for i=1 to dy do [l4269 if GetBit(DescPtr,i) then cnt=cnt+1l5539 ] let Ptype=DescPtr>>ColDesc.Ptype^cnt if Ptype ne ICPintype then [ //trace wired pinl4269 let Pnum=DescPtr>>ColDesc.Pnum^cnt let resultval=0 let ptr=0 switchon Ptype into [l5539 case VCCPintype:l6809 [ @picclass=MustFindNamee("VCC",typeIcclass) resultval=firstVCCPin ptr=VCCPins ]; endcasel8079 l6809 case VEEPintype:l6809 [ @picclass=MustFindNamee("VEE",typeIcclass) resultval=firstVEEPin ptr=VEEPins ]; endcasel8079 l6809 case VDDPintype:l6809 [ @picclass=MustFindNamee("VDD",typeIcclass) resultval=firstVDDPin ptr=VDDPins ]; endcasel8079 l6809 case GNDPintype:l6809 [ @picclass=MustFindNamee("GND",typeIcclass) resultval=firstGNDPin ptr=GndPins ]; endcasel8079 ] //end cases for j=1 to ptr>>PinCol.NumCols do [ //add all prior pins to get pin # within classl5539 if ptr>>PinCol.Cnum^j eq dx then break Pnum=Pnum+ptr>>PinCol.NumPins^jl6809 ] @pPinNo=Pnum resultis (resultval+Pnum-1)l5539 ] //end tracewired pinl4269 l4269 //IC pin let Pnum=ICPins>>Cols.Cnum^dx+DescPtr>>ColDesc.Poffset^cnt resultis firstICPin+Pnum-1l4269 ] and FIFC4conn(cv,x,y,FirstPin)=valof [ for i=1 to cv>>Cspecs.NumOfSpecs do [ //check each defined connectorl4269 let cp=Conns>>Cdescs.Num^(cv>>Cspecs.ConnNum^i) //ptr to connector descriptor let Ycoor=cv>>Cspecs.Ycoor^i let Xcoor=cv>>Cspecs.Xcoor^i if not cp>>Cdesc.ConnIsVert then [ //conn is horizontal...swap coors so tests can be made with same codel5539 let temp=x x=y y=temp temp=Xcoor Xcoor=Ycoor Ycoor=templ6809 ] let DispBetPins=cp>>Cdesc.DispBetPins if x eq Xcoor then [ //maybe in column 1l5539 let maxY=Ycoor+(DispBetPins*(cp>>Cdesc.NumPinsCol1-1)) if (y ge Ycoor) & (y le maxY) & (((y-Ycoor) rem DispBetPins) eq 0) then [ //is in this connl6809 resultis FirstPin+cv>>Cspecs.Pin1Col1Num^i+(((y-Ycoor)/DispBetPins) * (cp>>Cdesc.NumsConsec ? 1,2) * (cp>>Cdesc.NumsDescending ? -1,1))-1l8079 ] loop //not in col 1 of this connl6809 ] //end maybe in column 1 if x eq (Xcoor+cp>>Cdesc.DispBetRC) then [ //maybe in column 2l5539 Ycoor=Ycoor+(cp>>Cdesc.DispNeg ? -cp>>Cdesc.Disp4sec, cp>>Cdesc.Disp4sec)l6809 let maxY=Ycoor+(DispBetPins*(cp>>Cdesc.NumPinsCol2-1)) if (y ge Ycoor) & (y le maxY) & (((y-Ycoor) rem DispBetPins) eq 0) then [ //is in this connl6809 resultis FirstPin+cv>>Cspecs.Pin1Col2Num^i+(((y-Ycoor)/DispBetPins) * (cp>>Cdesc.NumsConsec ? 1,2) * (cp>>Cdesc.NumsDescending ? -1,1))-1l8079 ] //not in col 2 of this connl6809 ] //end maybe in column 2l5539 ] //end check each defined connectorl4269 resultis 0 //not foundl4269 ]  and GetXY4Pin(PinVec,PinNum,Pintype,px,py) be [ let NumCols=PinVec>>PinCol.NumCols let cnt=0 for i=1 to NumCols do [l4269 let oldcnt=cnt cnt=cnt+PinVec>>PinCol.NumPins^i if (PinNum gr oldcnt) & (PinNum le cnt) then [ //found column with this pinl5539 let column=PinVec>>PinCol.Cnum^i let DescPtr=PinCols>>Cols.Cnum^column let typecnt=oldcnt for j=1 to NumPinRows do [ //find the pinl6809 if Pintype eq DescPtr>>ColDesc.Ptype^j then typecnt=typecnt+1 if (PinNum eq typecnt) thenl8079 [ //found the pin now determine the rowl8079 let row=0 let Icnt=0 until Icnt eq j do [ //loop until we find the jth defined pinl9349 row=row+1 if GetBit(DescPtr,row) then Icnt=Icnt+1l10619 ] @px=(column*2)+Xorigin-2 @py=(row*4)+Yorigin-4 breakl9349 ] //end found the pin now determine the rowl8079 ] //end find the pinl6809 breakl6809 ] //end found column with this pinl5539 ] //end for il4269 ] //end GetXY4Pin and SwatN(f1,f2,f3,f4) be [ let f5 = vec 40 ; f5>>str.length = 0 AppndS(f5,f1) ; AppndN(f5,f2) ; AppndS(f5," ") AppndN(f5,f3) ; AppndS(f5," ") ; AppndN(f5,f4) CallSwat(f5) ] and AppndS(f1,f2) be [ let i,j=1,f1>>str.length+1 while i le f2>>str.length do [ f1>>str.char^j = f2>>str.char^i ; i = i+1 ; j = j+1 ] f1>>str.length = j-1 ] and AppndN(f1,f2) be [ let i,j,m=f1>>str.length+1,nil,10000 for j = 1 to 5 do [ f1>>str.char^i = f2/m +$0 ; i = i+1 ; f2 = f2-(f2/m)*m m=m/10 ] f1>>str.length = i-1 ]