{ Declarations for using NMOS ILAP included}               %end %of %list

%constant %string (1) blue  ="M", metal    ="M",  nm="M"
%constant %string (1) green ="D", diffusion="D",  nd="D"
%constant %string (1) red   ="P", poly     ="P",  np="P"
%constant %string (1)             implant  ="I",  ni="I"
%constant %string (1)             glass    ="G",  ng="G"
%constant %string (1)             contact  ="C",  nc="C"
%constant %string (1)             buried   ="B",  nb="B"

%constant %integer true = 1,   false = 0

%external %routine %spec first cell number %alias "ILAP_FIRST_CELL_NUMBER" (%integer num)
%external %routine %spec set lambda %alias "ILAP_SET_LAMBDA" (%integer lambda)
%external %routine %spec get lambda %alias "ILAP_GET_LAMBDA" (%integer %name lambda)
%external %routine %spec set error stream %alias "ILAP_SET_ERROR_STREAM" (%integer ST)
%external %routine %spec set cif stream %alias "ILAP_SET_ERROR_STREAM" (%integer ST)
%external %routine %spec warning %alias "ILAP_WARNING" (%string (255) message)
%external %routine %spec disaster %alias "ILAP_DISASTER" (%string (255) message)
%external %routine %spec update mbb %alias "ILAP_UPDATE_MBB" (%integer XL, YB, XR, YT)
%external %routine %spec fix mbb %alias "ILAP_FIX_MBB" (%integer XL, YB, XR, YT)
%external %integer %fn %spec ILAP warnings %alias "ILAP_WARNINGS"
%external %integer %map %spec ILAP control %alias "ILAP_CONTROL"
%constant %integer       no warnings = 1
%constant %integer    monitor endsym = 2
%constant %integer        give times = 4
%constant %integer         merge cif = 8
%constant %integer design rule check = 16
%external %routine %spec merge on %alias "ILAP_MERGE_ON"
%external %routine %spec merge off %alias "ILAP_MERGE_OFF"
%external %routine %spec drc on %alias "ILAP_DRC_ON"
%external %routine %spec drc off %alias "ILAP_DRC_OFF"

%external %routine %spec initialise %alias "ILAP_INIT_NMOS" (%string (255) s)
%external %routine %spec finish %alias "ILAP_FINISH"
%external %routine %spec give statistics %alias "ILAP_GIVE_STATISTICS"

%external %routine %spec end symbol %alias "ILAP_END_SYMBOL"
%external %routine %spec symbol %alias "ILAP_SYMBOL" (%string (31) name)
%external %routine %spec symbol spec %alias "ILAP_SYMBOL_SPEC" (%string (31) name, %integer xl, yl, xu, yu)
%external %routine %spec external symbol %alias "ILAP_EXTERNAL_SYMBOL" %c
   (%string (31) name, %integer number)
%external %routine %spec external symbol spec %alias "ILAP_EXTERNAL_SYMBOL_SPEC" %c
   (%string (31) name, %integer number, %integer xl, yl, xu, yu)

%external %routine %spec box       %alias "ILAP_BOX"      (%integer xl, yl, xu, yu)
%external %routine %spec polygon   %alias "ILAP_POLYGON"  (%integer x, y)
%external %routine %spec line      %alias "ILAP_LINE"     (%integer x, y)
%external %routine %spec wirex     %alias "ILAP_WIREX"    (%integer x, y, l)
%external %routine %spec wirey     %alias "ILAP_WIREY"    (%integer x, y, l)
%external %routine %spec gndwirex  %alias "ILAP_GNDWIREX" (%integer x, y, l)
%external %routine %spec gndwirey  %alias "ILAP_GNDWIREY" (%integer x, y, l)
%external %routine %spec vddwirex  %alias "ILAP_VDDWIREX" (%integer x, y, l)
%external %routine %spec vddwirey  %alias "ILAP_VDDWIREY" (%integer x, y, l)

%external %routine %spec ETPX    %alias "ILAP_ETPX"    (%string (31) name, %integer x, y, l)
%external %routine %spec ETPY    %alias "ILAP_ETPY"    (%string (31) name, %integer x, y, l)
%external %routine %spec ETDX    %alias "ILAP_ETDX"    (%string (31) name, %integer x, y, l)
%external %routine %spec ETDY    %alias "ILAP_ETDY"    (%string (31) name, %integer x, y, l)
%external %routine %spec DTPX    %alias "ILAP_DTPX"    (%string (31) name, %integer x, y, l)
%external %routine %spec DTPY    %alias "ILAP_DTPY"    (%string (31) name, %integer x, y, l)
%external %routine %spec DTDX    %alias "ILAP_DTDX"    (%string (31) name, %integer x, y, l)
%external %routine %spec DTDY    %alias "ILAP_DTDY"    (%string (31) name, %integer x, y, l)
%external %routine %spec DTDBX   %alias "ILAP_DTDBX"   (%string (31) name, %integer x, y, l)
%external %routine %spec DTDBY   %alias "ILAP_DTDBY"   (%string (31) name, %integer x, y, l)

