(FILECREATED " 5-Sep-86 15:50:11" {ERIS}<TAMARIN>UCODE>CHANNEL.;49 43030  

      changes to:  (VARS ClockLocSpec DPLocSpec SideLocSpec PadConnectLocSpec PadLogicLocSpec 
			 MiscLocSpec OpVLocSpec RouteBUp R2LeftWireSpec RegMuxVLocSpec CHANNELCOMS 
			 OldR2LeftWireSpec CCodeLocSpec R21LeftWireSpec RegMuxLocSpec RouteAUp 
			 NEWDPLocSpec)
		   (FNS DefineRouteB DoRoute RouteA RouteB MakeCif DefineRouteA)

      previous date: " 1-Aug-86 14:17:38" {PHYLUM}<BELL>TAM>CHANNEL.;1)


(* Copyright (c) 1985, 1986 by Xerox Corporation. All rights reserved.)

(PRETTYCOMPRINT CHANNELCOMS)

(RPAQQ CHANNELCOMS ((FNS)
	(* * Channel Router)
	(FNS DependB DoRoute MakeDependLst FindChannel InsertChannel PlaceChannel TryChannelListRev 
	     TryChannelList TryChannel Compat CompatChannel FindDepend CheckDepend DependA 
	     FindMultDepend)
	(* * Input)
	(FNS GetNameList NoteWire NoteWireLst Formatlst)
	(* * Routes)
	(FNS DefineRouteA DefineRouteB DefineRouteC RouteA RouteB RouteC)
	(* * SpecVars)
	(VARS CCodeLocSpec ClockLocSpec DPLocSpec LeftWireSpec MiscLocSpec NEWDPLocSpec 
	      OldR2LeftWireSpec OpVLocSpec PadConnectLocSpec PadLogicLocSpec R21LeftWireSpec 
	      R2LeftWireSpec RegMuxLocSpec RegMuxVLocSpec RouteAUp RouteBLocSpec RouteBUp SideLocSpec 
	      SingleTermIgnore)
	(* * Input Generation)
	(FNS MakeListLoc MakePlaLocOp MakeWireLLoc MakeWireLoc SpecifyLocs MakePlaLoc)
	(* * Special Input Gen)
	(FNS MakeRamS MakRam4 mn)
	(FNS MakLP2 MakeIBufRoute MakeIBufSpaces MakeInputList)
	(* * Output)
	(FNS ShowRoute ChX DrawChannel MakeCif MakeCifRte MakeLocCif MakeLocFiles)
	(* * Other)
	(FNS PrintFile Test WirePos)))
(* * Channel Router)

