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

%constant %string (3)  metal1   ="M1", cm="M1"
%constant %string (3)  metal2   ="M2"
%constant %string (3) diff   ="AA", cd="D"
%constant %string (3) ndiff ="ND"
%constant %string (3) pdiff ="PD"
%constant %string (3) poly     ="PY", cp="PY"
%constant %string (3) pwell    ="PW", nwell = "NW"
%constant %string (3) nplus    ="NP"
%constant %string (3) pplus    ="PP"
%constant %string (3)    contact  ="CC"
%constant %string (3)      via    = "VI"

%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 Plus on %alias "ILAP_PLUS_ON"
%external %routine %spec Plus off %alias "ILAP_PLUS_ON"
%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_CMOS" (%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 Vsswirex  %alias "ILAP_VSSWIREX" (%integer x, y, l)
%external %routine %spec Vsswirey  %alias "ILAP_VSSWIREY" (%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 NTPX    %alias "ILAP_NTPX"    (%string (31) name, %integer x, y, l)
%external %routine %spec NTPY    %alias "ILAP_NTPY"    (%string (31) name, %integer x, y, l)
%external %routine %spec PTPX    %alias "ILAP_PTPX"    (%string (31) name, %integer x, y, l)
%external %routine %spec PTPY    %alias "ILAP_PTPY"    (%string (31) name, %integer x, y, l)
%external %routine %spec NTDX    %alias "ILAP_NTDX"    (%string (31) name, %integer x, y, l)
%external %routine %spec NTDY    %alias "ILAP_NTDY"    (%string (31) name, %integer x, y, l)
%external %routine %spec PTDX    %alias "ILAP_PTDY"    (%string (31) name, %integer x, y, l)
%external %routine %spec PTDY    %alias "ILAP_PTDY"    (%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 nsub  %alias "ILAP_NSUB"  (%integer x, y)
%external %routine %spec psub  %alias "ILAP_ PSUB" (%integer x, y)
%external %routine %spec nsubn  %alias "ILAP_NSUBN" (%integer x, y)
%external %routine %spec nsubs  %alias "ILAP_NSUBS" (%integer x, y)
%external %routine %spec nsube  %alias "ILAP_NSUBE" (%integer x, y)
%external %routine %spec nsubw  %alias "ILAP_NSUBW" (%integer x, y)
%external %routine %spec psubn  %alias "ILAP_PSUBN" (%integer x, y)
%external %routine %spec psubs  %alias "ILAP_PSUBS" (%integer x, y)
%external %routine %spec psube  %alias "ILAP_PSUBE" (%integer x, y)
%external %routine %spec psubw  %alias "ILAP_PSUBW" (%integer x, y)
%external %routine %spec ndm   %alias "ILAP_NDM"   (%integer x, y)
%external %routine %spec pdm   %alias "ILAP_PDM"   (%integer x, y)
%external %routine %spec pm    %alias "ILAP_PM"    (%integer x, y)
%external %routine %spec mm    %alias "ILAP_MM"    (%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 equate %alias "ILAP_EQUATE" (%string (255) parm)
%external %routine %spec table %alias "ILAP_TABLE" (%string (255) parm)

%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)

! ILAP New Universal Ports Stuff
! %Internal to Ilap code :
%record %format Port fm(%string(31) primary, second, %integer index,
                       %integer x, y, w, h, side,
                       %string(3) layer,
                       %integer type,
                       %record(Port fm)%name next)

%external %record(port fm)%fn %spec Port(%string(31) port name,
                                         %integer x, y, w, h, side,
                                         %string(3) layer, %integer type)

%external %routine %spec Set Port(%record(port fm) p, %string(31) sym name)
%external %record(Port fm)%fn %spec Get Port(%string(31) sym name, port name)
%external %routine %spec Reset to first Port(%string(31) sym name, %integer side)
%external %record(Port fm)%fn %spec Get next Port(%string(31) sym name,
                                                  %integer side)

%external %string(31) %fn %spec Make Port Name(%string(31) first, second,
                                               %integer index)
%external %routine %spec Break Port name(%string(31) port name, { -> }
                                         %string(31)%name first, second,
                                         %integer %name index)

%const %integer North = 1, East = 2, South = 4, West = 8
! To allow for 'Null' square ports, or ports at corner ( thus on 2, 3, 4 sides!)
%end %of %file
