//route.defs
// last modified by E. McCreight, July 10, 1979 12:02 AM
//last modified by S. Inouye for Sil/route aid board generation stuff June 23, 1981 9:07 AM
// last modified by Inouye for Sil/route aid...50-mil column level August 7, 1981 3:41 PM

external
[
Gets // Common OS procedures
Puts
Endofs
OpenFile
CreateDiskStream
GetCompleteFa
Closes
Resets
CallSwat
SysErr
DefaultArgs
Allocate
Free
MoveBlock
SetBlock
Zero
Noop
FilePos
SetFilePos
TruncateDiskStream
Usc
GetFixed
FixedLeft
InitializeZone
AddToZone

worstErrorLevel // Route statics

GetFile
// Route procedures
AddSpace
WeAre

OnceOnlyInitCode // RouteInit procedures

ADFile // RouteInit statics
ErFile
OutFile
ImplicitFile
CommentsFile
OldWlFile
charTab
Correcting
InitializeRB
noroute
boardLocation
nlFileName
wlOldFileName
wlNewFileName
SilZone
StandardMetric
dontCareNet
kf

DefineNamee // RouteSyms procedures and statics
DefineName
MapNamees
FindNameesString
FindNameesName
MustFindNamee
TryFindingNamee
TryFindingName
SetupSpace
objectZone
StComp
Wss
AppendC
ExpandTemplate
GetBit
SetBit
OffsetLegal
Remark
Warning
Serious
Disaster
CallSmartSwat
ParsePin
NormalizeBoardLoc

FileIn // Routea procedures and statics
ReadAllNetLines
CheckUnusedPins
copyComments

MakeOutputFile // Routeb procedures and statics
NLCompFn
AssignNetNumber
currentlevel
headingpresent
zeroPending
ZeroTheTable
outcount
currentFile
baseNetNumber
netCount
PrintNet
PrintPin
PrintBasicPin
Heading

ReadICType // Routec procedures
NewICInst
NewNet
ReadNetName
GetValidChar
char
TryInserting
InsertDeviceIfPossible
GetPatternCoord
FindIcinst
GetPinCoord
BoardPinCoord
Icclass
Npins
FindNet
nitems
DoInSortOrder
Count
AddToList
NameCompareFn
ComputeClusters
NoAddedCaps
ManhattanDistFn
EuclideanDistFn

RouteNet
// RouteNet procedures
RouteNetIfExternal
RouteEarlyNets
ComputeLengths

AssignTWNet // RouteTWNetAssign procedures

OutputBPFiles // RouteBackPanel procedures
doMultiWire
MultiWirePanic

LocateAvailTerms // RouteTerm procedures
FreeTermStorage
AddEclTerminators
doResistances

CorrelateOldAndNew // RouteCorrect procedures and statics
CorrelateRemaining
deletePosFile

PrintNewNet
// RouteCorrectOut procedures
DeleteNets
ReportNewCutPins
ReportRepairedPins

PullComponents // RoutePull procedures

DIP3Wide // RouteIC procedures
DIP4Wide
DIP6Wide
DIP9Wide
DIP12Wide
SIP
QITPlat
Ecl4GAttributes
Ecl3GAttributes
Ecl2GAttributes
Ecl1GAttributes
ETCAttributes
TECAttributes
EclTermAttributes
F100KAttributes
NullAttributes
Ecl4Gnd
Ecl3Gnd
Ecl2Gnd
Ecl1Gnd
EclConverter
EclTerm
F100K
FTTL
TTL
DynamicRam3Supply
DynamicRam1Supply

SetupBoard // RouteBoard procedures and statics
SetupICclasses
SetupICclass

FindIndexFromCoord // Board’s procedures and statics
FindCoordFromString
DeclareInitialNets
ZeroTablePoint
LevelTransform
maxICs
boardInterfaceVersion
ComputeMWCoords
DescribeHoles
AddDecouplingCaps

Sperge // RouteNeighbor procedures
BinSearch
AddToHeap
PullFromHeap
Sort
FindNearest
OverlapsClaimedArea
ClaimArea
coveredAreas

Route // Router procedures and statics
bestTotalNetLength
forceFirstNodeToEnd
exhaustThresh

heuristicWork // Router1 statics

PutTemplate // PutTemplate procedures
]