%external %routine %spec ax  %alias "ILAP_AX" (%integer u)
%external %routine %spec ay  %alias "ILAP_AY" (%integer v)
%external %routine %spec axy %alias "ILAP_AXY" (%integer x, y)
%external %routine %spec dx  %alias "ILAP_DX" (%integer u)
%external %routine %spec dy  %alias "ILAP_DY" (%integer v)
%external %routine %spec dxy %alias "ILAP_DXY" (%integer x, y)

%external %routine %spec layer %alias "ILAP_LAYER" (%string (4) colour)
%external %string (4) %function %spec clayer %alias "ILAP_CLAYER"
%external %routine %spec width %alias "ILAP_WIDTH" (%integer size)
%external %integer %function %spec cwidth %alias "ILAP_CWIDTH"

%external %routine %spec cif comment %alias "ILAP_CIF_COMMENT" (%string (255) s)
%external %routine %spec cif statement %alias "ILAP_CIF_STATEMENT" (%string (255) s)
%external %routine %spec user extension %alias "ILAP_USER_EXTENSION" (%integer no, %string (255) s)
%external %routine %spec Node Label %alias "ILAP_NODE_LABEL" (%string (31) label,
   %integer x, y, %string (4) layer)

%external %routine %spec draw        %alias "ILAP_DRAW"        (%string (31) name, %integer x, y)
%external %routine %spec drawmx      %alias "ILAP_DRAW_MX"     (%string (31) name, %integer x, y)
%external %routine %spec drawmy      %alias "ILAP_DRAW_MY"     (%string (31) name, %integer x, y)
%external %routine %spec drawrot     %alias "ILAP_DRAW_ROT"    (%string (31) name, %integer x, y, rot)
%external %routine %spec draw mx rot %alias "ILAP_DRAW_MX_ROT" (%string (31) name, %integer x, y, rot)
%external %routine %spec draw my rot %alias "ILAP_DRAW_MY_ROT" (%string (31) name, %integer x, y, rot)

%external %integer %function %spec SX %alias "ILAP_SX" (%string (31) name)
%external %integer %function %spec SY %alias "ILAP_SY" (%string (31) name)
%external %integer %function %spec LX %alias "ILAP_LX" (%string (31) name)
%external %integer %function %spec LY %alias "ILAP_LY" (%string (31) name)
%external %integer %function %spec symbol exists %alias "ILAP_SYMBOL_EXISTS" (%string (31) name)

%external %routine %spec dm    %alias "ILAP_DM"    (%integer x, y)
%external %routine %spec pm    %alias "ILAP_PM"    (%integer x, y)
%external %routine %spec pdms  %alias "ILAP_PDMS"  (%integer x, y)
%external %routine %spec pdmn  %alias "ILAP_PDMN"  (%integer x, y)
%external %routine %spec pdmw  %alias "ILAP_PDMW"  (%integer x, y)
%external %routine %spec pdme  %alias "ILAP_PDME"  (%integer x, y)
%external %routine %spec pdbn  %alias "ILAP_PDBN"  (%integer x, y)
%external %routine %spec pdbs  %alias "ILAP_PDBS"  (%integer x, y)
%external %routine %spec pdbe  %alias "ILAP_PDBE"  (%integer x, y)
%external %routine %spec pdbw  %alias "ILAP_PDBW"  (%integer x, y)
%external %routine %spec pdcn  %alias "ILAP_PDCN"  (%integer x, y)
%external %routine %spec pdcs  %alias "ILAP_PDCS"  (%integer x, y)
%external %routine %spec pdce  %alias "ILAP_PDCE"  (%integer x, y)
%external %routine %spec pdcw  %alias "ILAP_PDCW"  (%integer x, y)
%external %routine %spec pdbns %alias "ILAP_PDBNS" (%integer x, y)
%external %routine %spec pdbew %alias "ILAP_PDBEW" (%integer x, y)

%constant %integer bottom inputs = 0,   top inputs = 1,   mixed inputs = 2
%constant %integer bottom outputs = 0,  top outputs = 4,  mixed outputs = 8
%constant %integer stretch inputs = 16, stretch outputs = 32,  Stretch = 48
%external %routine %spec pla data size %alias "ILAP_PLA_DATA_SIZE" %c
   (%integer %name ins, outs)
%external %routine %spec tpla %alias "ILAP_TPLA" (%string (31) name, %string (255) file,
   %integer %name phi1y, phi2y,
   %integer %array %name inx, %integer %array %name outx)
%external %routine %spec stpla %alias "ILAP_STPLA" (%string (31) name,
   %string (255) file, %integer mode,
   %integer %array %name ispec,%integer %array %name ospec,
   %integer %name phi1y, phi2y,
   %integer %array %name inx,%integer %array %name outx)
%external %routine %spec epla %alias "ILAP_EPLA" (%string (31) name, %string (255) file,
   %integer %name phi1y, phi2y,
   %integer %array %name inx,%integer %array %name outx)
%external %routine %spec sepla %alias "ILAP_SEPLA" (%string (31) name,
   %string (255) file, %integer mode,
   %integer %array %name ispec,%integer %array %name ospec,
   %integer %name phi1y, phi2y,
   %integer %array %name inx,%integer %array %name outx)
