Parametric Mask Layout
Besides a direct layout where the user creates all details of the shapes, the LayoutEditor has the ability for parametric layouts. In parametric layouts the shapes are automaticly created and the user just entered some parameter for each shape or structures. Changing one of these parameter will change the layout. In the LayoutEditor both types of layout design can be mixed. For the parametric layout open the schematic window and select the shape library. That is a library shipped with the LayoutEditor and contains common used parametric shapes. The shapes are prescribed in the C++ style macro language of the LayoutEditor and can easily be adjusted and enhanced. or just be a template for your own parametric library parts.
Example Parametric Layout Macro (Trangle)
1 #!/usr/bin/layout
2 #name=triangle
3 #help=generate a triangle
4
5 #include "shapelib.layout"
6
7 int main(){
8 //read parameter
9 string s="NETLIST_PARAMETER";
10 int a=databaseunits(s.parameter("lengtha"));
11 int b=databaseunits(s.parameter("lengthb"));
12 int c=databaseunits(s.parameter("lengthc"));
13 int layer=getLayer(s.parameter("layer"));
14 string cellname ="trianglee"+ userunits(a)+"_";
15 cellname+= userunits(b)+"_"+ userunits(c)+"_"+ layer;
16 // check if shape already exists
17 if (layout->drawing->existCellname(cellname)) {
18 layout->drawing->setCell(cellname);
19 return 0;
20 }
21 //create new cell with triangle
22 cellList *cl=layout->drawing->addCell();
23 cl->thisCell->cellName=cellname;
24 //calculating coordinates
25 int x=((c*c)-(b*b)+(a*a))/(2*a);
26 int y=math::sqrt(c*c-x*x);
27 layout->drawing->setCell(cellname);
28 layout->drawing->activeLayer=layer;
29 //create triangle
30 layout->drawing->point(0,0);
31 layout->drawing->point(a,0);
32 layout->drawing->point(x,y);
33 layout->drawing->point(0,0);
34 layout->drawing->polygon();
35 //center triangle
36 layout->drawing->selectAll();
37 layout->drawing->point(0,0);
38 layout->drawing->centerXY();
39 layout->drawing->deselectAll();
40 }