manifest
[
interfaceVersion = 1 // between Route and board subroutines

DirPreambleSize=6
empty = 0
infinity = #77777
mark = -1
used = -2
filegone = -1
noError = 0
warning = 1
serious = 2
disaster = 3

doingBrdInit = 0
doingInput = 1
doingCorrection = 2
doingTraces = 3
doingRouting = 4
doingADFile = 5
doingOutput = 6
]


structure str:
[
length byte
char↑1,35 byte
]

structure string:
[
length byte
char↑1,255 byte
]

structure KF:
// known file
[
next word
fp word 5
input bit
oktocreate bit
unused bit 14
string @string
]

structure namee:
[
next word // to next namee with this name; mark of name terminates list
blank bit 12
type bit 4
]

structure name:
[
next word // to next name with this hash; 0 terminates list
mark word // -1, terminates name chain and net’s pinList
nameString:
[
length byte
char↑1,1 byte
]
// name structure immediately followed by first namee
firstNamee @namee
]

manifest
[
// namee types
typeNet = 1
typeIcinst = 2
typeIctype = 3
typeIcclass = 4
typeOldinst = 5
typePgmsymbol = 6
typeNull = 7
]

structure net:
[
next word// to next namee with this name
dontTerminate bit
isSame bit // as a net in the old wirelist
isTraceWired bit // should be partitioned
hasBeenRouted bit
wireEarly bit
hasNetnum bit
blank bit 6
type bit 4
// =typeNet
pinList word
// pointer to first pin of pin list
shortestarc word = netnum word = minSperge word
netlength word = clusterList word
]

structure cluster:
// for cluster numbers > 0
[
next word// to next element of clusterList
number byte
// number of this cluster
index byte
// index in pinList where this cluster starts, 0 => first pin
]

structure oldinst:
[
next word // to next namee with this name
type word // = typeOldinst
ictype word // pointer to ictype or icclass block for this instance
]

structure icinst:
[
next word // to next namee with this name
type word // = typeIcinst
ictype word
// pointer to ictype or icclass block for this IC type
pinattribute word // pointer to list of pinattributes for this icinst
pin↑1,1 word
// links in the pin list
]

structure ictype:
[
next word// to next namee with this name
npins bit 12
type bit 4 // = typeIctype
icclass word
// pointer to icclass block for this IC type
outpins word
// one bit per pin, true if pin ever used in any instance
// as output pin
]

structure permutation:
[
nelements word
element↑1,1 word
]

structure classattributes:
[
isTraceWired bit
isConnector bit
printUsedList bit
blank bit 9
]

manifest
[
isTraceWired = 1 lshift (size classattributes-offset classattributes.isTraceWired-1)
isConnector = 1 lshift (size classattributes-offset classattributes.isConnector-1)
printUsedList = 1 lshift (size classattributes-offset classattributes.printUsedList-1)
]

structure pinattributes:
[
isEcl bit
isTerminator bit
isOutput bit
blank bit 13
]

manifest
[
isEcl = 1 lshift (size pinattributes-offset pinattributes.isEcl-1)
isTerminator = 1 lshift (size pinattributes-offset pinattributes.isTerminator-1)
isOutput = 1 lshift (size pinattributes-offset pinattributes.isOutput-1)
]

structure icclass:
[
next word// to next namee with this name
@classattributes = classattributes @classattributes
type bit 4 // = typeIcclass
PinOffset word
// PinOffset(icinst, pinNo, lv vertOffset, lv horizOffset, lv info)
PinAttributes word // PinInfo(icinst, pinNo) = pinattributes
ImplicitICNets word // ImplicitICNets(icinst) generates
// implicit nets into "implicit.nl"
npins word // # pins, overridden by ictype block
permutation word // points to a vector mapping from sperged
// coordinate order to standard order
spergevec word // points to a vector of sperged pin co-ordinates, one
// word per pin, in standard order
cutPins word
// points to vector containing one bit per pin,
// in standard order; bit true if pin cut from trace
oldCutPins word // as above, referring to old wirelist file
nPotentialPins word
LocatePotentialPin word // LocatePotentialPin(icinst, pinNo, lv x, lv y, lv info, pinName)
]


manifest
[
absolute = 1 // values returned from PinOffset routine
relative = 2
illegal = 3
]

