! Counter chip generator %include "ilap:ilap.inc" %begin %constant %integer max num = 20 %integer suby, loady, vddy, phi2y, phi1y, gndy %integer %array ins, outs, outsb (1:max num) %integer i, pn, number %string (255) out file %record (connf) %array ports (1:6+2*max num) prompt ("Number of counter stages: ") read (number) %if number > max num %start number = max num print string ("Maximum number of counters = ") write (max num, 0) newline %finish prompt ("File name for the chip: ") read (out file) ! Go for it initialise (out file) counter ("counter", number, suby, loady, vddy, phi1y, phi2y, gndy, ins, outs, outsb) fill port (ports(1), 1, 4, vddy, 8, metal) fill port (ports(2), 3, 4, phi1y, 2, diffusion) fill port (ports(3), 3, 4, phi2y, 2, diffusion) fill port (ports(4), 2, 2, gndy, 8, metal) fill port (ports(5), 3, 4, loady, 2, diffusion) fill port (ports(6), 3, 4, suby, 2, diffusion) pn = 6 %for i = 1, 1, number %cycle pn = pn + 1 fill port (ports(pn), 3, 1, ins(i), 2, diffusion) pn = pn + 1 fill port (ports(pn), 4, 3, outs(i), 2, diffusion) %repeat place pads ("counter chip", "counter", ports, pn) finish ! Have a nice day %end %of %program