(DEFINEQ

(DependB
  [LAMBDA (i j)                                              (* agb: "15-Jun-86 15:32")
    (AND (ILESSP i (PLUS 8 j))
	   (IGREATERP i (PLUS -8 j])

(DoRoute
  [LAMBDA (file extDwn extUp leftExtend offset start)        (* agb: " 3-Aug-86 11:27")
    (SETQ PlaceUp NIL)
    (SETQ Placed NIL)
    (SETQ MinHeightList NIL)
    (SETQ PlaceResult (LIST NIL))
    (CLEARW xWIN)
    (SETQ slst (GetNameList))
    (SETQ dlst (MakeDependLst slst))
    (SORT dlst T)
    (FindChannel slst dlst)
    (ShowRoute PlaceResult)
    (if file
	then (CLEARW xWIN)
	       (MakeCif (CDR PlaceResult)
			  (MKATOM (CONCAT "{DSK18}" file ".chip"))
			  extDwn extUp offset start))
    (SUB1 (LENGTH PlaceResult])

(MakeDependLst
  [LAMBDA (lst)                                              (* agb: "15-Jun-86 17:49")
    (PROG (DLst)
	    [for i in lst as n from 0
	       do (for j in lst as m from 0 when (NEQ i j)
		       do (for ii in (CADDDR i)
			       do (for jj in (CADDDR j)
				       do (if (AND (EQ (CADR ii)
							       (QUOTE U))
							 (EQ (CADR jj)
							       (QUOTE D))
							 (DependB (CAR ii)
								    (CAR jj))
							 (NOT (MEMBER (LIST n m)
									  DLst)))
						then (SETQ DLst (CONS (LIST n m)
									    DLst]
	    (RETURN DLst])

(FindChannel
  [LAMBDA (l dlst)                                           (* agb: "17-Jun-86 09:38")
    (PROG NIL
	    (for i in l as nn from 0 when (NOT (MEMB nn PlaceUp))
	       do (PlaceChannel nn dlst l))
	    (for nn in PlaceUp do (PlaceChannel nn dlst l NIL T))
	    (RETURN PlaceResult])

(InsertChannel
  [LAMBDA (m n rte)                                          (* agb: "16-Jun-86 15:16")
    [if (IGEQ m (LENGTH PlaceResult))
	then (SETQ PlaceResult (NCONC PlaceResult (for i from 0 to (DIFFERENCE
										 m
										 (LENGTH 
										      PlaceResult))
							   collect NIL]
    (SETQ chlist (NTH PlaceResult (ADD1 m)))
    (if (NOT (CompatChannel rte (CAR chlist)))
	then (HELP))
    (RPLACA chlist (NCONC1 (CAR chlist)
			       rte))
    (SETQ Placed (CONS (LIST n m)
			   Placed])

(PlaceChannel
  [LAMBDA (chanN dlst lplst trail upFlg)                     (* agb: " 5-Jul-86 12:12")
    (PROG (depend minChan)
	    (SETQ minChan (OR (CADR (ASSOC chanN MinHeightList))
				  0))
	    (if (OR (ASSOC chanN Placed)
			(MEMB chanN (CDR trail)))
		then (RETURN))
	    (SETQ depend (CDR (FindMultDepend chanN dlst NIL)))
	    (for ii in depend do (PlaceChannel ii dlst lplst (CONS ii trail)))
	    [for ii in depend do (SETQ minChan (MAX minChan (OR (CADR (ASSOC ii 
											   Placed))
									    0]
	    (if (NOT upFlg)
		then (TryChannelList (CADR (NTH lplst chanN))
					 chanN minChan)
	      else (TryChannelListRev (CADR (NTH lplst chanN))
					  chanN minChan))
	    (RETURN])

(TryChannelListRev
  [LAMBDA (a n m)                                            (* agb: "17-Jun-86 08:47")
    (PROG (ch1 chlist)
	    (SETQ m (SUB1 (LENGTH PlaceResult)))
	l1  (SETQ chlist (NTH PlaceResult (ADD1 m)))
	    (SETQ ch1 (CDR chlist))
	    (COND
	      ((EQ m 0)
		(SETQ Placed (CONS (LIST n m)
				       Placed))
		(NCONC1 PlaceResult (LIST a))
		(RETURN)))
	    (COND
	      ((CompatChannel a (CAR chlist))
		(RPLACA chlist (NCONC1 (CAR chlist)
					   a))
		(SETQ Placed (CONS (LIST n m)
				       Placed))
		(RETURN)))
	    (SETQ m (SUB1 m))
	    (GO l1])

(TryChannelList
  [LAMBDA (a n m)                                            (* agb: "16-Jun-86 15:53")
    (PROG (ch1 chlist)
	    (SETQ chlist (NTH PlaceResult (ADD1 m)))
	    (SETQ ch1 (CDR chlist))
	l1  (COND
	      ((NULL ch1)
		(SETQ Placed (CONS (LIST n m)
				       Placed))
		(NCONC1 PlaceResult (LIST a))
		(RETURN)))
	    (COND
	      ((CompatChannel a (CAR ch1))
		(RPLACA ch1 (NCONC1 (CAR ch1)
					a))
		(SETQ Placed (CONS (LIST n m)
				       Placed))
		(RETURN)))
	    (SETQ ch1 (CDR ch1))
	    (SETQ m (ADD1 m))
	    (GO l1])

(TryChannel
  [LAMBDA (a chan)                                           (* agb: "16-JUN-84 23:10")
    (COND
      ((CompatChannel a chan)
	(NCONC1 chan a])

(Compat
  [LAMBDA (a b)                                              (* edited: " 3-Dec-85 17:19")
    (AND (OR (ILESSP (IPLUS 8 (CADR a))
			   (CAR b))
		 (ILESSP (IPLUS 8 (CADR b))
			   (CAR a])

(CompatChannel
  [LAMBDA (a chan)                                           (* agb: "16-JUN-84 23:00")
    (for i in chan always (Compat a i])

(FindDepend
  [LAMBDA (n lst)                                            (* edited: " 3-Dec-85 18:50")
    (PROG (x1)
	    (SETQ x1 (for i in lst when (EQ n (CAR i)) collect (CADR i)))
	    (RETURN (INTERSECTION x1 x1])

(CheckDepend
  [LAMBDA (lst)                                              (* agb: "15-Jun-86 15:27")
    (PROG (DLst lst1)
	    [SETQ lst1 (for i in lst collect (if (ILESSP (CAR i)
								     (CADR i))
							 then i
						       else (LIST (CADR i)
								      (CAR i]
	    [for i in lst as n from 0 do (for j in lst as m from 0
						      when (NEQ i j)
						      do (if (DependA i j)
							       then (SETQ DLst
									(CONS (LIST n m)
										DLst)))
                                                             (* if (DependA j i) then (SETQ DLst 
							     (CONS (LIST m n T) DLst)))
							   ]
	    (RETURN (LIST lst1 DLst])

(DependA
  [LAMBDA (i j)                                              (* agb: "15-Jun-86 14:54")
    (AND (ILESSP (CAR i)
		     (PLUS 8 (CADR j)))
	   (IGREATERP (CAR i)
			(PLUS -8 (CADR j])

(FindMultDepend
  [LAMBDA (n lst trail)                                      (* edited: " 6-Dec-85 09:38")
    (PROG (x2)
	    (if (MEMB n trail)
		then (PRINTOUT T "Ignoring " n , trail T)
		       (RETURN NIL))
	    (SETQ x2 (FindDepend n lst))
	    [SETQ x3 (for i in x2 join (FindMultDepend i lst (CONS n trail]
	    (RETURN (CONS n (INTERSECTION x3 x3])
)
(* * Input)

(DEFINEQ

(GetNameList
  [LAMBDA NIL                                                (* agb: "16-Jun-86 16:18")
    (PROG (lst (k 0))
	    [MAPHASH NameArray (FUNCTION (LAMBDA (val key)
			   (SETQ lst (CONS (CONS key val)
					       lst]
	    (SORT lst T)
	    (RETURN (for i in lst join (Formatlst i k])

(NoteWire
  [LAMBDA (name loc dir)                                     (* agb: "15-Jun-86 14:32")
    (PUTHASH name (CONS (LIST loc dir)
			    (GETHASH name NameArray))
	       NameArray])

(NoteWireLst
  [LAMBDA (lst)                                              (* agb: "15-Jun-86 14:27")
    (for i in (CDR lst) do (NoteWire (CAR i)
					       (CADR i)
					       (CAR lst])

(Formatlst
  [LAMBDA (lst)                                              (* agb: " 5-Jul-86 12:17")
    (PROG (min max rte dFlg uFlg)
	    (if (NOT (CADDR lst))
		then (if (NOT (MEMBER (CAR lst)
					      SingleTermIgnore))
			   then (PRINTOUT T "Term has only one connection: " (CAR lst)
					    , lst T))
		       (RETURN NIL))
	    (SETQ min (for i in (CDR lst) when (OR (EQ (CADR i)
								     (QUOTE U))
							       (EQ (CADR i)
								     (QUOTE D)))
			   smallest (CAR i)))
	    (SETQ max (for i in (CDR lst) when (OR (EQ (CADR i)
								     (QUOTE U))
							       (EQ (CADR i)
								     (QUOTE D)))
			   largest (CAR i)))
	    (SETQ rte (LIST (CAR min)
				(CAR max)
				NIL
				(CDR lst)
				(CAR lst)
				k))
	    (for i in (CDR lst)
	       do (if (EQ (CADR i)
				(QUOTE MIN))
			then (SETQ MinHeightList (CONS (LIST k (CAR i))
							     MinHeightList)))
		    (if (EQ (CADR i)
				(QUOTE UU))
			then (SETQ uFlg T))
		    (if (EQ (CADR i)
				(QUOTE L))
			then (SETQ dFlg T)
			       [RPLACA rte (MIN leftExtend (PLUS -10 (OR (CAR rte)
										 0]
			       (InsertChannel (CAR i)
						k rte)
		      elseif (EQ (CADR i)
				     (QUOTE D))
			then (SETQ dFlg T)))
	    (if (OR uFlg (NOT dFlg))
		then (SETQ PlaceUp (NCONC1 PlaceUp k)))
	    (SETQ k (ADD1 k))
	    (RETURN (LIST rte])
)
(* * Routes)

(DEFINEQ

(DefineRouteA
  [LAMBDA NIL                                                (* agb: " 2-Aug-86 18:40")
    (MakePlaLoc (QUOTE Rom)
		  (QUOTE ((#UPC-0 -19)
			     (PHIMICRO -2)
			     (PHIOP 20)
			     (PHIPRE 38)))
		  -552
		  (QUOTE D))                               (* MakePlaLocOp (QUOTE Op) 
							     (QUOTE ((PHIOP 1))) 1610 (QUOTE U))
    (MakeListLoc (QUOTE RegMux)
		   0
		   (QUOTE U))
    (MakeListLoc (QUOTE CCode)
		   1446
		   (QUOTE U))
    (MakeWireLLoc (QUOTE R21Left)
		    0
		    (QUOTE L))
    (SpecifyLocs (QUOTE (RomLoc R21LeftLLoc RegMuxLoc CCodeLoc RouteAUp])

(DefineRouteB
  [LAMBDA NIL                                                (* agb: " 3-Aug-86 19:14")
    (MakeListLoc (QUOTE DP)
		   576
		   (QUOTE U))
    (MakeListLoc (QUOTE Side)
		   0
		   (QUOTE U))
    (MakeWireLoc (QUOTE R21Left)
		   0
		   (QUOTE D))
    (MakeWireLLoc (QUOTE R2Left)
		    0
		    (QUOTE L))
    (MakeListLoc (QUOTE RegMuxV)
		   404
		   (QUOTE D))
    (MakeListLoc (QUOTE OpV)
		   1783
		   (QUOTE D))
    (MakeListLoc (QUOTE Misc)
		   1964
		   (QUOTE D))
    (MakeListLoc (QUOTE Clock)
		   2359
		   (QUOTE D))
    (MakeListLoc (QUOTE PadLogic)
		   2892
		   (QUOTE D))
    (MakeListLoc (QUOTE PadConnect)
		   3106
		   (QUOTE D))
    (SpecifyLocs (QUOTE (DPLoc MiscLoc OpVLoc R2LeftLLoc R21LeftLoc PadLogicLoc PadConnectLoc 
				   ClockLoc RegMuxVLoc SideLoc RouteBUp])

(DefineRouteC
  [LAMBDA NIL                                                (* agb: "15-Jul-86 12:50")
    (MakeRamS)
    (MakeListLoc (QUOTE DSwap)
		   0
		   (QUOTE U))
    (MakeListLoc (QUOTE RamArray)
		   0
		   (QUOTE D))
    (SpecifyLocs (QUOTE (DSwapLoc RamArrayLoc])

(RouteA
  [LAMBDA (file)                                             (* agb: " 3-Aug-86 12:15")
    (DefineRouteA)
    (SETQ cnt (DoRoute (if file
			       then (CONCAT "ROUTEA" file)
			     else NIL)
			   -28 -4 -36 NIL -4))
    (if file
	then (MakeLocFiles file))
    cnt])

(RouteB
  [LAMBDA (file)                                             (* agb: " 3-Aug-86 11:30")
    (DefineRouteB)
    (DoRoute (if file
		   then (CONCAT "ROUTEB" file)
		 else NIL)
	       -5 0 -13])

(RouteC
  [LAMBDA (file)                                             (* agb: "15-Jul-86 19:25")
    (DefineRouteC)
    (DoRoute (if file
		   then (CONCAT "ROUTEC" file)
		 else NIL)
	       -26 0 -36 7])
)
(* * SpecVars)


(RPAQQ CCodeLocSpec ((@INITIALREFILL 0)
		       (#CONDA 8)
		       (#FRAMESFULL 16)
		       (@#FAULT 24)
		       (#ARG=0 32)
		       (#ARG=ARG2 40)
		       (#UCONDCODE-6 48)
		       (#UCONDCODE-5 56)
		       (#UCONDCODE-1 64)
		       (#UCONDCODE-0 72)
		       (#CONTREFILL 88)
		       (#REFILLRQ 96)
		       (#UNEXTINSTA-8 104)
		       (#UNEXTINSTB-8 112)
		       (#FORCENEWOP 120)
		       (#NEWOP 128)
		       (#SELNEXTINSTA 136)
		       (#SELNEXTINSTB 144)
		       (#WRITEOK 152)
		       (#UCWRITE~ 160)
		       (#REFILLRQ 190)
		       (#FORCENEWOP 198)))

(RPAQQ ClockLocSpec ((@RESET 8)
		       ($HOLD 16)
		       (#FAULT 24)
		       (#UCYCLE-0 32)
		       (#UCYCLE-1 40)
		       (#UCYCLE-2 48)
		       (#VMREFILL 56)
		       (@#FAULT 65)
		       ($NEWOP 80)
		       (PHIMICRO&NEWOP 96)
		       (PHIMICRO&WRITEOK 111)
		       ($WRITEOK 127)
		       ($NEWOP 141)
		       (#NEWOP 149)
		       (PHIOP 157)
		       ($WRITEOK 174)
		       (#WRITEOK 182)
		       (PHIPRE7 190)
		       (PRECHARGE 200)
		       (PHIPRE 208)
		       (PHICLOCK 223)
		       (CLOCK 231)
		       (PHIMICRO 247)
		       (+FIRSTCY 258)
		       (+SECONDCY 266)
		       (PHIOP 280)
		       (+MEMREAD 291)
		       (+WRITE 299)
		       (PHIFIRSTCY 313)
		       (+MEMDIR 324)
		       (+CASH 332)
		       (PHISECONDCY 346)
		       (+MEMCY 357)
		       (+WRITE-VMM 365)
		       (PHIREAD 379)
		       (+DORESET 390)
		       (@WRITE 398)
		       (@MEMDIR 412)
		       (@READ 423)
		       (@MEMREAD 431)
		       (PHIMEMREAD 445)
		       (@MEMWRITE 456)
		       (@QUAD-0 464)
		       (HOLDA 478)
		       (@QUAD-1 490)
		       (+READ 498)))

(RPAQQ DPLocSpec ((* Register array)
		    (PHICLOCK -278)
		    (PHIPRE -270)
		    (PHIPRE7 -1)
		    (#UDSWAP 15)
		    (* DSwap)
		    (@REGADDR~-0 27)
		    (+MEMREAD 65)
		    (+READ 73)
		    (#URD1ADDR-1 90)
		    (#URD1ADDR-0 100)
		    (PHICLOCK 130)
		    (#URD2ADDR-2 182)
		    (#URD2ADDR-1 192)
		    (#URD2ADDR-0 202)
		    (PHICLOCK 212)
		    (+WRITE 224)
		    (* EU)
		    (#UEUOP-0 236)
		    (#UEUOP-1 246)
		    (PHIFIRSTCY 300)
		    (#UEUOP-0 328)
		    (#UEUOP-2 352)
		    (PHISECONDCY 374)
		    (#UEUOP-3 424)
		    (#UTAG-1 442)
		    (#UTAG-0 450)
		    (* Cond Code)
		    (#UEUOP-2 516)
		    (#UEUOP-1 564)
		    (#UEUOP-2 582)
		    (#UEUOP-1 614)
		    (#UEUOP-0 630)
		    (PHISECONDCY 664)
		    (PHIFIRSTCY 672)
		    (PHISECONDCY 722)
		    (#UEUOP-5 732)
		    (#UEUOP-4 772)
		    (* Really EUOP-4 at 745)
		    (PHIFIRSTCY 756)
		    (#UEUOP-3 764)
		    (#UEUOP-1 808)
		    (#UEUOP-2 824)
		    (#UEUOP-0 858)
		    (PHISECONDCY 866)
		    (#UCONDCODE-0 876)
		    (#UCONDCODE-1 884)
		    (#UCONDCODE-2 892)
		    (#UCONDCODE-3 900)
		    (#UCONDCODE-4 908)
		    (#CONDA 1268)
		    (* Bus connect)
		    (D2-0 1284)
		    (D2-1 1292)
		    (D2-2 1300)
		    (D2-3 1308)
		    (D2-4 1316)
		    (D2-5 1324)
		    (D2-6 1332)
		    (D2-7 1340)
		    (#NCURPC-0 1356)
		    (#NCURPC-1 1364)
		    (RDPCD2 1379)
		    (#NCURPC-2 1387)
		    (#NCURPC-3 1395)
		    (#NCURPC-4 1403)
		    (* IBuf)
		    (#IBUFN-0 1412)
		    (#IBUFN-1 1420)
		    (#IBUFN-2 1428)
		    (#IBUFN-3 1436)
		    (#IBUFN-4 1444)
		    (#IBUFN-5 1452)
		    (#IBUFN-6 1460)
		    (#IBUFN-7 1468)
		    (#OPCODE-0 1476)
		    (#OPCODE-1 1484)
		    (#OPCODE-2 1492)
		    (#OPCODE-3 1500)
		    (#OPCODE-4 1508)
		    (#OPCODE-5 1516)
		    (#OPCODE-6 1524)
		    (#OPCODE-7 1532)
		    (#URD1ADDR-0 1561)
		    (#URD1ADDR-1 1571)
		    (+READ 1581)
		    (PHICLOCK 1591)
		    ($OPLENGTH-0 1631)
		    ($OPLENGTH-1 1641)
		    (PHIMICRO&NEWOP 1653)
		    ($OPLENGTH-2 1663)
		    (@RDMUXSEL 1673)
		    (#NCURPC-0 1691)
		    (#NCURPC-1 1699)
		    (PHIOP 1714)
		    ($OPLENGTH=0 1750)
		    (PHIMICRO 1758)
		    (#NCURPC-2 1776)
		    (#$OPLENGTH-2 1790)
		    (#$OPLENGTH-1 1806)
		    (#$OPLENGTH-0 1818)
		    (PHIMICRO&NEWOP 1846)
		    ($OPLENGTH-0 1856)
		    ($OPLENGTH-1 1883)
		    ($OPLENGTH-2 1892)
		    (PHICLOCK 1938)
		    (PHIPRE 1946)
		    (IBUFWTSIGNAL 1956)
		    (#$OPLENGTH-2 1986)
		    (#$OPLENGTH-1 1995)
		    (#$OPLENGTH-0 2005)
		    (PHIPRE 2014)
		    (@QUAD-0 2029)
		    (@QUAD-1 2037)
		    (PHICLOCK 2045)
		    (+READ 2053)
		    (PHIMICRO&NEWOP 2065)
		    (PHIOP 2073)
		    (#URD2ADDR-2 2081)
		    (#URD2ADDR-1 2090)
		    (#URD2ADDR-0 2112)
		    (#CONTREFILL 2123)
		    (#NCURPC-4 2134)
		    (#NCURPC-0 2145)
		    (* Special Registers)
		    (PHICLOCK 2154)
		    (+READ 2165)
		    (#URD2ADDR-2 2175)
		    (#URD2ADDR-1 2185)
		    (#URD2ADDR-0 2193)
		    (#NCURPC-1 2203)
		    (#NCURPC-2 2212)
		    (#URD1ADDR-1 2220)
		    (#URD1ADDR-0 2228)
		    (PHIOP 2236)
		    (@RDMUXSEL 2247)
		    (#NCURPC-3 2255)
		    (RDPCD2 2281)
		    (IBUFWTSIGNAL 2395)
		    ($NEWOP 2466)
		    (PHIMICRO 2479)
		    (PHICLOCK 2497)
		    (PHIPRE 2506)
		    (#UW2ADDR-0 2516)
		    (#UW2ADDR-1 2543)
		    (#UW2ADDR-2 2571)
		    (#NCURPC-4 2585)
		    (+WRITE 2593)
		    (+MEMREAD 2617)
		    (+SECONDCY 2625)
		    (+FIRSTCY 2649)
		    (* Virtual Memory)
		    (PHIPRE 2755)
		    (#FAULT 2763)
		    (@MEMDIR 2783)
		    (+WRITE-VMM 2808)
		    (PHICLOCK 2823)
		    (+FIRSTCY 2841)
		    (@RESET-VMM 2855)
		    (#VMREFILL 2863)
		    (SELRAS/CAS~ 2989)
		    (* Ras-Cas Mux)
		    (RADDR-11 3004)
		    (RADDR-10 3012)
		    (RADDR-9 3020)
		    (RADDR-8 3028)
		    (RADDR-7 3036)
		    (RADDR-6 3044)
		    (RADDR-5 3052)
		    (RADDR-4 3060)
		    (RADDR-3 3068)
		    (RADDR-2 3076)
		    (RADDR-1 3084)
		    (RADDR-0 3092)))

(RPAQQ LeftWireSpec (#UMISC-0 #UMISC-1 #UMISC-2 #UMISC-3 #UMISC-4 #UCYCLE-0 #UCYCLE-1 #UCYCLE-2 
				#UDSWAP #UEUOP-0 #UEUOP-1 #UEUOP-2 #UEUOP-3 #UEUOP-4 #UEUOP-5 #UTAG-0 
				#UTAG-1 #UCONDCODE-3 #UCONDCODE-4 #URD1ADDR-0 #URD1ADDR-1 #URD2ADDR-0 
				#URD2ADDR-1 #URD2ADDR-2 #UW2ADDR-0 #UW2ADDR-1 #UW2ADDR-2 @RDMUXSEL 
				@WRITE PHIPRE PHIMICRO PHIOP PHIMICRO&WRITEOK #FAULT #CONDA 
				#UCONDCODE-0 #UCONDCODE-1 #UCONDCODE-2 #UCONDCODE-5 #INTERRUPT 
				+DORESET #$REFCNT #REFRESH #$STACKREFILL @INITIALREFILL #CONTREFILL 
				#WRITEOK #NEWOP #OPCODE-0 #OPCODE-1 #OPCODE-2 #OPCODE-3 #OPCODE-4 
				#OPCODE-5 #OPCODE-6 #OPCODE-7 #OPLENGTH-0 #OPLENGTH-1 #OPLENGTH-2))

(RPAQQ MiscLocSpec ((PHIOP 0)
		      (#REFRESH 8)
		      (@WRITEOCTAL~ 16)
		      (@RESET-VMM 24)
		      (REFRESH 52)
		      ($OPLENGTH=0 60)
		      (PHIMICRO 92)
		      (#INTERRUPT 84)
		      (@INITIALREFILL 104)
		      (INTERRUPT 116)
		      (#$STACKREFILL 124)
		      (@RESET 136)
		      (#$REFCNT 144)
		      (PHIPRE 156)
		      (PHICLOCK 164)
		      (OUTPUTINTERRUPT 172)
		      (RESET 180)
		      ($HOLD 192)
		      (HOLD 204)
		      (#UMISC-4 220)
		      (#UMISC-3 228)
		      (#UMISC-2 236)
		      (#UMISC-1 244)
		      (#UMISC-0 252)))

(RPAQQ NEWDPLocSpec ((* Register array)
		       (PHICLOCK -1)
		       (PHIPRE 7)
		       (#UDSWAP 15)
		       (* DSwap)
		       (@REGADDR~-0 27)
		       (+MEMREAD 65)
		       (#URD1ADDR-1 95)
		       (#URD1ADDR-0 105)
		       (#URD2ADDR-2 127)
		       (#URD2ADDR-1 137)
		       (#URD2ADDR-0 147)
		       (#UW2ADDR-2 159)
		       (#UW2ADDR-1 171)
		       (#UW2ADDR-0 181)
		       (* EU)
		       (#UEUOP-0 193)
		       (#UEUOP-1 203)
		       (PHIFIRSTCY 257)
		       (#UEUOP-0 285)
		       (#UEUOP-1 309)
		       (PHISECONDCY 331)
		       (#UEUOP-1 351)
		       (#UEUOP-3 381)
		       (#UTAG-1 400)
		       (#UTAG-0 407)
		       (* Cond Code)
		       (#UEUOP-2 473)
		       (#UEUOP-1 521)
		       (#UEUOP-2 539)
		       (#UEUOP-1 571)
		       (#UEUOP-0 587)
		       (#UEUOP-5 597)
		       (#UEUOP-4 605)
		       (PHISECONDCY 621)
		       (PHIFIRSTCY 629)
		       (#UEUOP-5 643)
		       (#UEUOP-4 655)
		       (PHISECONDCY 679)
		       (PHIFIRSTCY 713)
		       (#UEUOP-3 721)
		       (#UEUOP-2 765)
		       (#UEUOP-1 781)
		       (#UEUOP-0 815)
		       (PHISECONDCY 823)
		       (#UCONDCODE-0 833)
		       (#UCONDCODE-1 841)
		       (#UCONDCODE-2 849)
		       (#UCONDCODE-3 857)
		       (#UCONDCODE-4 865)
		       (#CONDA 1225)
		       (* Bus connect)
		       (D2-0 1241)
		       (D2-1 1249)
		       (D2-2 1257)
		       (D2-3 1265)
		       (D2-4 1273)
		       (D2-5 1281)
		       (D2-6 1289)
		       (D2-7 1297)
		       (* IBuf)
		       (#OPCODE-0 1369)
		       (#OPCODE-1 1377)
		       (#OPCODE-2 1385)
		       (#OPCODE-3 1393)
		       (#OPCODE-4 1401)
		       (#OPCODE-5 1409)
		       (#OPCODE-6 1417)
		       (#OPCODE-7 1425)
		       (#IBUFN-0 1433)
		       (#IBUFN-1 1441)
		       (#IBUFN-2 1449)
		       (#IBUFN-3 1457)
		       (#IBUFN-4 1465)
		       (#IBUFN-5 1473)
		       (#IBUFN-6 1481)
		       (#IBUFN-7 1489)
		       (#OPLENGTH-0 1588)
		       (#OPLENGTH-1 1598)
		       (#OPLENGTH-2 1620)
		       (PHIOP 1532)
		       (@RDMUXSEL 1630)
		       (PHIMICRO&NEWOP 1652)
		       (PHICLOCK 1833)
		       (PHIPRE 1841)
		       (#OPLENGTH-2 1881)
		       (#OPLENGTH-1 1890)
		       (#OPLENGTH-0 1900)
		       (+WRITE 1916)
		       (+QUAD-0 1924)
		       (+QUAD-1 1932)
		       (PHIMICRO&NEWOP 1960)
		       (PHIOP 1968)
		       (#CONTREFILL 1548)
		       (#$OPLENGTH=0 1994)
		       (* Special Registers)
		       (* #URD1ADDR-1 1900)
		       (* #URD1ADDR-0 1908)
		       (* #URD2ADDR-2 1916)
		       (* #URD2ADDR-1 1924)
		       (* #URD2ADDR-0 1932)
		       (* #UW2ADDR-2 1940)
		       (* #UW2ADDR-1 1948)
		       (* #UW2ADDR-0 1956)
		       (+SECONDCY 1972)
		       (+FIRSTCY 1980)
		       (+MEMREAD 1988)
		       (+WRITE 1996)
		       (PHIMICRO 2004)
		       (PHIMICRO&NEWOP 2012)
		       (* Virtual Memory)
		       (+FIRSTCY 2300)
		       (PHIMICRO 2308)
		       (#NEWOP 2316)
		       (@RESET-VMM 2324)
		       (#FAULT 2332)
		       (#VMREFILL 2340)
		       (+WRITE-VMM 2348)
		       (* Ras-Cas Mux)
		       (SELRAS/CAS~ 2530)
		       (RADDR-11 2543)
		       (RADDR-10 2551)
		       (RADDR-9 2559)
		       (RADDR-8 2567)
		       (RADDR-7 2575)
		       (RADDR-6 2583)
		       (RADDR-5 2591)
		       (RADDR-4 2599)
		       (RADDR-3 2607)
		       (RADDR-2 2615)
		       (RADDR-1 2623)
		       (RADDR-0 2631)))

(RPAQQ OldR2LeftWireSpec (NIL #UMISC-0 NIL NIL #UMISC-1 NIL NIL #UMISC-2 NIL #UMISC-3 NIL NIL 
				#UMISC-4 NIL NIL #UCYCLE-0 NIL NIL #UCYCLE-1 NIL #UCYCLE-2 NIL NIL 
				#URD2ADDR-0 NIL NIL NIL #URD2ADDR-1 NIL NIL #URD2ADDR-2 NIL NIL 
				#UEUOP-2 NIL NIL #URD1ADDR-1 NIL NIL #UTAG-0 NIL #UTAG-1 NIL NIL 
				#UEUOP-3 NIL NIL #UEUOP-1 NIL NIL #URD1ADDR-0 NIL #UEUOP-0 NIL NIL 
				NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL NIL #UDSWAP @WRITE @READ 
				#WRITEOK @REGADDR~-0 @REGADDR~-1 @WRITEOCTAL~ @REGADDR~-2 @REGADDR~-3 
				@REGADDR~-4 @REGADDR~-5 @REGCXT~-0 @REGCXT~-1 @REGCXT~-2))

(RPAQQ OpVLocSpec ((+DORESET 128)
		     (#INTERRUPT 120)
		     (#$REFCNT 112)
		     (#REFRESH 104)
		     (#$STACKREFILL 96)
		     (#OPCODE-0 88)
		     (#OPCODE-1 80)
		     (#OPCODE-2 72)
		     (#OPCODE-3 64)
		     (#OPCODE-4 56)
		     (#OPCODE-5 48)
		     (#OPCODE-6 40)
		     (#OPCODE-7 32)
		     (PHIOP 24)
		     ($OPLENGTH-2 16)
		     ($OPLENGTH-1 8)
		     ($OPLENGTH-0 0)))

(RPAQQ PadConnectLocSpec ((REFRESH 0)
			    (HOLDA 8)
			    (HOLD 16)
			    (OUTPUTINTERRUPT 24)
			    (RESET 32)
			    (INTERRUPT 40)
			    (CLOCKD10 48)
			    (CLOCKD35 56)
			    (CLOCK 64)
			    (PRECHARGE 72)
			    (WE~ 80)
			    (CAS~ 88)
			    (RAS~-0 96)
			    (RAS~-1 104)
			    (RAS~-2 112)
			    (RAS~-3 120)
			    (RADDR-0 128)
			    (RADDR-1 136)
			    (RADDR-2 144)
			    (RADDR-3 152)
			    (RADDR-4 160)
			    (RADDR-5 168)
			    (RADDR-6 176)
			    (RADDR-7 184)
			    (RADDR-8 192)
			    (RADDR-9 200)
			    (HOLDA 208)
			    (* Actually RPADENB~)
			    (DPADENB~ 216)
			    (PHIREAD 224)
			    (PHIPRE 232)
			    (PHIMEMREAD 240)
			    (D2-0 248)
			    (D2-1 256)
			    (D2-2 264)
			    (D2-3 272)))

(RPAQQ PadLogicLocSpec ((PHIPRE 0)
			  (@MEMWRITE 8)
			  (@MEMREAD 32)
			  (CLOCKD35 42)
			  (+CASH 50)
			  (HOLDA 58)
			  (#VMREFILL 67)
			  (+MEMDIR 77)
			  (RADDR-10 86)
			  (PHICLOCK 94)
			  (RADDR-11 102)
			  (#FAULT 115)
			  (+MEMCY 126)
			  (CLOCKD10 134)
			  (SELRAS/CAS~ 150)
			  (RAS~-2 158)
			  (RAS~-0 166)
			  (RAS~-3 174)
			  (RAS~-1 182)
			  (WE~ 190)
			  (DPADENB~ 198)
			  (CAS~ 206)))

(RPAQQ R21LeftWireSpec (#UEUOP-4 #UEUOP-5 #UW2ADDR-0 #UW2ADDR-1 #UW2ADDR-2 #UCONDCODE-3 
				   #UCONDCODE-4 #UCONDCODE-2 #UDSWAP @WRITE @RDMUXSEL 
				   PHIMICRO&WRITEOK PHIMICRO&NEWOP @INITIALREFILL #CONDA @#FAULT 
				   #UCONDCODE-1 #UCONDCODE-0 PHIMICRO #CONTREFILL PHIOP PHIPRE #NEWOP 
				   #WRITEOK))

(RPAQQ R2LeftWireSpec (NIL #UMISC-0 NIL NIL #UMISC-1 NIL NIL #UMISC-2 NIL #UMISC-3 NIL NIL #UMISC-4 
			     NIL NIL #UCYCLE-0 NIL NIL #UCYCLE-1 NIL #UCYCLE-2 NIL NIL #URD2ADDR-0 
			     NIL NIL NIL #URD2ADDR-1 NIL NIL #URD2ADDR-2 NIL NIL #UEUOP-2 NIL NIL 
			     #URD1ADDR-1 NIL NIL #UTAG-0 NIL #UTAG-1 NIL NIL #UEUOP-3 NIL NIL 
			     #UEUOP-1 NIL NIL #URD1ADDR-0 NIL #UEUOP-0))

(RPAQQ RegMuxLocSpec ((#URADDR-0 8)
			(#URADDR-1 32)
			(#URADDR-2 75)
			(@WRITE 116)
			(#UWADDR-2 146)
			(#UWADDR-1 186)
			(#UWADDR-0 214)
			(#URCXT-0 240)
			(#URCXT-1 264)
			(#URCXT-2 307)
			(@WRITE 348)
			(#UWCXT-2 378)
			(#UWCXT-1 418)
			(#UWCXT-0 446)
			(#UMUXRDSEL-1 483)
			(#UMUXRDSEL-2 516)
			(#UMUXRDSEL-0 553)
			(#UNEWARG-1 603)
			(#UNEWARG-2 636)
			(#UNEWARG-0 673)
			(#UNEWARG2-0 714)
			(#UNEWARG2-1 736)
			(#UNEWTOS-1 787)
			(#UNEWTOS-2 820)
			(#UNEWTOS-0 857)
			(#UNEWTOPCXT-0 898)
			(#UNEWTOPCXT-1 920)
			(#UNEWBOTCXT-0 963)
			(#UNEWBOTCXT-1 985)
			(#UK-0 1018)
			(#UK-1 1026)
			(#UK-2 1034)
			(#UK-3 1042)
			(#UK-4 1050)
			(#UK-5 1058)
			(#UK-6 1066)
			(#UK-7 1074)
			(#UK-8 1082)
			(@RDMUXSEL 1170)
			(#UARG'-1 1210)
			(#UTOS' 1222)
			(#UARG'-0 1234)
			(PHIMICRO&NEWOP 1334)
			(#ARG=ARG2 1342)
			(#ARG=0 1354)
			(#FRAMESFULL 1366)
			(* #FRAMESEMPTY 1374)
			(PHIMICRO&WRITEOK 1308)
			(PHIMICRO 1300)
			(PHIOP 1316)))

(RPAQQ RegMuxVLocSpec ((@REGCXT~-2 1361)
			 (@REGCXT~-1 1312)
			 (D2-7 1280)
			 (#IBUFN-7 1232)
			 (@REGCXT~-0 1135)
			 (D2-6 1103)
			 (#IBUFN-6 1055)
			 (D2-5 950)
			 (@REGADDR~-5 918)
			 (#IBUFN-5 910)
			 (D2-4 789)
			 (@REGADDR~-4 757)
			 (#IBUFN-4 749)
			 (D2-3 628)
			 (@REGADDR~-3 596)
			 (#IBUFN-3 588)
			 (D2-2 467)
			 (@REGADDR~-2 435)
			 (#IBUFN-2 427)
			 (D2-1 306)
			 (@QUAD-1 290)
			 (@REGADDR~-1 274)
			 (#IBUFN-1 266)
			 (D2-0 145)
			 (@QUAD-0 129)
			 (@REGADDR~-0 113)
			 (#IBUFN-0 105)))

(RPAQQ RouteAUp (MIN (#UARG'-0 4)
		       (#UARG'-1 4)
		       (#UTOS' 5)
		       (#UCONDCODE-6 7)
		       (#UCONDCODE-5 7)
		       (#UCWRITE~ 5)
		       (#UNEXTINSTA-8 5)
		       (#UNEXTINSTB-8 5)))

(RPAQQ RouteBLocSpec ((GND1 0)
			(GND2 0)
			(GND3 0)))

(RPAQQ RouteBUp NIL)

(RPAQQ SideLocSpec ((@WRITE 0)
		      (@READ 8)
		      ($WRITEOK 16)
		      (@REGADDR~-0 24)
		      (@REGADDR~-1 32)
		      (@WRITEOCTAL~ 40)
		      (@REGADDR~-2 48)
		      (@REGADDR~-3 56)
		      (@REGADDR~-4 64)
		      (@REGADDR~-5 72)
		      (@REGCXT~-0 80)
		      (@REGCXT~-1 88)
		      (@REGCXT~-2 96)))

(RPAQQ SingleTermIgnore (#UPC-0 #UPC-1 #UPC-2 #UPC-3 #UPC-4 #UPC-5 #UPC-6 #UPC-7 #UNEXTINSTA-0 
				  #UNEXTINSTA-1 #UNEXTINSTA-2 #UNEXTINSTA-3 #UNEXTINSTA-4 
				  #UNEXTINSTA-5 #UNEXTINSTA-6 #UNEXTINSTA-7 #UNEXTINSTB-0 
				  #UNEXTINSTB-1 #UNEXTINSTB-2 #UNEXTINSTB-3 #UNEXTINSTB-4 
				  #UNEXTINSTB-5 #UNEXTINSTB-6 #UNEXTINSTB-7 #MODSTARTADDR 
				  #MODSTARTADDR~ #SELNEXTINSTA #SELNEXTINSTB #STARTADDR-0 
				  #STARTADDR-1 #STARTADDR-2 #STARTADDR-3 #STARTADDR-4 #STARTADDR-5 
				  #STARTADDR-6 #STARTADDR-7))
(* * Input Generation)

(DEFINEQ

(MakeListLoc
  [LAMBDA (nm offset dir)                                    (* agb: "24-Jul-86 20:12")
    (PROG (a term x)
	    [SETQ a (EVALV (MKATOM (CONCAT nm "LocSpec"]
	    [SETQ term (for i in a when (NEQ (CAR i)
						       (QUOTE *))
			    collect (LIST (CAR i)
					      (PLUS (OR offset 0)
						      (CADR i]
	    (SET (MKATOM (CONCAT nm "Loc"))
		   (SETQ x (APPEND (LIST (OR dir (QUOTE D)))
				       term)))
	    (RETURN x])

(MakePlaLocOp
  [LAMBDA (nm wires offset dir)                              (* agb: "25-Jun-86 18:42")
    (PROG (a interm outterm start x extra)
	    [SETQ a (EVALV (MKATOM (CONCAT nm "PlaSlimSpec"]
	    (SETQ start (PLUS 52 (OR offset 0)))
	    [SETQ interm (for i in (CAR a) collect (PROG1 (LIST (CAR i)
									      start)
								      (SETQ start (PLUS 16 start]
	    [SETQ extra (for i in wires collect (LIST (CAR i)
								(PLUS start (CADR i]
	    (SETQ start (PLUS 15 start))
	    [SETQ outterm (for i in (CADR a) as n from 0
			       collect (PROG1 (LIST (CAR i)
							  start)
						  (SETQ start (PLUS start (if (EVENP n)
										  then 11
										else 11]
	    (SET (MKATOM (CONCAT nm "Loc"))
		   (SETQ x (APPEND (LIST (OR dir (QUOTE D)))
				       outterm interm extra)))
	    (RETURN x])

(MakeWireLLoc
  [LAMBDA (nm offset dir)                                    (* agb: "17-Jun-86 10:31")
    (PROG (a term x)
	    [SETQ a (EVALV (MKATOM (CONCAT nm "WireSpec"]
	    (SETQ term (for i in a as n from (OR offset 0) when i
			    collect (LIST i n)))
	    (SET (MKATOM (CONCAT nm "LLoc"))
		   (SETQ x (APPEND (LIST (OR dir (QUOTE D)))
				       term)))
	    (RETURN x])

(MakeWireLoc
  [LAMBDA (nm offset dir incr)                               (* agb: "17-Jun-86 10:31")
    (PROG (a term x)
	    [SETQ a (EVALV (MKATOM (CONCAT nm "WireSpec"]
	    (SETQ term (for i in a as n from (OR offset 0) by (OR incr 8)
			    collect (LIST i n)))
	    (SET (MKATOM (CONCAT nm "Loc"))
		   (SETQ x (APPEND (LIST (OR dir (QUOTE D)))
				       term)))
	    (RETURN x])

(SpecifyLocs
  [LAMBDA (locs)                                             (* agb: "27-Jun-86 18:55")
    (SETQ NameArray (HARRAY 200))
    (for i in locs do (NoteWireLst (EVALV i])

(MakePlaLoc
  [LAMBDA (nm wires offset dir)                              (* agb: "18-Jun-86 14:11")
    (PROG (a interm outterm start x)
	    [SETQ a (EVALV (MKATOM (CONCAT nm "PlaSlimSpec"]
	    (SETQ start (PLUS 52 (OR offset 0)))
	    [SETQ outterm (for i in (REVERSE (CADR a)) as n
			       from (PLUS 15 (LENGTH (CADR a))) by -1
			       collect (PROG1 (LIST (CAR i)
							  start)
						  (SETQ start
						    (PLUS start (if (EQ 0 (IREMAINDER n 16))
								      then 36
								    else 22]
	    [SETQ extra (for i in wires collect (LIST (CAR i)
								(PLUS start (CADR i]
	    (SETQ start (PLUS 64 start))
	    [SETQ interm (for i in (REVERSE (CAR a)) collect (PROG1
									   (LIST (CAR i)
										   start)
									   (SETQ start
									     (PLUS 16 start]
	    (SET (MKATOM (CONCAT nm "Loc"))
		   (SETQ x (APPEND (LIST (OR dir (QUOTE D)))
				       outterm interm extra)))
	    (RETURN x])
)
(* * Special Input Gen)

(DEFINEQ

(MakeRamS
  [LAMBDA NIL                                                (* agb: "24-Jul-86 20:10")
    (SETQ n 56)
    (SETQ offset (PLUS -7 465 432))
    (SETQ RamArrayLocSpec NIL)
    [SETQ RamArrayLocSpec (NCONC RamArrayLocSpec (for i from 30 to 24 by -2
							join (PROG1 (MakRam4 i n offset)
									(SETQ n (PLUS n 27]
    (SETQ n (PLUS n 15))
    [SETQ RamArrayLocSpec (NCONC RamArrayLocSpec (for i from 22 to 16 by -2
							join (PROG1 (MakRam4 i n offset)
									(SETQ n (PLUS n 27]
    (SETQ n (PLUS n 15))
    [SETQ RamArrayLocSpec (NCONC RamArrayLocSpec (for i from 14 to 7 by -2
							join (PROG1 (MakRam4 i n offset)
									(SETQ n (PLUS n 27]
    (SETQ n (PLUS n 15))
    [SETQ RamArrayLocSpec (NCONC RamArrayLocSpec (for i from 6 to 0 by -2
							join (PROG1 (MakRam4 i n offset)
									(SETQ n (PLUS n 27]
    (SETQ n 115)
    (SETQ DSwapLocSpec (for i from 0 to 31 as k from 31 to 0
			    join (LIST (LIST (MKATOM (CONCAT "RO-" k))
						   (PLUS n (TIMES i 42)))
					   (LIST (MKATOM (CONCAT "RE-" k))
						   (PLUS 26 n (TIMES i 42])

(MakRam4
  [LAMBDA (i n offset)                                       (* agb: "15-Jul-86 14:44")
    (LIST (mn (QUOTE RO-)
		  (ADD1 i)
		  n)
	    (mn (QUOTE RO-)
		  i
		  (PLUS n 14))
	    (mn (QUOTE RE-)
		  (ADD1 i)
		  (PLUS n offset))
	    (mn (QUOTE RE-)
		  i
		  (PLUS n offset 14])

(mn
  [LAMBDA (prefix i n)                                       (* agb: "15-Jul-86 12:00")
    (LIST (MKATOM (CONCAT prefix i))
	    n])
)
(DEFINEQ

(MakLP2
  [LAMBDA NIL                                                (* edited: "21-Nov-85 19:37")
    (SETQ LP2 (APPEND (for i from 0 to 63 by 8 collect i)
			  (for i from 2 to 63 by 8 collect i)
			  (for i from 4 to 63 by 8 collect i)
			  (for i from 6 to 63 by 8 collect i)
			  (for i from 1 to 63 by 8 collect i)
			  (for i from 3 to 63 by 8 collect i)
			  (for i from 5 to 63 by 8 collect i)
			  (for i from 7 to 63 by 8 collect i])

(MakeIBufRoute
  [LAMBDA NIL                                                (* agb: "15-Jan-86 13:42")
    (PROG (l1)
	    (SETQ l1 0)
	    (RETURN (for i from 0 to 3
			 join (for ii from 0 to 7
				   collect (PROG1 (LIST (if (ILESSP l1 8)
								  then (TIMES l1 -20)
								else (WirePos l1 0))
							      (WirePos (PLUS i (TIMES ii 4))
									 20))
						      (SETQ l1 (ADD1 l1])

(MakeIBufSpaces
  [LAMBDA NIL                                                (* edited: " 6-Dec-85 09:47")
    (SETQ n 0)
    [SETQ LPa (for i from 0 to 7 join (for j from 0 to 3
						   collect (TIMES 40 (PLUS i (TIMES j 8]
    (SETQ n 20)
    [SETQ LPb (APPEND (for i from 0 to 31 collect (PLUS n (TIMES i 40]
    (SETQ LPres1 (for i in LPa as j in LPb collect (LIST j i])

(MakeInputList
  [LAMBDA (lst)                                              (* edited: "21-Nov-85 19:35")
    (PROG (t1)
	    [SETQ t1 (for i in lst as j from 0 collect (LIST (ITIMES j 2)
									   (ADD1 (ITIMES i 2]
	    [SETQ t1 (for i in t1 collect (COND
						    ((ILESSP (CAR i)
							       (CADR i))
						      i)
						    (T (LIST (CADR i)
							       (CAR i]
                                                             (* SORT t1 (FUNCTION (LAMBDA 
							     (a b) (ILESSP (CAR a) (CAR b)))))
	    (RETURN t1])
)
(* * Output)

(DEFINEQ

(ShowRoute
  [LAMBDA (lst)                                              (* agb: "16-Jun-86 21:25")
    (for i in (CDR lst) as y from 20 by 3
       do (for j in i
	       do (DRAWLINE (ChX (CAR j))
				y
				(ChX (CADR j))
				y NIL NIL xWIN)
		    (for k in (CADDDR j) when (OR (EQ (QUOTE U)
								  (CADR k))
							    (EQ (QUOTE D)
								  (CADR k)))
		       do (DRAWLINE (ChX (CAR k))
					y
					(ChX (CAR k))
					(if (EQ (QUOTE U)
						    (CADR k))
					    then 300
					  else 0)
					NIL NIL xWIN])

(ChX
  [LAMBDA (x)                                                (* agb: "16-Jun-86 14:52")
    (IQUOTIENT (PLUS 400 x)
		 4])

(DrawChannel
  [LAMBDA (chlist)                                           (* agb: "17-JUN-84 10:56")
    (for i in chlist as j from 0 do (for k in i
						 do (DRAWLINE (IPLUS (ITIMES j 4)
									   20)
								  (IPLUS (ITIMES (CAR k)
										     4)
									   20)
								  (IPLUS (ITIMES j 4)
									   20)
								  (IPLUS (ITIMES (CADR k)
										     4)
									   20)
								  1
								  (QUOTE PAINT)
								  fwin])

(MakeCif
  [LAMBDA (rte file extDwn extUp offset start)               (* agb: " 3-Aug-86 11:26")
    (PROG (size)
	    (if (NOT start)
		then (SETQ start 8))
	    (if (NOT offset)
		then (SETQ offset 8))
	    (ChipHdr file)
	    [SETQ size (PLUS 16 (TIMES 8 (LENGTH rte]
	    (for i in rte as n from start by offset
	       do (for j in i do (MakeCifRte size n (if (CADDR j)
								  then (LIST (CADR j)
										 (CAR j))
								else j)
						       extDwn extUp)))
	    (ChipTrailer])

(MakeCifRte
  [LAMBDA (size pos rte extDwn extUp)                        (* agb: " 5-Jul-86 12:49")
    (PROG (mflg)
	    [if (IGEQ (DIFFERENCE (CADR rte)
					(CAR rte))
			  16)
		then (SETQ mflg T)
		       (ChipWire 3 4 (CAR rte)
				   pos
				   (PLUS 4 (CADR rte))
				   pos
				   (CAR (CDDDDR rte)))
	      else (ChipWire 11 4 (CAR rte)
				 pos
				 (PLUS 4 (CADR rte))
				 pos
				 (CAR (CDDDDR rte]
	    (for i in (CADDDR rte) do (SELECTQ (CADR i)
							 (D (ChipWire 11 4 (CAR i)
									(MIN 0 (OR extDwn 0))
									(CAR i)
									pos)
							    (if mflg
								then (ChipSymCall
									 1
									 (PLUS 0 (CAR i))
									 pos)))
							 (U (ChipWire 11 4 (CAR i)
									pos
									(MAX (CAR i)
									       (OR extUp 0))
									size)
							    (if mflg
								then (ChipSymCall
									 1
									 (PLUS 0 (CAR i))
									 pos)))
							 (L NIL)
							 (MIN NIL)
							 (HELP])

(MakeLocCif
  [LAMBDA (loc file mult y)                                  (* agb: " 5-Jul-86 21:42")
    (PROG (size)
	    (if (NOT mult)
		then (SETQ mult 1))
	    (ChipHdr file)
	    (for i in (CDR loc) do (ChipWire 11 4 (TIMES mult (CADR i))
						       y
						       (TIMES mult (PLUS 4 (CADR i)))
						       y
						       (CAR i)))
	    (ChipTrailer])

(MakeLocFiles
  [LAMBDA (name)                                             (* agb: " 5-Jul-86 21:58")
    (MakeLocCif RomLoc (CONCAT (QUOTE {DSK18}ROMLOC)
				   name ".CHIP")
		  1 455)
    (MakeLocCif OpLoc (CONCAT (QUOTE {DSK18}OPPLALOC)
				  name ".CHIP")
		  1 -25)
    (MakeLocCif R21LeftLLoc (CONCAT (QUOTE {DSK18}R21LEFTLOC)
					name ".CHIP")
		  8 0])
)
(* * Other)

(DEFINEQ

(PrintFile
  [LAMBDA (fl)                                               (* edited: " 3-Dec-85 15:27")
    (SETQ file (INPUT (INFILE fl)))
    (UNTIL (EOFP file)
       DO (PRIN1 (LOGOR (LLSH (BIN file)
				      8)
			      (BIN file)))
	    (PRIN1 " "))
    (CLOSEF file])

(Test
  [LAMBDA (suf)                                              (* agb: "15-Jun-86 13:30")
    [ChipHdr (SETQ fl (MKATOM (CONCAT "{DSK18}TEST" suf ".chip"]
    (ChipWire 1 4 20 20 20 100)
    (ChipWire 2 4 20 20 100 20)
    (ChipSymCall 1 20 20)
    (ChipTrailer)
    (PrintFile fl])

(WirePos
  [LAMBDA (N Phase)                                          (* agb: "15-Jan-86 09:05")
    (PLUS Phase (TIMES 180 (IQUOTIENT N 4))
	    (TIMES 40 (IREMAINDER N 4])
)
(PUTPROPS CHANNEL COPYRIGHT ("Xerox Corporation" 1985 1986))
(DECLARE: DONTCOPY
  (FILEMAP (NIL (1672 8809 (DependB 1682 . 1867) (DoRoute 1869 . 2507) (MakeDependLst 2509 . 3234) (
FindChannel 3236 . 3600) (InsertChannel 3602 . 4227) (PlaceChannel 4229 . 5095) (TryChannelListRev 
5097 . 5798) (TryChannelList 5800 . 6468) (TryChannel 6470 . 6647) (Compat 6649 . 6895) (CompatChannel
 6897 . 7063) (FindDepend 7065 . 7336) (CheckDepend 7338 . 8137) (DependA 8139 . 8375) (FindMultDepend
 8377 . 8807)) (8828 11344 (GetNameList 8838 . 9189) (NoteWire 9191 . 9404) (NoteWireLst 9406 . 9635) 
(Formatlst 9637 . 11342)) (11364 14114 (DefineRouteA 11374 . 12042) (DefineRouteB 12044 . 12990) (
DefineRouteC 12992 . 13311) (RouteA 13313 . 13639) (RouteB 13641 . 13874) (RouteC 13876 . 14112)) (
29891 33858 (MakeListLoc 29901 . 30459) (MakePlaLocOp 30461 . 31494) (MakeWireLLoc 31496 . 31977) (
MakeWireLoc 31979 . 32470) (SpecifyLocs 32472 . 32688) (MakePlaLoc 32690 . 33856)) (33889 35788 (
MakeRamS 33899 . 35269) (MakRam4 35271 . 35627) (mn 35629 . 35786)) (35789 38059 (MakLP2 35799 . 36419
) (MakeIBufRoute 36421 . 36916) (MakeIBufSpaces 36918 . 37417) (MakeInputList 37419 . 38057)) (38079 
42048 (ShowRoute 38089 . 38765) (ChX 38767 . 38910) (DrawChannel 38912 . 39438) (MakeCif 39440 . 40065
) (MakeCifRte 40067 . 41196) (MakeLocCif 41198 . 41638) (MakeLocFiles 41640 . 42046)) (42067 42947 (
PrintFile 42077 . 42410) (Test 42412 . 42742) (WirePos 42744 . 42945)))))
STOP