structure info: // information about trace-wired pins
[
unused bit 9
usedForDecoupling bit 1
disconnect bit 1
reconnect bit 1
level bit 4
]

manifest
[
usedForDecoupling = 1 lshift (size info-offset info.usedForDecoupling-1)
Disconnect = 1 lshift (size info-offset info.disconnect-1)
Reconnect = 1 lshift (size info-offset info.reconnect-1)
noDisconnect = 0
noReconnect = 0
TopLevel = 1
BottomLevel = 2
]

structure pinattribute:
[
next word// to next pinattribute for this icinst
pinNo word // attribute with this name applies to this pin
attribute word
value word // value (if any) of this attribute
]

manifest
[
letterMask = 1
upperCaseMask = 2
lowerCaseMask = 4
digitMask = 8
colonMask = 16
breakMask = 32
legalSpecialCharMask = 64
atsignMask = 128
netNameMask = letterMask%digitMask%legalSpecialCharMask%colonMask
]

structure pgmsymbol:
[
next word
valIsPtr bit
staticHasValue bit
unused bit 10
type bit 4
value word
]
//Sil- route aid stuff

manifest
[
BitVecSize=8//MaxRows/16
NumBitsInVec=16*BitVecSize
MaxRows=120
//max number of pin rows...12 inch max..100 mil grid
MaxCols=200
//max number of pin cols...16 inch max...50 mil grid
MaxDips=8
//max number of dips describable at one IC location
MaxDipDesc=20
//max number of describable dip configurations
MaxDipCols=40
//max number of sil location columns (1-40)
MaxDipRows=26
//max number of sil location rows (a-z)
MaxDescs=50
//max number of connector descriptors
MaxSpecs=50//max number of connector specifications
]

external
[
NumPinRows
NumPinCols
PinCols
ICPins
GndPins
VEEPins
VCCPins
VDDPins
DipDesc
DipColVec
NumDipRows
NumDipCols
Econns
Cconns
Conns

InitRouteBrd
]
structure PinColDesc:
[
Cnumword//column number which contains pins of this type
NumPins
word//number of pins of this type in this column
]
structure PinCol:
[
NumColsword//number of cols w/that type of pin
@PinColDesc ↑1,MaxCols
]
structure Cols:
[
Cnum ↑1,MaxColsword//pointer to column descriptors
]
structure Rows:
[
Rnum ↑1,MaxRowsword
]

structure ColElem:
[
Ptypebit 3//pin type
[ Pnum bit 13 ] = [ Poffset bit 13 ]//the ith pin of this class within the column
]

structure ColDesc:
[
Row ↑ 1,NumBitsInVecbit
@ColElem ↑ 1,MaxRows
]
structure DipDescriptor:
[
NumPinsbit 9
Yoffset
bit 4
Xoffsetbit 3
]
structure DipDesc:
[
@DipDescriptor ↑ 1,MaxDips
MaxXoffsetbit 8
MaxYoffset
bit 8
]
structure DipVec:
[
DipDnum ↑1,MaxDipDescword
]
structure DipCol:
[
ColDescPtrword
Xcoor
word
]
structure DipCols:
[
@DipCol ↑ 1,MaxDipCols
]
structure RowElem:
[
DipDescNumword
Ycoorword
]
structure DipRow:
[
@RowElem ↑1,MaxDipRows
]

structure Cdescs:
[
Num ↑1,MaxDescsword
]

structure Cdesc:
[
DispBetRCbit 4
DispBetPins
bit 4
Disp4sec
bit 4
DispNeg
bit 1
ConnIsVert
bit 1
NumsConsec
bit 1
NumsDescending bit 1
NumPinsCol1
byte
NumPinsCol2 byte
]

structure Cspec:
[
Xcoorword
Ycoor
word
Pin1Col1Num
bit 10
ConnNum
bit 6
Pin1Col2Num bit 10
unused
bit 6
]

structure Cspecs:
[
NumOfSpecsword
@Cspec ↑1,MaxSpecs
]
manifest
[
CspecSize=(size Cspec)/16
CdescSize=(size Cdesc)/16
DipColSize=(size DipCol)/16
RowElemSize=(size RowElem)/16
DipDescSize=(size DipDesc)/16
PinColDescSize=(size PinColDesc)/16
]