%external %routine %spec equate %alias "ILAP_EQUATE" (%string (255) parm)
%external %routine %spec table %alias "ILAP_TABLE" (%string (255) parm)

%external %routine %spec rom %alias "ILAP_ROM" (%string (31) name, %string (255) file,
   %integer %name phi1y, phi2y,
   %integer %array %name inx,%integer %array %name outx)
%external %routine %spec srom %alias "ILAP_SROM" (%string (31) name,
   %string (255) file, %integer mode,
   %integer %array %name ispec,%integer %array %name ospec,
   %integer %name phi1y, phi2y,
   %integer %array %name inx,%integer %array %name outx)

%external %routine %spec stack %alias "ILAP_STACK" (%string (31) name, %integer bits, words,
   %integer %name controlx, controly, pushcony, popcony,
   phi1x, phi2x, phi3x, phi4x,
   %integer %array %name pushy,%integer %array %name popy)

%external %routine %spec COUNTER %alias "ILAP_COUNTER" (%string(31) name,
   %integer size, %integer %name suby, loady, vddy, phi2y, phi1y, gndy,
   %integer %array %name ins,%integer %array %name outs,
   %integer %array %name outsb)

%record %format port (%integer x, w)
%external %integer %function %spec route %alias "ILAP_ROUTE" (%string (31) name,
   %record (port) %array %name a,%record(port) %arrayname b,
    %integer n, %string (4) layer,%integer twid, tsep, sepn)
%external %routine %spec croute %alias "ILAP_CROUTE" (%string(31) name,
   %record(port)%arrayname a, %record(port)%arrayname b,
   %integer n, ya, xb,%string (4) lay, %integer twid, tsep)
%external %routine %spec sroute %alias "ILAP_SROUTE" (%string(31) name,
   %record(port)%arrayname a,
   %record(port)%arrayname b,
   %record(port)%arrayname c,
   %record(port)%arrayname d,
   %integer ac, ab, bc, cd, da, ya, xb, yc, xd,
   %string (4) lay, %integer twid, tsep)
%recordformat channel port(                                   %c
   %integer               side,   {left (1), right(2)}        %c
                          offset, {offset of port}            %c
                          track,  {equiv matrix row}          %c
                          mark,   {for "ticking off" ports}   %c
   %string (4)            layer,  {layer of port}             %c
   %record (channel port) %name   {pointer to next port}      %c
                          next,   {next port in offset order} %c
                          prev,   {points to previous offset} %c
                          from,   {points to "from" port}     %c
                          to      {points to "to" port}       )
%external %routine %spec  print port index           %alias "ILAP_CR_PPI"  (%record (channel port) %name lhead)
%external %record (channel port) %map %spec declare port %alias "ILAP_CR_DEC_PORT" ( %c
   %string (31) name,     {for diagnostic purposes}         %c
   %integer     fside,    {from side (1)=leftc, (2)=rightc} %c
                foffset,  {from offset}                     %c
   %string (4)  flayer,   {from layer}                      %c
   %integer     tside,    {to side}                         %c
                toffset,  {to offset}                       %c
   %string (4)  tlayer,   {to layer}                        %c
   %record (channel port) %name  in port list {the port list})
%external %routine %spec channelr %alias "ILAP_CR" (%string (31) name,
   %record (channel port) %name head, %integer min number of consecutive terminals)

%external %routine %spec padvdd   %alias "ILAP_PADVDD"
%external %routine %spec padgnd   %alias "ILAP_PADGND"
%external %routine %spec padin    %alias "ILAP_PADIN"    (%integername padinx)
%external %routine %spec padout   %alias "ILAP_PADOUT"   (%integername padoutx)
%external %routine %spec padclout %alias "ILAP_PADCLOUT" (%integername padcloutx, padcloutclx)
%external %routine %spec padinout %alias "ILAP_PADINOUT" (%integername padinoutinx, padinoutoutx, padinoutenx)

%const %integer bottom=1, right=2, top=3, left=4
%const %integer vdd pad = 1, gnd pad = 2
%const %integer in  pad = 3, out pad = 4
%const %integer cl out pad = 5, cl out pad cl = 6
%const %integer in out pad in = 7, in out pad out = 8, in out pad en = 9
%record %format connf (%integer type, side, C, W, %string (4) LAYER)
%external %routine %spec place pads %alias "ILAP_PLACE_PADS" (%string (31) chipname, cellname,
   %record (connf) %array %name P, %integer N)
%external %routine %spec fill port %alias "ILAP_FILL_PORT" (%record (connf) %name port,
   %integer type, side, coord, width, %string (4) layer)

%external %routine %spec crest      %alias "ILAP_CREST"      (%string (31) name, %integer xsize, ysize)
%external %routine %spec text       %alias "ILAP_TEXT"       (%string (31) name, %string (255) text, %integer xsize, ysize)
%external %routine %spec copyright  %alias "ILAP_COPYRIGHT"  (%string (31) name, %integer xsize, ysize)
%external %routine %spec text layer %alias "ILAP_TEXT_LAYER" (%string (4) layer)

%end %of %file
