ACT Library
Loading...
Searching...
No Matches
tech.h
Go to the documentation of this file.
1/*************************************************************************
2 *
3 * This file is part of the ACT library
4 *
5 * Copyright (c) 2018-2019 Rajit Manohar
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
21 *
22 **************************************************************************
23 */
24#ifndef __TECHFILE_H__
25#define __TECHFILE_H__
26
27#include <stdio.h>
28
54 public:
60 RangeTable (int _s, int *_tab) {
61 sz = _s;
62 table = _tab;
63 minval = -1;
64 }
65
69 int min() {
70
71 if (minval >= 0) return minval;
72 if (sz == 1) {
73 minval = table[0];
74 }
75 for (int i=1; i < sz; i += 2) {
76 if (minval == -1) {
77 minval = table[i];
78 }
79 else if (table[i] < minval) {
80 minval = table[i];
81 }
82 }
83 return minval;
84 }
85
93 int operator[](int idx);
94
98 int size();
99
105 int range_threshold (int idx);
106
107 protected:
108 int sz;
109 int *table;
110 int minval;
111};
112
113class Contact;
114class Material;
115
125class GDSLayer {
126private:
127 const char *name;
131
132 list_t *mats;
134
135public:
136
143 GDSLayer (char *nm, int maj, int min) {
144 name = string_cache (nm);
145 major = maj;
146 minor = min;
147 mats = NULL;
148 }
149
154 void addMat (Material *m);
155
162 listitem_t *matList () { if (mats) { return list_first (mats); } else { return NULL; } }
163
167 int getMajor() { return major; }
168
172 int getMinor() { return minor; }
173};
174
175
184class Material {
185 public:
191 Material(const char *nm = NULL) {
192 if (nm) {
193 name = string_cache (nm);
194 }
195 else {
196 name = NULL;
197 }
198 width = NULL;
199 spacing_w = NULL;
200 minarea = 0;
201 maxarea = 0;
202 viaup = NULL;
203 viadn = NULL;
204 gds = NULL;
205 gds_bloat = NULL;
206 }
207
211 virtual const char *getName() { return name; }
212
219 void addGDS (char **table, int sz);
220
227 void addGDSBloat (int *table, int sz);
228
234 const char *viaUpName();
235
239 int minArea() { return minarea; }
240
244 int minWidth () { return width->min(); }
245
249 int minSpacing() { return spacing_w->min(); }
250
251protected:
252 const char *name;
253
256
259
262
265
266 list_t *gds;
268
269 friend class Technology;
270};
271
272
281 int minjog;
282
285
286 int pitch;
289
296
297 const char *lef_name;
298
299 unsigned int routex:1;
300 unsigned int routey:1;
301
303
308
311
313 int inf_sz;
314};
315
316
323class RoutingMat : public Material {
324public:
329 RoutingMat (char *s) : Material(s) {
330 r.influence = NULL;
331 r.inf_sz = 0;
332 r.pitch = 0;
333 r.lef_width = 0;
334 r.lef_name = NULL;
335 r.runlength = -1;
336 r.runlength_mode = -1;
337 r.parallelrunlength = NULL;
338 r.spacing_aux = NULL;
339 }
340
345 void setLEFName (char *s) { r.lef_name = Strdup (s); }
346
350 int getPitch() { return r.pitch; }
351
355 int getLEFWidth() { return r.lef_width; }
356
361 const char *getLEFName() {
362 if (r.lef_name) { return r.lef_name; }
363 return getName();
364 }
365
370 Contact *getUpC() { return viaup; }
371
376 int getSpacing(int w) { return (*spacing_w)[w]; }
377
383 if (r.runlength != -1) return 1;
384 if (spacing_w->size() > 1) return 1;
385 return 0;
386 }
387
394
398 int numRunLength() { return r.runlength; }
399
403 int getRunLength(int w) { return r.parallelrunlength[w]; }
404
409 if (w == 0) { return spacing_w; }
410 else { return r.spacing_aux[w-1]; }
411 }
412
416 int getEol() { return r.endofline; }
417
422
426 double getAntenna() { return r.antenna_ratio; }
427
432
436 int numInfluence() { return r.inf_sz; }
437
441 int *getInfluence() { return r.influence; }
442
443 protected:
445
446 friend class Technology;
447};
448
449
456class PolyMat : public RoutingMat {
457 public:
458 PolyMat (char *s) : RoutingMat(s) { }
459
464 int getOverhang (int w) { return (*overhang)[w]; }
465
469 int getNotchOverhang (int w) { return (*notch_overhang)[w]; }
470
474 Contact *getUpC() { return viaup; }
475
480 int getViaNSpacing (int type) {
481 if (!via_n) {
482 return 1;
483 }
484 return via_n[type];
485 }
486
491 int getViaPSpacing (int type) {
492 if (!via_p) {
493 return 1;
494 }
495 return via_p[type];
496 }
497
498
499 protected:
502 int *via_n;
503 int *via_p;
504
505 friend class Technology;
506};
507
513class FetMat : public Material {
514 public:
518 FetMat (char *s) : Material(s) { num_dummy = 0; }
519
524 int getSpacing (int w) {
525 return (*spacing_w)[w];
526 }
527
531 int numDummyPoly() { return num_dummy; }
532
533protected:
535
536 friend class Technology;
537};
538
539
545class WellMat : public Material {
546 public:
550 WellMat (char *s) : Material (s) { }
551
555 int getOverhang () { return overhang; }
556
561
566 int minSpacing(int dev) { return spacing[dev]; }
567
572 int oppSpacing(int dev) { return oppspacing[dev]; }
573
577 int maxPlugDist() { return plug_dist; }
578
579protected:
580 int *spacing;
585
586 friend class Technology;
587};
588
589
595class DiffMat : public Material {
596 public:
600 DiffMat (char *s) : Material (s) { }
601
614 int effOverhang(int w, int hasvia = 0);
615
621
627
631 int getPolySpacing () { return polyspacing; }
632
637 int getNotchSpacing () { return notchspacing; }
638
644 int getOppDiffSpacing (int flavor) { return oppspacing[flavor]; }
645
651 int getSpacing (int flavor) { return spacing[flavor]; }
652
658
662 int getViaFet() { return via_fet; }
663
668 Contact *getUpC() { return viaup; }
669
670protected:
679
680 friend class Technology;
681};
682
683
684
696class Contact : public Material {
697 public:
701 Contact (char *s) : Material (s) {
704 style = NULL;
705 lef_width = 0;
706 }
707
711 int isSym() { return (asym_surround_up == 0) && (asym_surround_dn == 0); }
712
716 int isAsym() { return !isSym(); }
717
721 int getSym() { return sym_surround_dn; }
722
726 int getSymUp() { return sym_surround_up; }
727
731 int getAsym() { return asym_surround_dn; }
732
736 int getAsymUp() { return asym_surround_up; }
737
741 double getAntenna() { return antenna_ratio; }
742
747
751 int viaGenerate() { return spc_x > 0; }
752
756 int viaGenX() { return spc_x; }
757
761 int viaGenY() { return spc_y; }
762
766 int getLEFWidth() { return lef_width; }
767
771 const char *getDrawingStyle () { return style; }
772
776 void setDrawingStyle (const char *s) { style = s; }
777
781 const char *getLowerName() { return lower->getName(); }
782
786 const char *getUpperName() { return upper->getName(); }
787
788protected:
790
792
795
798
801
802 const char *style;
803
804 // generate
806
807 friend class Technology;
808};
809
810
821 public:
822 static Technology *T;
823 static void Init ();
824
825 const char *name; /* name and date */
826 const char *date; /* string */
827
828 double scale; /* scale factor to get nanometers from
829 the integer units */
830
831 int nmetals; /* # of metal layers */
832
833 int dummy_poly; /* # of dummy poly */
834
835 int welltap_adjust; /* adjustment for welltap y-center */
836
837 GDSLayer *GDSlookup (const char *name); // return gds layer
838
839 /* indexed by EDGE_PFET, EDGE_NFET */
840 int num_devs; /* # of device types */
841 DiffMat **diff[2]; /* diffusion for p/n devices */
842 WellMat **well[2]; /* device wells */
843 DiffMat **welldiff[2]; /* substrate diffusion */
844 FetMat **fet[2]; /* transistors for each type */
845 Material **sel[2]; /* selects for each diffusion */
846
848
850
851 struct Hashtable *gdsH; /* gds layers */
852
853 int getMaxDiffSpacing (); /* this space guarantees correct
854 spacing between any two types of
855 diffusion (not including welldiff) */
856
857 int getMaxWellDiffSpacing (); /* this space guarantees correct
858 spacing between any two types of
859 well diffusion */
860
861 int getMaxSameDiffSpacing (); /* this space guarantees correct
862 spacing between two diffusions of
863 the same type, across all diffusion
864 types */
865
866};
867
868
869
870
871#endif /* __TECHFILE_H__ */
Used to represent a contact between two routing layers (adjacent) or between a material and the first...
Definition: tech.h:696
int getSymUp()
Definition: tech.h:726
Contact(char *s)
Definition: tech.h:701
double getAntennaDiff()
Definition: tech.h:746
const char * getUpperName()
Definition: tech.h:786
void setDrawingStyle(const char *s)
Definition: tech.h:776
Material * upper
Definition: tech.h:789
double antenna_ratio
Definition: tech.h:799
int sym_surround_dn
Definition: tech.h:793
int isSym()
Definition: tech.h:711
const char * getDrawingStyle()
Definition: tech.h:771
int getSym()
Definition: tech.h:721
int viaGenY()
Definition: tech.h:761
int spc_x
Definition: tech.h:805
int viaGenerate()
Definition: tech.h:751
int lef_width
Definition: tech.h:791
int getAsymUp()
Definition: tech.h:736
int isAsym()
Definition: tech.h:716
int viaGenX()
Definition: tech.h:756
int spc_y
Definition: tech.h:805
int asym_surround_up
Definition: tech.h:797
int sym_surround_up
Definition: tech.h:794
int getLEFWidth()
Definition: tech.h:766
double getAntenna()
Definition: tech.h:741
int getAsym()
Definition: tech.h:731
const char * style
Definition: tech.h:802
Material * lower
Definition: tech.h:789
double antenna_diff_ratio
Definition: tech.h:800
const char * getLowerName()
Definition: tech.h:781
int asym_surround_dn
Definition: tech.h:796
Used to hold rules for diffusion.
Definition: tech.h:595
int getWdiffToDiffSpacing()
Definition: tech.h:657
int diffspacing
Definition: tech.h:671
int * spacing
Definition: tech.h:672
Contact * getUpC()
Definition: tech.h:668
int getPolySpacing()
Definition: tech.h:631
int getViaFet()
Definition: tech.h:662
int getNotchSpacing()
Definition: tech.h:637
DiffMat(char *s)
Definition: tech.h:600
int getOppDiffSpacing(int flavor)
Definition: tech.h:644
int viaSpaceMid()
int * oppspacing
Definition: tech.h:673
int via_edge
Definition: tech.h:677
int notchspacing
Definition: tech.h:675
int polyspacing
Definition: tech.h:674
int via_fet
Definition: tech.h:678
int getSpacing(int flavor)
Definition: tech.h:651
int viaSpaceEdge()
RangeTable * overhang
Definition: tech.h:676
int effOverhang(int w, int hasvia=0)
Used for transistors.
Definition: tech.h:513
int numDummyPoly()
Definition: tech.h:531
FetMat(char *s)
Definition: tech.h:518
int getSpacing(int w)
Definition: tech.h:524
int num_dummy
Definition: tech.h:534
Holds information about a GDS layer. Any Material will have a footprint on a single or multiple GDS l...
Definition: tech.h:125
int getMajor()
Definition: tech.h:167
int getMinor()
Definition: tech.h:172
const char * name
Definition: tech.h:127
int major
Definition: tech.h:129
list_t * mats
Definition: tech.h:132
int minor
Definition: tech.h:129
void addMat(Material *m)
listitem_t * matList()
Definition: tech.h:162
GDSLayer(char *nm, int maj, int min)
Definition: tech.h:143
Used to hold information about a material. Materials correspond to abstract geometry,...
Definition: tech.h:184
const char * name
drawing name in magic
Definition: tech.h:252
list_t * gds
GDS layer list.
Definition: tech.h:266
const char * viaUpName()
Contact * viaup
contact/via to material that is above
Definition: tech.h:263
Contact * viadn
contact/via to material that is below
Definition: tech.h:264
virtual const char * getName()
Definition: tech.h:211
int minWidth()
Definition: tech.h:244
void addGDS(char **table, int sz)
void addGDSBloat(int *table, int sz)
Material(const char *nm=NULL)
Definition: tech.h:191
int minarea
Definition: tech.h:257
int minArea()
Definition: tech.h:239
RangeTable * width
min width range table (indexed by length)
Definition: tech.h:254
RangeTable * spacing_w
min spacing range table (indexed by width)
Definition: tech.h:255
int maxarea
Definition: tech.h:260
int minSpacing()
Definition: tech.h:249
int * gds_bloat
GDS bloat table.
Definition: tech.h:267
This is for polysilicon, which is a special routing material with more issues.
Definition: tech.h:456
RangeTable * notch_overhang
overhang for a notch
Definition: tech.h:501
int getViaNSpacing(int type)
Definition: tech.h:480
RangeTable * overhang
poly overhang beyond diffusion
Definition: tech.h:500
int * via_p
spacing of poly via to p-type diff
Definition: tech.h:503
Contact * getUpC()
Definition: tech.h:474
int * via_n
spacing of poly via to n-type diff
Definition: tech.h:502
int getViaPSpacing(int type)
Definition: tech.h:491
PolyMat(char *s)
Definition: tech.h:458
int getNotchOverhang(int w)
Definition: tech.h:469
int getOverhang(int w)
Definition: tech.h:464
A range table is a table of values that are indexed by ranges. It can be viewed as a map from contigu...
Definition: tech.h:53
int sz
Definition: tech.h:108
int minval
minimum value of range
Definition: tech.h:110
RangeTable(int _s, int *_tab)
Definition: tech.h:60
int min()
Definition: tech.h:69
int operator[](int idx)
int * table
range table contents
Definition: tech.h:109
int range_threshold(int idx)
Used to hold routing materials with extra routing design rules.
Definition: tech.h:323
int numInfluence()
Definition: tech.h:436
int getRunLength(int w)
Definition: tech.h:403
int getPitch()
Definition: tech.h:350
double getAntenna()
Definition: tech.h:426
int getEolWithin()
Definition: tech.h:421
int complexSpacingMode()
Definition: tech.h:393
void setLEFName(char *s)
Definition: tech.h:345
RangeTable * getRunTable(int w)
Definition: tech.h:408
RoutingMat(char *s)
Definition: tech.h:329
Contact * getUpC()
Definition: tech.h:370
double getAntennaDiff()
Definition: tech.h:431
int * getInfluence()
Definition: tech.h:441
int getEol()
Definition: tech.h:416
int getSpacing(int w)
Definition: tech.h:376
RoutingRules r
Definition: tech.h:444
const char * getLEFName()
Definition: tech.h:361
int numRunLength()
Definition: tech.h:398
int getLEFWidth()
Definition: tech.h:355
int isComplexSpacing()
Definition: tech.h:382
This holds all the technology design rules (or at least the approximate ones) used by the ACT library...
Definition: tech.h:820
int num_devs
Definition: tech.h:840
struct Hashtable * gdsH
Definition: tech.h:851
const char * name
Definition: tech.h:825
int dummy_poly
Definition: tech.h:833
int nmetals
Definition: tech.h:831
int welltap_adjust
Definition: tech.h:835
DiffMat ** welldiff[2]
Definition: tech.h:843
const char * date
Definition: tech.h:826
double scale
Definition: tech.h:828
DiffMat ** diff[2]
Definition: tech.h:841
int getMaxSameDiffSpacing()
FetMat ** fet[2]
Definition: tech.h:844
PolyMat * poly
Definition: tech.h:847
int getMaxWellDiffSpacing()
Material ** sel[2]
Definition: tech.h:845
RoutingMat ** metal
Definition: tech.h:849
GDSLayer * GDSlookup(const char *name)
static Technology * T
Definition: tech.h:822
WellMat ** well[2]
Definition: tech.h:842
static void Init()
make sure that layout.conf has been loaded!
int getMaxDiffSpacing()
Used for wells.
Definition: tech.h:545
int getOverhangWelldiff()
Definition: tech.h:560
int maxPlugDist()
Definition: tech.h:577
int getOverhang()
Definition: tech.h:555
int plug_dist
max distance to plug
Definition: tech.h:584
int * oppspacing
to other wells of a different type
Definition: tech.h:581
int minSpacing(int dev)
Definition: tech.h:566
int oppSpacing(int dev)
Definition: tech.h:572
int overhang
overhang from diffusion
Definition: tech.h:582
int * spacing
to other wells of the same type
Definition: tech.h:580
int overhang_welldiff
overhang from well diffusion
Definition: tech.h:583
WellMat(char *s)
Definition: tech.h:550
Holds design rules for all routing materials (metals, poly)
Definition: tech.h:278
int endofline_width
width for end of line extension
Definition: tech.h:280
int * parallelrunlength
parallel run length options
Definition: tech.h:307
RangeTable ** spacing_aux
Definition: tech.h:309
double antenna_ratio
antenna ratios for this layer
Definition: tech.h:283
int pitch
Definition: tech.h:286
int inf_sz
Definition: tech.h:313
int * influence
spacing influence table
Definition: tech.h:312
unsigned int routey
can be used for y routing
Definition: tech.h:300
const char * lef_name
lef/def name for this material
Definition: tech.h:297
unsigned int routex
can be used for x routing
Definition: tech.h:299
int endofline
end of line extension rule
Definition: tech.h:279
int runlength_mode
0 = parallelrunlength, 1 = twowidths
Definition: tech.h:302
int minjog
minumum turn distance on a jog
Definition: tech.h:281
double antenna_diff_ratio
antenna diffusion ratio
Definition: tech.h:284
int runlength
Definition: tech.h:304
int lef_width
Definition: tech.h:290