! ILAP generators for Nmos Pads

%include "nmos.inc"

{#########################################################################}
{#                                                                       #}
{#      This program is part of the ILAP library, and was written in     #}
{#   The Department of Computer Science at the University of Edinburgh   #}
{#       (James Clerk Maxwell Building, Kings Buildings, Edinburgh)      #}
{#                                                                       #}
{#   This software is available free to other educational establisments  #}
{#   but the University of Edinburgh, retains all commercial rights.     #}
{#   It is a condition of having this software is that the sources are   #}
{#   not passed on to any other site, and that Edinburgh University is   #}
{#   given credit in any re-implementations of any of the algorithms     #}
{#   used, or articles published which refer to the software.            #}
{#                                                                       #}
{#   There is no formal support for this software, but any bugs should   #}
{#   be reported to Gordon Hughes or David Rees at the above address,    #}
{#   and these are likely to be fixed in a future release.               #}
{#                                                                       #}
{#########################################################################}

%routine draw output pad area
%integer i
  layer(metal)
    box(0,88,96,96) ; box(0,0,96,8) ; box(24,24,72,72)
    box(82,67,86,73) ; box(72,68,82,72) ; box(82,45,86,51)
    box(72,46,82,50) ; box(82,23,86,29) ; box(72,24,82,28)
    box(67,13,73,17) ; box(68,17,72,24) ; box(45,13,51,17)
    box(46,17,50,24) ; box(23,13,29,17) ; box(24,17,28,24)
    box(10,23,14,29) ; box(14,24,24,28) ; box(10,45,14,51)
    box(14,46,24,50) ; box(10,67,14,73) ; box(14,68,24,72)
  layer(contact)
    box(i,89,i+4,91) %and box(i,93,i+4,95) %for i=34,8,58
    box(i,3,i+4,5) %for i=6,10,86
    box(83,68,85,72) ; box(83,46,85,50) ; box(83,24,85,28)
    box(68,14,72,16) ; box(46,14,50,16) ; box(24,14,28,16)
    box(11,24,13,28) ; box(11,46,13,50) ; box(11,68,13,72)
  layer(diffusion)
    box(70,26,96,96) ; box(0,0,96,26)
    box(0,26,26,96) ; box(26,70,70,96)
  layer(glass)
    box(28,28,68,68)
  etpy("pu",76,96,-7); dx(12); dy(-80); dx(-82); dy(80); dx(12); dy(5)
  etpy("pd",66,96,-18);dx(12); dy(-59); dx(-62); dy(59); dx(12); dy(16)
%end
!-
%externalroutine pad vdd %alias "ILAP_PADVDD"
  %if symbol exists("padvdd")=true %then %return
  symbol("Pad vdd")
    layer(metal)
      box(0,0,96,8) ; box(24,24,72,72) ; box(64,8,72,24)
      box(24,8,32,24) ; box(44,72,52,96)
    layer(glass)
      box(28,28,68,68)
  endsymbol
%end
!
%externalroutine pad gnd %alias "ILAP_PADGND"
  %if symbol exists("padgnd")=true %then %return
  symbol("Pad gnd")
    layer(metal)
      box(0,88,96,96) ; box(0,0,96,8) ; box(24,24,72,72)
      box(64,72,72,88) ; box(24,72,32,88)
    layer(glass)
      box(28,28,68,68)
  endsymbol
%end
!-
%externalroutine padin %alias "ILAP_PADIN" (%integername padinx)
%integer i
  %if symbol exists("padin")=true %then ->ret
  symbol("Pad in")
    layer(metal)
      box(0,88,96,96) ; box(0,0,96,8)
      box(24,24,72,72) ; box(68,12,72,24)
    layer(diffusion)
      box(68,10,72,18)
      box(6,10,68,12); box(6,12,8,96)
      box(8,76,14,89) ; box(14,74,91,92)
    pm(11,92)
    etpy("la",9,89,-4) ; dx(73) ; dy(-7) ; dx(-73) ; dy(-2)
    layer(contact)
      box(69,13,71,17)
      box(i,89,i+4,91) %for i=16,10,86
    layer(glass)
      box(28,28,68,68)
  endsymbol
ret:padinx=6
%end
!-
%externalroutine padout %alias "ILAP_PADOUT" (%integername padoutx)
  %if symbol exists("Pad out")=true %then ->ret
  symbol("Pad out")
    draw output pad area
    layer(diffusion)
      box(90,96,94,119) ; box(76,105,84,109) ; box(84,129,85,133)
      box(56,133,89,135) ; box(81,115,84,133)
      box(35,125,61,129) ; box(66,121,72,123) ; box(24,105,72,121)
      box(59,100,65,105) ; box(31,100,37,105) ; box(12,105,24,107)
      box(2,96,6,119) ; box(11,129,12,133)
      box(7,133,40,135) ; box(12,115,15,133)
      box(24,121,30,123)
    layer(poly)
      box(76,98,78,100) ; box(66,98,68,100)
      box(28,98,30,100) ; box(18,98,20,100)
      pm(87,123) ; dm(87,131)
      box(76,100,82,104) ; box(66,100,72,104)
      pm(9,123) ; dm(9,131)
      box(14,100,20,104) ; box(24,100,30,104)
    dtpy("pulr",86,115,4)
    dtpy("puur",86,99,12)
    dtpy("pull",8,115,4)
    dtpy("puul",8,99,12)
    etpx("pdbr",56,130,16)
    etpx("pdbl",24,130,16)
    etpx("pdum",24,116,48)
    etpx("pdbm",24,108,48)
    ! Poly interconnect
      box(47,132,49,135) ; box(42,130,49,132) ; box(73,116,75,132)
      box(73,108,75,114) ; box(75,112,86,114)
      box(10,112,23,114) ; box(21,114,23,118)
    layer(metal)
      box(76,100,82,109) ; box(59,100,72,104) ; box(76,109,80,119)
      box(66,119,80,123) ; box(35,125,61,129) ; box(35,111,61,115)
      box(24,100,37,104) ; box(14,100,20,104) ; box(16,104,20,119)
      box(16,119,30,123) ; box(44,96,52,125)
      box(7,125,11,129) ; box(85,125,89,129)
    layer(contact)
      box(77,106,81,108) ; box(77,101,81,103) ; box(67,101,71,103)
      box(60,101,64,103) ; box(32,101,36,103) ; box(25,101,29,103)
      box(15,101,19,103) ; box(56,112,60,114) ; box(46,112,50,114)
      box(36,112,40,114) ; box(67,120,71,122) ; box(25,120,29,122)
      box(56,126,60,128) ; box(46,126,50,128) ; box(36,126,40,128)
  endsymbol
ret:padoutx=47
%end
!-
%externalroutine padclout %alias "ILAP_PADCLOUT" (%integername padcloutx, padcloutclx)
  %if symbol exists("padclout")=true %then ->ret
  symbol("Pad cl out")
    draw output pad area
    layer(diffusion)
      box(90,96,94,119) ; box(76,105,84,109) ; box(84,129,85,133)
      box(24,133,89,135) ; box(81,115,84,133)
      box(44,127,52,135) ; box(66,121,72,123) ; box(24,105,72,121)
      box(59,100,65,105) ; box(31,100,37,105) ; box(12,105,24,107)
      box(2,96,6,117)
      box(12,115,14,126);box(14,124,21,126);box(19,126,40,128)
      box(24,121,30,123) ; box(2,129,4,135) { Signal connect point }
      box(4,129,7,133)
    layer(poly)
      box(76,98,78,100) ; box(66,98,68,100)
      box(28,98,30,100) ; box(18,98,20,100)
      pm(87,123)
      dm(87,131)
      dm(10,124)
      pm(5,124)
      box(5,119,10,121) ; box(3,119,5,122)
      box(76,100,82,104) ; box(66,100,72,104)
      box(14,100,20,104) ; box(24,100,30,104)
    dtpy("pulr",86,115,4)
    dtpy("puur",86,99,12)
    dtpy("pull",8,115,2)
    dtpy("puul",8,99,12)
    etpx("pdbr",56,130,16)
    etpx("pdbl",24,130,16)
    etpx("pdum",24,116,48)
    etpx("pdbm",24,108,48)
    etpy("pacl",9,129,4)
  ! Poly interconnect
      box(73,116,75,132)
      box(10,112,23,114) ; box(21,114,23,118)
      box(73,108,75,114) ; box(75,112,86,114)
      dm(14,131)
      pm(20,131)
    layer(metal)
      box(76,100,82,109) ; box(59,100,72,104) ; box(76,109,80,119)
      box(66,119,80,123) ; box(35,111,61,115) ; box(24,100,37,104)
      box(14,100,20,104) ; box(16,104,20,119) ; box(16,119,30,123)
      box(44,96,52,135)
      box(85,125,89,129)
      box(16,129,18,133)
      box(7,122,8,126)
    layer(contact)
      box(77,106,81,108) ; box(77,101,81,103) ; box(67,101,71,103)
      box(60,101,64,103) ; box(32,101,36,103) ; box(25,101,29,103)
      box(15,101,19,103) ; box(56,112,60,114) ; box(46,112,50,114)
      box(36,112,40,114) ; box(67,120,71,122) ; box(25,120,29,122)
      box(46,132,50,134) ; box(46,128,50,130)
  endsymbol
ret:padcloutx=2
  padcloutclx=9
%end
!-
%externalroutine padinout %alias "ILAP_PADINOUT" (%integername padinoutinx, padinoutoutx, padinoutenx)
  %if symbol exists("padinout")=true %then ->ret
  symbol("Pad in out")
    draw output pad area
    layer(metal)
      box(44,96,52,160)      {main gnd}
      box(35,108,61,112)     {centre gnds}
      box(35,124,61,128)
      box(35,140,61,144)
      box(24,156,72,160)     {lower gnd}
      box(24,106,30,120)    {pd left}
      box(21,99,27,103)
      box(2,99,6,162) ; box(6,99,21,103) {from pad}
      box(16,106,20,136) ; box(20,132,30,136) {pu left}
      box(9,139,13,152) ; box(13,148,30,152)
      box(9,134,13,135)
      box(66,106,72,120)    {pd right}
      box(76,102,82,112)
      box(62,132,68,136);box(64,124,68,132);box(68,124,80,128) {pu right}
      box(76,112,80,124)                                       {pu right}
      box(84,131,88,136); box(72,132,84,136); box(72,136,76,152);
      box (66,148,72,152)
      box(84,126,88,127)
      box(81,143,85,144)
    layer(diffusion)
      box(56,149,72,151);  box(24,149,40,151)
      box(24,116,72,144) ;  box(32,107,65,111)
    etpy("enab",82,160,-6); dx(8); dy(-5); dx(-7)
      box(87,143,92,147)
    dtpx("publ",87,139,5)
      box(87,134,91,137)
    dtpy("pumr",86,116,4)
    dtpy("puur",86,100,12)
    etpx("pd1",24,113,41)
    etpx("pd2",24,121,48)
    etpx("pd3",24,129,48)
    etpx("pd4",24,137,48)
    etpx("pd5",56,145,16)
    etpx("pd6",56,153,16)
    etpx("pd7",24,145,16)
    etpx("pd8",24,153,16)
    dtpy("publ",10,124,4)
    dtpy("pdtl",10,108,12)
      box(76,108,84,112) ; box(24,156,83,160) ; box(21,96,27,103)
      box(14,116,24,120) ; box(4,96,8,128)
      box(90,96,94,124) ; box(91,124,94,137)
      box(81,127,84,131); box(81,120,83,127); box(81,116,84,120)
      box(13,135,14,139); box(14,124,16,139)
      dm(86,129)
      pm(86,124)
      pm(11,132)
      dm(11,137)
      dm(83,146)
      pm(83,141)
    layer(poly)
      box(79,139,81,141)
      box(42,153,56,155);   ! Joins Mid Tr 6 to Mid Tr 8
      box(73,137,75,147);   ! Joins Mid Tr 5 to Mid Tr 4
      box(21,121,23,131);   ! Joins Mid Tr 3 to Mid Tr 4
      box(67,113,86,115);   ! Joins right Trs to Mid Tr 1
      box(12,121,19,123);box(17,123,19,139);box(19,137,22,139)
                                           ! ^ Joins Mid Tr 4 to left Trs
      box(73,121,75,131);box(75,129,79,131);box(77,131,79,155)
      box(74,153,79,155)
      box(15,145,22,147); box(15,147,17,162); ! Connection point
      ! join to the top part of cell
      box(76,98,78,102); box(76,102,82,106) {pu right}
      box(66,98,68,106); box(66,106,72,110) {pd right}
      box(28,98,30,106); box(24,106,30,110) {pd left}
      box(18,98,20,106); box(16,106,20,112) {pu left}
    layer(contact)
      box(56,109,60,111) ; box(46,109,50,111) ; box(36,109,40,111)    {gnds}
      box(56,125,60,127) ; box(46,125,50,127) ; box(36,125,40,127)
      box(56,141,60,143) ; box(46,141,50,143) ; box(36,141,40,143)
      box(67,157,71,159) ; box(57,157,61,159)
      box(35,157,39,159) ; box(25,157,29,159)
      box(46,157,50,159)                        {gnds}
      box(22,100,26,102)  {from pad}
      box(25,107,29,109); box(25,117,29,119)
      box(17,107,19,111); box(25,133,29,135)
      box(25,149,29,151)
      box(67,107,71,109); box(67,117,71,119)
      box(77,103,81,105); box(77,109,81,111); box(63,133,67,135)
      box(67,149,71,151)
  endsymbol
ret:padinoutinx=2
  padinoutoutx=15
  padinoutenx=82
%end
!
%endoffile
