1 ///////////////////////////////////////////////////////////////////////////////
2 // BSD 3-Clause License
3 //
4 // Copyright (c) 2019, Nefelus Inc
5 // All rights reserved.
6 //
7 // Redistribution and use in source and binary forms, with or without
8 // modification, are permitted provided that the following conditions are met:
9 //
10 // * Redistributions of source code must retain the above copyright notice, this
11 // list of conditions and the following disclaimer.
12 //
13 // * Redistributions in binary form must reproduce the above copyright notice,
14 // this list of conditions and the following disclaimer in the documentation
15 // and/or other materials provided with the distribution.
16 //
17 // * Neither the name of the copyright holder nor the names of its
18 // contributors may be used to endorse or promote products derived from
19 // this software without specific prior written permission.
20 //
21 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 // POSSIBILITY OF SUCH DAMAGE.
32
33 // Generator Code Begin Cpp
34 #include "dbTechLayer.h"
35
36 #include "db.h"
37 #include "dbDatabase.h"
38 #include "dbDiff.hpp"
39 #include "dbSet.h"
40 #include "dbTable.h"
41 #include "dbTable.hpp"
42 #include "dbTechLayerCornerSpacingRule.h"
43 #include "dbTechLayerCutClassRule.h"
44 #include "dbTechLayerCutEnclosureRule.h"
45 #include "dbTechLayerCutSpacingRule.h"
46 #include "dbTechLayerCutSpacingTableDefRule.h"
47 #include "dbTechLayerCutSpacingTableOrthRule.h"
48 #include "dbTechLayerEolExtensionRule.h"
49 #include "dbTechLayerEolKeepOutRule.h"
50 #include "dbTechLayerMinStepRule.h"
51 #include "dbTechLayerSpacingEolRule.h"
52 #include "dbTechLayerSpacingTablePrlRule.h"
53 // User Code Begin Includes
54 #include "dbHashTable.hpp"
55 #include "dbTech.h"
56 #include "dbTechLayerAntennaRule.h"
57 #include "dbTechLayerSpacingRule.h"
58 #include "dbTechMinCutOrAreaRule.h"
59 #include "lefout.h"
60 #include "utl/Logger.h"
61 // User Code End Includes
62 namespace odb {
63
64 template class dbTable<_dbTechLayer>;
65
operator ==(const _dbTechLayer & rhs) const66 bool _dbTechLayer::operator==(const _dbTechLayer& rhs) const
67 {
68 if (flags_.num_masks_ != rhs.flags_.num_masks_)
69 return false;
70
71 if (flags_.has_max_width_ != rhs.flags_.has_max_width_)
72 return false;
73
74 if (flags_.has_thickness_ != rhs.flags_.has_thickness_)
75 return false;
76
77 if (flags_.has_area_ != rhs.flags_.has_area_)
78 return false;
79
80 if (flags_.has_protrusion_ != rhs.flags_.has_protrusion_)
81 return false;
82
83 if (flags_.has_alias_ != rhs.flags_.has_alias_)
84 return false;
85
86 if (flags_.has_xy_pitch_ != rhs.flags_.has_xy_pitch_)
87 return false;
88
89 if (flags_.has_xy_offset_ != rhs.flags_.has_xy_offset_)
90 return false;
91
92 if (flags_.rect_only_ != rhs.flags_.rect_only_)
93 return false;
94
95 if (flags_.right_way_on_grid_only_ != rhs.flags_.right_way_on_grid_only_)
96 return false;
97
98 if (flags_.right_way_on_grid_only_check_mask_
99 != rhs.flags_.right_way_on_grid_only_check_mask_)
100 return false;
101
102 if (flags_.rect_only_except_non_core_pins_
103 != rhs.flags_.rect_only_except_non_core_pins_)
104 return false;
105
106 if (flags_.lef58_type_ != rhs.flags_.lef58_type_)
107 return false;
108
109 if (*cut_class_rules_tbl_ != *rhs.cut_class_rules_tbl_)
110 return false;
111
112 if (cut_class_rules_hash_ != rhs.cut_class_rules_hash_)
113 return false;
114
115 if (*spacing_eol_rules_tbl_ != *rhs.spacing_eol_rules_tbl_)
116 return false;
117
118 if (*cut_spacing_rules_tbl_ != *rhs.cut_spacing_rules_tbl_)
119 return false;
120
121 if (*minstep_rules_tbl_ != *rhs.minstep_rules_tbl_)
122 return false;
123
124 if (*corner_spacing_rules_tbl_ != *rhs.corner_spacing_rules_tbl_)
125 return false;
126
127 if (*spacing_table_prl_rules_tbl_ != *rhs.spacing_table_prl_rules_tbl_)
128 return false;
129
130 if (*cut_spacing_table_orth_tbl_ != *rhs.cut_spacing_table_orth_tbl_)
131 return false;
132
133 if (*cut_spacing_table_def_tbl_ != *rhs.cut_spacing_table_def_tbl_)
134 return false;
135
136 if (*cut_enc_rules_tbl_ != *rhs.cut_enc_rules_tbl_)
137 return false;
138
139 if (*eol_ext_rules_tbl_ != *rhs.eol_ext_rules_tbl_)
140 return false;
141
142 if (*eol_keep_out_rules_tbl_ != *rhs.eol_keep_out_rules_tbl_)
143 return false;
144
145 // User Code Begin ==
146 if (flags_.type_ != rhs.flags_.type_)
147 return false;
148
149 if (flags_.direction_ != rhs.flags_.direction_)
150 return false;
151
152 if (flags_.minstep_type_ != rhs.flags_.minstep_type_)
153 return false;
154
155 if (_pitch_x != rhs._pitch_x)
156 return false;
157
158 if (_pitch_y != rhs._pitch_y)
159 return false;
160
161 if (_offset_x != rhs._offset_x)
162 return false;
163
164 if (_offset_y != rhs._offset_y)
165 return false;
166
167 if (_width != rhs._width)
168 return false;
169
170 if (_spacing != rhs._spacing)
171 return false;
172
173 if (_resistance != rhs._resistance)
174 return false;
175
176 if (_capacitance != rhs._capacitance)
177 return false;
178
179 if (_edge_capacitance != rhs._edge_capacitance)
180 return false;
181
182 if (_wire_extension != rhs._wire_extension)
183 return false;
184
185 if (_number != rhs._number)
186 return false;
187
188 if (_rlevel != rhs._rlevel)
189 return false;
190
191 if (_area != rhs._area)
192 return false;
193
194 if (_thickness != rhs._thickness)
195 return false;
196
197 if (_min_step != rhs._min_step)
198 return false;
199
200 if (_max_width != rhs._max_width)
201 return false;
202
203 if (_min_width != rhs._min_width)
204 return false;
205
206 if (_min_step_max_length != rhs._min_step_max_length)
207 return false;
208
209 if (_min_step_max_edges != rhs._min_step_max_edges)
210 return false;
211
212 if (_pt._width != rhs._pt._width)
213 return false;
214
215 if (_pt._length != rhs._pt._length)
216 return false;
217
218 if (_pt._from_width != rhs._pt._from_width)
219 return false;
220
221 if (_name && rhs._name) {
222 if (strcmp(_name, rhs._name) != 0)
223 return false;
224 } else if (_name || rhs._name)
225 return false;
226
227 if (_alias && rhs._alias) {
228 if (strcmp(_alias, rhs._alias) != 0)
229 return false;
230 } else if (_alias || rhs._alias)
231 return false;
232
233 if (_upper != rhs._upper)
234 return false;
235
236 if (_lower != rhs._lower)
237 return false;
238
239 if (*_spacing_rules_tbl != *rhs._spacing_rules_tbl)
240 return false;
241
242 if (*_min_cut_rules_tbl != *rhs._min_cut_rules_tbl)
243 return false;
244
245 if (*_min_enc_rules_tbl != *rhs._min_enc_rules_tbl)
246 return false;
247
248 if (*_v55inf_tbl != *rhs._v55inf_tbl)
249 return false;
250
251 if (_v55sp_length_idx != rhs._v55sp_length_idx)
252 return false;
253
254 if (_v55sp_width_idx != rhs._v55sp_width_idx)
255 return false;
256
257 if (_v55sp_spacing != rhs._v55sp_spacing)
258 return false;
259
260 if (_two_widths_sp_idx != rhs._two_widths_sp_idx)
261 return false;
262
263 if (_two_widths_sp_prl != rhs._two_widths_sp_prl)
264 return false;
265
266 if (_two_widths_sp_spacing != rhs._two_widths_sp_spacing)
267 return false;
268
269 if (_oxide1 != rhs._oxide1)
270 return false;
271
272 if (_oxide2 != rhs._oxide2)
273 return false;
274 // User Code End ==
275 return true;
276 }
operator <(const _dbTechLayer & rhs) const277 bool _dbTechLayer::operator<(const _dbTechLayer& rhs) const
278 {
279 // User Code Begin <
280 if (_number >= rhs._number)
281 return false;
282 // User Code End <
283 return true;
284 }
differences(dbDiff & diff,const char * field,const _dbTechLayer & rhs) const285 void _dbTechLayer::differences(dbDiff& diff,
286 const char* field,
287 const _dbTechLayer& rhs) const
288 {
289 DIFF_BEGIN
290
291 DIFF_FIELD(flags_.num_masks_);
292 DIFF_FIELD(flags_.has_max_width_);
293 DIFF_FIELD(flags_.has_thickness_);
294 DIFF_FIELD(flags_.has_area_);
295 DIFF_FIELD(flags_.has_protrusion_);
296 DIFF_FIELD(flags_.has_alias_);
297 DIFF_FIELD(flags_.has_xy_pitch_);
298 DIFF_FIELD(flags_.has_xy_offset_);
299 DIFF_FIELD(flags_.rect_only_);
300 DIFF_FIELD(flags_.right_way_on_grid_only_);
301 DIFF_FIELD(flags_.right_way_on_grid_only_check_mask_);
302 DIFF_FIELD(flags_.rect_only_except_non_core_pins_);
303 DIFF_FIELD(flags_.lef58_type_);
304 DIFF_TABLE(cut_class_rules_tbl_);
305 DIFF_HASH_TABLE(cut_class_rules_hash_);
306 DIFF_TABLE(spacing_eol_rules_tbl_);
307 DIFF_TABLE(cut_spacing_rules_tbl_);
308 DIFF_TABLE(minstep_rules_tbl_);
309 DIFF_TABLE(corner_spacing_rules_tbl_);
310 DIFF_TABLE(spacing_table_prl_rules_tbl_);
311 DIFF_TABLE(cut_spacing_table_orth_tbl_);
312 DIFF_TABLE(cut_spacing_table_def_tbl_);
313 DIFF_TABLE(cut_enc_rules_tbl_);
314 DIFF_TABLE(eol_ext_rules_tbl_);
315 DIFF_TABLE(eol_keep_out_rules_tbl_);
316 // User Code Begin Differences
317 DIFF_FIELD(flags_.type_);
318 DIFF_FIELD(flags_.direction_);
319 DIFF_FIELD(flags_.minstep_type_);
320 DIFF_FIELD(_pitch_x);
321 DIFF_FIELD(_pitch_y);
322 DIFF_FIELD(_offset_x);
323 DIFF_FIELD(_offset_y);
324 DIFF_FIELD(_width);
325 DIFF_FIELD(_spacing);
326 DIFF_FIELD(_resistance);
327 DIFF_FIELD(_capacitance);
328 DIFF_FIELD(_edge_capacitance);
329 DIFF_FIELD(_wire_extension);
330 DIFF_FIELD(_number);
331 DIFF_FIELD(_rlevel);
332 DIFF_FIELD(_area);
333 DIFF_FIELD(_thickness);
334 DIFF_FIELD(_min_step);
335 DIFF_FIELD(_max_width);
336 DIFF_FIELD(_min_width);
337 DIFF_FIELD(_min_step_max_length);
338 DIFF_FIELD(_min_step_max_edges);
339 DIFF_FIELD(_pt._length);
340 DIFF_FIELD(_pt._from_width);
341 DIFF_FIELD(_name);
342 DIFF_FIELD(_alias);
343 DIFF_FIELD(_upper);
344 DIFF_FIELD(_lower);
345 DIFF_TABLE_NO_DEEP(_spacing_rules_tbl);
346 DIFF_TABLE_NO_DEEP(_min_cut_rules_tbl);
347 DIFF_TABLE_NO_DEEP(_min_enc_rules_tbl);
348 DIFF_TABLE_NO_DEEP(_v55inf_tbl);
349 DIFF_VECTOR(_v55sp_length_idx);
350 DIFF_VECTOR(_v55sp_width_idx);
351 DIFF_MATRIX(_v55sp_spacing);
352 DIFF_VECTOR(_two_widths_sp_idx);
353 DIFF_VECTOR(_two_widths_sp_prl);
354 DIFF_MATRIX(_two_widths_sp_spacing);
355 DIFF_FIELD(_oxide1);
356 DIFF_FIELD(_oxide2);
357 // User Code End Differences
358 DIFF_END
359 }
out(dbDiff & diff,char side,const char * field) const360 void _dbTechLayer::out(dbDiff& diff, char side, const char* field) const
361 {
362 DIFF_OUT_BEGIN
363 DIFF_OUT_FIELD(flags_.num_masks_);
364 DIFF_OUT_FIELD(flags_.has_max_width_);
365 DIFF_OUT_FIELD(flags_.has_thickness_);
366 DIFF_OUT_FIELD(flags_.has_area_);
367 DIFF_OUT_FIELD(flags_.has_protrusion_);
368 DIFF_OUT_FIELD(flags_.has_alias_);
369 DIFF_OUT_FIELD(flags_.has_xy_pitch_);
370 DIFF_OUT_FIELD(flags_.has_xy_offset_);
371 DIFF_OUT_FIELD(flags_.rect_only_);
372 DIFF_OUT_FIELD(flags_.right_way_on_grid_only_);
373 DIFF_OUT_FIELD(flags_.right_way_on_grid_only_check_mask_);
374 DIFF_OUT_FIELD(flags_.rect_only_except_non_core_pins_);
375 DIFF_OUT_FIELD(flags_.lef58_type_);
376 DIFF_OUT_TABLE(cut_class_rules_tbl_);
377 DIFF_OUT_HASH_TABLE(cut_class_rules_hash_);
378 DIFF_OUT_TABLE(spacing_eol_rules_tbl_);
379 DIFF_OUT_TABLE(cut_spacing_rules_tbl_);
380 DIFF_OUT_TABLE(minstep_rules_tbl_);
381 DIFF_OUT_TABLE(corner_spacing_rules_tbl_);
382 DIFF_OUT_TABLE(spacing_table_prl_rules_tbl_);
383 DIFF_OUT_TABLE(cut_spacing_table_orth_tbl_);
384 DIFF_OUT_TABLE(cut_spacing_table_def_tbl_);
385 DIFF_OUT_TABLE(cut_enc_rules_tbl_);
386 DIFF_OUT_TABLE(eol_ext_rules_tbl_);
387 DIFF_OUT_TABLE(eol_keep_out_rules_tbl_);
388
389 // User Code Begin Out
390 DIFF_OUT_FIELD(flags_.type_);
391 DIFF_OUT_FIELD(flags_.direction_);
392 DIFF_OUT_FIELD(flags_.minstep_type_);
393 DIFF_OUT_FIELD(_pitch_x);
394 DIFF_OUT_FIELD(_pitch_y);
395 DIFF_OUT_FIELD(_offset_x);
396 DIFF_OUT_FIELD(_offset_y);
397 DIFF_OUT_FIELD(_width);
398 DIFF_OUT_FIELD(_spacing);
399 DIFF_OUT_FIELD(_resistance);
400 DIFF_OUT_FIELD(_capacitance);
401 DIFF_OUT_FIELD(_edge_capacitance);
402 DIFF_OUT_FIELD(_wire_extension);
403 DIFF_OUT_FIELD(_number);
404 DIFF_OUT_FIELD(_rlevel);
405 DIFF_OUT_FIELD(_area);
406 DIFF_OUT_FIELD(_thickness);
407 DIFF_OUT_FIELD(_min_step);
408 DIFF_OUT_FIELD(_max_width);
409 DIFF_OUT_FIELD(_min_width);
410 DIFF_OUT_FIELD(_min_step_max_length);
411 DIFF_OUT_FIELD(_min_step_max_edges);
412 DIFF_OUT_FIELD(_pt._length);
413 DIFF_OUT_FIELD(_pt._from_width);
414 DIFF_OUT_FIELD(_name);
415 DIFF_OUT_FIELD(_alias);
416 DIFF_OUT_FIELD(_upper);
417 DIFF_OUT_FIELD(_lower);
418 DIFF_OUT_TABLE_NO_DEEP(_spacing_rules_tbl);
419 DIFF_OUT_TABLE_NO_DEEP(_min_cut_rules_tbl);
420 DIFF_OUT_TABLE_NO_DEEP(_min_enc_rules_tbl);
421 DIFF_OUT_TABLE_NO_DEEP(_v55inf_tbl);
422 DIFF_OUT_VECTOR(_v55sp_length_idx);
423 DIFF_OUT_VECTOR(_v55sp_width_idx);
424 DIFF_OUT_MATRIX(_v55sp_spacing);
425 DIFF_OUT_VECTOR(_two_widths_sp_idx);
426 DIFF_OUT_VECTOR(_two_widths_sp_prl);
427 DIFF_OUT_MATRIX(_two_widths_sp_spacing);
428 DIFF_OUT_FIELD(_oxide1);
429 DIFF_OUT_FIELD(_oxide2);
430 // User Code End Out
431 DIFF_END
432 }
_dbTechLayer(_dbDatabase * db)433 _dbTechLayer::_dbTechLayer(_dbDatabase* db)
434 {
435 uint32_t* flags__bit_field = (uint32_t*) &flags_;
436 *flags__bit_field = 0;
437 cut_class_rules_tbl_ = new dbTable<_dbTechLayerCutClassRule>(
438 db,
439 this,
440 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
441 dbTechLayerCutClassRuleObj);
442 ZALLOCATED(cut_class_rules_tbl_);
443 cut_class_rules_hash_.setTable(cut_class_rules_tbl_);
444 spacing_eol_rules_tbl_ = new dbTable<_dbTechLayerSpacingEolRule>(
445 db,
446 this,
447 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
448 dbTechLayerSpacingEolRuleObj);
449 ZALLOCATED(spacing_eol_rules_tbl_);
450 cut_spacing_rules_tbl_ = new dbTable<_dbTechLayerCutSpacingRule>(
451 db,
452 this,
453 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
454 dbTechLayerCutSpacingRuleObj);
455 ZALLOCATED(cut_spacing_rules_tbl_);
456 minstep_rules_tbl_ = new dbTable<_dbTechLayerMinStepRule>(
457 db,
458 this,
459 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
460 dbTechLayerMinStepRuleObj);
461 ZALLOCATED(minstep_rules_tbl_);
462 corner_spacing_rules_tbl_ = new dbTable<_dbTechLayerCornerSpacingRule>(
463 db,
464 this,
465 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
466 dbTechLayerCornerSpacingRuleObj);
467 ZALLOCATED(corner_spacing_rules_tbl_);
468 spacing_table_prl_rules_tbl_ = new dbTable<_dbTechLayerSpacingTablePrlRule>(
469 db,
470 this,
471 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
472 dbTechLayerSpacingTablePrlRuleObj);
473 ZALLOCATED(spacing_table_prl_rules_tbl_);
474 cut_spacing_table_orth_tbl_
475 = new dbTable<_dbTechLayerCutSpacingTableOrthRule>(
476 db,
477 this,
478 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
479 dbTechLayerCutSpacingTableOrthRuleObj);
480 ZALLOCATED(cut_spacing_table_orth_tbl_);
481 cut_spacing_table_def_tbl_ = new dbTable<_dbTechLayerCutSpacingTableDefRule>(
482 db,
483 this,
484 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
485 dbTechLayerCutSpacingTableDefRuleObj);
486 ZALLOCATED(cut_spacing_table_def_tbl_);
487 cut_enc_rules_tbl_ = new dbTable<_dbTechLayerCutEnclosureRule>(
488 db,
489 this,
490 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
491 dbTechLayerCutEnclosureRuleObj);
492 ZALLOCATED(cut_enc_rules_tbl_);
493 eol_ext_rules_tbl_ = new dbTable<_dbTechLayerEolExtensionRule>(
494 db,
495 this,
496 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
497 dbTechLayerEolExtensionRuleObj);
498 ZALLOCATED(eol_ext_rules_tbl_);
499 eol_keep_out_rules_tbl_ = new dbTable<_dbTechLayerEolKeepOutRule>(
500 db,
501 this,
502 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
503 dbTechLayerEolKeepOutRuleObj);
504 ZALLOCATED(eol_keep_out_rules_tbl_);
505 // User Code Begin Constructor
506 flags_.type_ = dbTechLayerType::ROUTING;
507 flags_.direction_ = dbTechLayerDir::NONE;
508 flags_.minstep_type_ = dbTechLayerMinStepType();
509 flags_.num_masks_ = 1;
510 _pitch_x = 0;
511 _pitch_y = 0;
512 _offset_x = 0;
513 _offset_y = 0;
514 _width = 0;
515 _spacing = 0;
516 _resistance = 0.0;
517 _capacitance = 0.0;
518 _edge_capacitance = 0.0;
519 _wire_extension = 0;
520 _number = 0;
521 _rlevel = 0;
522 _area = 0.0;
523 _thickness = 0;
524 _min_step = -1;
525 _pt._width = 0;
526 _pt._length = 0;
527 _pt._from_width = 0;
528 _max_width = MAX_INT;
529 _min_width = 0;
530 _min_step_max_length = -1;
531 _min_step_max_edges = -1;
532 _v55sp_length_idx.clear();
533 _v55sp_width_idx.clear();
534 _v55sp_spacing.clear();
535 _name = 0;
536 _alias = 0;
537
538 _spacing_rules_tbl = new dbTable<_dbTechLayerSpacingRule>(
539 db,
540 this,
541 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
542 dbTechLayerSpacingRuleObj);
543 ZALLOCATED(_spacing_rules_tbl);
544
545 _min_cut_rules_tbl = new dbTable<_dbTechMinCutRule>(
546 db,
547 this,
548 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
549 dbTechMinCutRuleObj,
550 8,
551 3);
552 ZALLOCATED(_min_cut_rules_tbl);
553
554 _min_enc_rules_tbl = new dbTable<_dbTechMinEncRule>(
555 db,
556 this,
557 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
558 dbTechMinEncRuleObj,
559 8,
560 3);
561 ZALLOCATED(_min_enc_rules_tbl);
562
563 _v55inf_tbl = new dbTable<_dbTechV55InfluenceEntry>(
564 db,
565 this,
566 (GetObjTbl_t) &_dbTechLayer::getObjectTable,
567 dbTechV55InfluenceEntryObj,
568 8,
569 3);
570 ZALLOCATED(_v55inf_tbl);
571 // User Code End Constructor
572 }
_dbTechLayer(_dbDatabase * db,const _dbTechLayer & r)573 _dbTechLayer::_dbTechLayer(_dbDatabase* db, const _dbTechLayer& r)
574 {
575 flags_.num_masks_ = r.flags_.num_masks_;
576 flags_.has_max_width_ = r.flags_.has_max_width_;
577 flags_.has_thickness_ = r.flags_.has_thickness_;
578 flags_.has_area_ = r.flags_.has_area_;
579 flags_.has_protrusion_ = r.flags_.has_protrusion_;
580 flags_.has_alias_ = r.flags_.has_alias_;
581 flags_.has_xy_pitch_ = r.flags_.has_xy_pitch_;
582 flags_.has_xy_offset_ = r.flags_.has_xy_offset_;
583 flags_.rect_only_ = r.flags_.rect_only_;
584 flags_.right_way_on_grid_only_ = r.flags_.right_way_on_grid_only_;
585 flags_.right_way_on_grid_only_check_mask_
586 = r.flags_.right_way_on_grid_only_check_mask_;
587 flags_.rect_only_except_non_core_pins_
588 = r.flags_.rect_only_except_non_core_pins_;
589 flags_.lef58_type_ = r.flags_.lef58_type_;
590 flags_.spare_bits_ = r.flags_.spare_bits_;
591 cut_class_rules_tbl_ = new dbTable<_dbTechLayerCutClassRule>(
592 db, this, *r.cut_class_rules_tbl_);
593 ZALLOCATED(cut_class_rules_tbl_);
594 cut_class_rules_hash_.setTable(cut_class_rules_tbl_);
595 spacing_eol_rules_tbl_ = new dbTable<_dbTechLayerSpacingEolRule>(
596 db, this, *r.spacing_eol_rules_tbl_);
597 ZALLOCATED(spacing_eol_rules_tbl_);
598 cut_spacing_rules_tbl_ = new dbTable<_dbTechLayerCutSpacingRule>(
599 db, this, *r.cut_spacing_rules_tbl_);
600 ZALLOCATED(cut_spacing_rules_tbl_);
601 minstep_rules_tbl_
602 = new dbTable<_dbTechLayerMinStepRule>(db, this, *r.minstep_rules_tbl_);
603 ZALLOCATED(minstep_rules_tbl_);
604 corner_spacing_rules_tbl_ = new dbTable<_dbTechLayerCornerSpacingRule>(
605 db, this, *r.corner_spacing_rules_tbl_);
606 ZALLOCATED(corner_spacing_rules_tbl_);
607 spacing_table_prl_rules_tbl_ = new dbTable<_dbTechLayerSpacingTablePrlRule>(
608 db, this, *r.spacing_table_prl_rules_tbl_);
609 ZALLOCATED(spacing_table_prl_rules_tbl_);
610 cut_spacing_table_orth_tbl_
611 = new dbTable<_dbTechLayerCutSpacingTableOrthRule>(
612 db, this, *r.cut_spacing_table_orth_tbl_);
613 ZALLOCATED(cut_spacing_table_orth_tbl_);
614 cut_spacing_table_def_tbl_ = new dbTable<_dbTechLayerCutSpacingTableDefRule>(
615 db, this, *r.cut_spacing_table_def_tbl_);
616 ZALLOCATED(cut_spacing_table_def_tbl_);
617 cut_enc_rules_tbl_ = new dbTable<_dbTechLayerCutEnclosureRule>(
618 db, this, *r.cut_enc_rules_tbl_);
619 ZALLOCATED(cut_enc_rules_tbl_);
620 eol_ext_rules_tbl_ = new dbTable<_dbTechLayerEolExtensionRule>(
621 db, this, *r.eol_ext_rules_tbl_);
622 ZALLOCATED(eol_ext_rules_tbl_);
623 eol_keep_out_rules_tbl_ = new dbTable<_dbTechLayerEolKeepOutRule>(
624 db, this, *r.eol_keep_out_rules_tbl_);
625 ZALLOCATED(eol_keep_out_rules_tbl_);
626 // User Code Begin CopyConstructor
627 flags_ = r.flags_;
628 _pitch_x = r._pitch_x;
629 _pitch_y = r._pitch_y;
630 _offset_x = r._offset_x;
631 _offset_y = r._offset_y;
632 _width = r._width;
633 _spacing = r._spacing;
634 _resistance = r._resistance;
635 _capacitance = r._capacitance;
636 _edge_capacitance = r._edge_capacitance;
637 _wire_extension = r._wire_extension;
638 _number = r._number;
639 _rlevel = r._rlevel;
640 _area = r._area;
641 _thickness = r._thickness;
642 _max_width = r._max_width;
643 _min_width = r._min_width;
644 _min_step = r._min_step;
645 _min_step_max_length = r._min_step_max_length;
646 _min_step_max_edges = r._min_step_max_edges;
647 _pt = r._pt;
648 _name = NULL;
649 _alias = NULL;
650 _upper = r._upper;
651 _lower = r._lower;
652 _v55sp_length_idx = r._v55sp_length_idx;
653 _v55sp_width_idx = r._v55sp_width_idx;
654 _v55sp_spacing = r._v55sp_spacing;
655 _two_widths_sp_idx = r._two_widths_sp_idx;
656 _two_widths_sp_prl = r._two_widths_sp_prl;
657 _two_widths_sp_spacing = r._two_widths_sp_spacing;
658 _oxide1 = r._oxide1;
659 _oxide2 = r._oxide2;
660
661 if (r._name) {
662 _name = strdup(r._name);
663 ZALLOCATED(_name);
664 }
665
666 if (r._alias) {
667 _alias = strdup(r._alias);
668 ZALLOCATED(_alias);
669 }
670
671 _spacing_rules_tbl
672 = new dbTable<_dbTechLayerSpacingRule>(db, this, *r._spacing_rules_tbl);
673 ZALLOCATED(_spacing_rules_tbl);
674
675 _min_cut_rules_tbl
676 = new dbTable<_dbTechMinCutRule>(db, this, *r._min_cut_rules_tbl);
677 ZALLOCATED(_min_cut_rules_tbl);
678
679 _min_enc_rules_tbl
680 = new dbTable<_dbTechMinEncRule>(db, this, *r._min_enc_rules_tbl);
681 ZALLOCATED(_min_enc_rules_tbl);
682
683 _v55inf_tbl = new dbTable<_dbTechV55InfluenceEntry>(db, this, *r._v55inf_tbl);
684 ZALLOCATED(_v55inf_tbl);
685 // User Code End CopyConstructor
686 }
687
operator >>(dbIStream & stream,_dbTechLayer & obj)688 dbIStream& operator>>(dbIStream& stream, _dbTechLayer& obj)
689 {
690 uint32_t* flags__bit_field = (uint32_t*) &obj.flags_;
691 stream >> *flags__bit_field;
692 stream >> *obj.cut_class_rules_tbl_;
693 stream >> obj.cut_class_rules_hash_;
694 stream >> *obj.spacing_eol_rules_tbl_;
695 stream >> *obj.cut_spacing_rules_tbl_;
696 stream >> *obj.minstep_rules_tbl_;
697 stream >> *obj.corner_spacing_rules_tbl_;
698 stream >> *obj.spacing_table_prl_rules_tbl_;
699 stream >> *obj.cut_spacing_table_orth_tbl_;
700 stream >> *obj.cut_spacing_table_def_tbl_;
701 stream >> *obj.cut_enc_rules_tbl_;
702 stream >> *obj.eol_ext_rules_tbl_;
703 stream >> *obj.eol_keep_out_rules_tbl_;
704 // User Code Begin >>
705 stream >> obj._pitch_x;
706 stream >> obj._pitch_y;
707 stream >> obj._offset_x;
708 stream >> obj._offset_y;
709 stream >> obj._width;
710 stream >> obj._spacing;
711 stream >> obj._resistance;
712 stream >> obj._capacitance;
713 stream >> obj._edge_capacitance;
714 stream >> obj._wire_extension;
715 stream >> obj._number;
716 stream >> obj._rlevel;
717 stream >> obj._area;
718 stream >> obj._thickness;
719 stream >> obj._min_step;
720 stream >> obj._min_step_max_length;
721 stream >> obj._min_step_max_edges;
722 stream >> obj._max_width;
723 stream >> obj._min_width;
724 stream >> obj._pt._width;
725 stream >> obj._pt._length;
726 stream >> obj._pt._from_width;
727 stream >> obj._name;
728 stream >> obj._alias;
729 stream >> obj._lower;
730 stream >> obj._upper;
731 stream >> *obj._spacing_rules_tbl;
732 stream >> *obj._min_cut_rules_tbl;
733 stream >> *obj._min_enc_rules_tbl;
734 stream >> *obj._v55inf_tbl;
735 stream >> obj._v55sp_length_idx;
736 stream >> obj._v55sp_width_idx;
737 stream >> obj._v55sp_spacing;
738 stream >> obj._two_widths_sp_idx;
739 stream >> obj._two_widths_sp_prl;
740 stream >> obj._two_widths_sp_spacing;
741 stream >> obj._oxide1;
742 stream >> obj._oxide2;
743 // User Code End >>
744 return stream;
745 }
operator <<(dbOStream & stream,const _dbTechLayer & obj)746 dbOStream& operator<<(dbOStream& stream, const _dbTechLayer& obj)
747 {
748 uint32_t* flags__bit_field = (uint32_t*) &obj.flags_;
749 stream << *flags__bit_field;
750 stream << *obj.cut_class_rules_tbl_;
751 stream << obj.cut_class_rules_hash_;
752 stream << *obj.spacing_eol_rules_tbl_;
753 stream << *obj.cut_spacing_rules_tbl_;
754 stream << *obj.minstep_rules_tbl_;
755 stream << *obj.corner_spacing_rules_tbl_;
756 stream << *obj.spacing_table_prl_rules_tbl_;
757 stream << *obj.cut_spacing_table_orth_tbl_;
758 stream << *obj.cut_spacing_table_def_tbl_;
759 stream << *obj.cut_enc_rules_tbl_;
760 stream << *obj.eol_ext_rules_tbl_;
761 stream << *obj.eol_keep_out_rules_tbl_;
762 // User Code Begin <<
763 stream << obj._pitch_x;
764 stream << obj._pitch_y;
765 stream << obj._offset_x;
766 stream << obj._offset_y;
767 stream << obj._width;
768 stream << obj._spacing;
769 stream << obj._resistance;
770 stream << obj._capacitance;
771 stream << obj._edge_capacitance;
772 stream << obj._wire_extension;
773 stream << obj._number;
774 stream << obj._rlevel;
775 stream << obj._area;
776 stream << obj._thickness;
777 stream << obj._min_step;
778 stream << obj._min_step_max_length;
779 stream << obj._min_step_max_edges;
780 stream << obj._max_width;
781 stream << obj._min_width;
782 stream << obj._pt._width;
783 stream << obj._pt._length;
784 stream << obj._pt._from_width;
785 stream << obj._name;
786 stream << obj._alias;
787 stream << obj._lower;
788 stream << obj._upper;
789 stream << *obj._spacing_rules_tbl;
790 stream << *obj._min_cut_rules_tbl;
791 stream << *obj._min_enc_rules_tbl;
792 stream << *obj._v55inf_tbl;
793 stream << obj._v55sp_length_idx;
794 stream << obj._v55sp_width_idx;
795 stream << obj._v55sp_spacing;
796 stream << obj._two_widths_sp_idx;
797 stream << obj._two_widths_sp_prl;
798 stream << obj._two_widths_sp_spacing;
799 stream << obj._oxide1;
800 stream << obj._oxide2;
801 // User Code End <<
802 return stream;
803 }
804
getObjectTable(dbObjectType type)805 dbObjectTable* _dbTechLayer::getObjectTable(dbObjectType type)
806 {
807 switch (type) {
808 case dbTechLayerCutClassRuleObj:
809 return cut_class_rules_tbl_;
810 case dbTechLayerSpacingEolRuleObj:
811 return spacing_eol_rules_tbl_;
812 case dbTechLayerCutSpacingRuleObj:
813 return cut_spacing_rules_tbl_;
814 case dbTechLayerMinStepRuleObj:
815 return minstep_rules_tbl_;
816 case dbTechLayerCornerSpacingRuleObj:
817 return corner_spacing_rules_tbl_;
818 case dbTechLayerSpacingTablePrlRuleObj:
819 return spacing_table_prl_rules_tbl_;
820 case dbTechLayerCutSpacingTableOrthRuleObj:
821 return cut_spacing_table_orth_tbl_;
822 case dbTechLayerCutSpacingTableDefRuleObj:
823 return cut_spacing_table_def_tbl_;
824 case dbTechLayerCutEnclosureRuleObj:
825 return cut_enc_rules_tbl_;
826 case dbTechLayerEolExtensionRuleObj:
827 return eol_ext_rules_tbl_;
828 case dbTechLayerEolKeepOutRuleObj:
829 return eol_keep_out_rules_tbl_;
830 // User Code Begin getObjectTable
831 case dbTechLayerSpacingRuleObj:
832 return _spacing_rules_tbl;
833
834 case dbTechMinCutRuleObj:
835 return _min_cut_rules_tbl;
836
837 case dbTechMinEncRuleObj:
838 return _min_enc_rules_tbl;
839
840 case dbTechV55InfluenceEntryObj:
841 return _v55inf_tbl;
842 // User Code End getObjectTable
843 default:
844 break;
845 }
846 return getTable()->getObjectTable(type);
847 }
~_dbTechLayer()848 _dbTechLayer::~_dbTechLayer()
849 {
850 delete cut_class_rules_tbl_;
851 delete spacing_eol_rules_tbl_;
852 delete cut_spacing_rules_tbl_;
853 delete minstep_rules_tbl_;
854 delete corner_spacing_rules_tbl_;
855 delete spacing_table_prl_rules_tbl_;
856 delete cut_spacing_table_orth_tbl_;
857 delete cut_spacing_table_def_tbl_;
858 delete cut_enc_rules_tbl_;
859 delete eol_ext_rules_tbl_;
860 delete eol_keep_out_rules_tbl_;
861 // User Code Begin Destructor
862 if (_name)
863 free((void*) _name);
864
865 if (_spacing_rules_tbl)
866 delete _spacing_rules_tbl;
867
868 if (_min_cut_rules_tbl)
869 delete _min_cut_rules_tbl;
870
871 if (_min_enc_rules_tbl)
872 delete _min_enc_rules_tbl;
873
874 if (_v55inf_tbl)
875 delete _v55inf_tbl;
876 // User Code End Destructor
877 }
878
879 // User Code Begin PrivateMethods
getV55RowIdx(const int & rowVal) const880 uint _dbTechLayer::getV55RowIdx(const int& rowVal) const
881 {
882 auto pos = --(std::lower_bound(
883 _v55sp_width_idx.begin(), _v55sp_width_idx.end(), rowVal));
884 return std::max(0, (int) std::distance(_v55sp_width_idx.begin(), pos));
885 }
getV55ColIdx(const int & colVal) const886 uint _dbTechLayer::getV55ColIdx(const int& colVal) const
887 {
888 auto pos = --(std::lower_bound(
889 _v55sp_length_idx.begin(), _v55sp_length_idx.end(), colVal));
890 return std::max(0, (int) std::distance(_v55sp_length_idx.begin(), pos));
891 }
getTwIdx(const int width,const int prl) const892 uint _dbTechLayer::getTwIdx(const int width, const int prl) const
893 {
894 int sz = _two_widths_sp_idx.size();
895 for (int i = 0; i < sz; i++) {
896 if (width <= _two_widths_sp_idx[i])
897 return std::max(0, i - 1);
898 if (_two_widths_sp_prl[i] != -1 && prl <= _two_widths_sp_prl[i])
899 return std::max(0, i - 1);
900 }
901 return sz - 1;
902 }
903 // User Code End PrivateMethods
904
905 ////////////////////////////////////////////////////////////////////
906 //
907 // dbTechLayer - Methods
908 //
909 ////////////////////////////////////////////////////////////////////
910
getTechLayerCutClassRules() const911 dbSet<dbTechLayerCutClassRule> dbTechLayer::getTechLayerCutClassRules() const
912 {
913 _dbTechLayer* obj = (_dbTechLayer*) this;
914 return dbSet<dbTechLayerCutClassRule>(obj, obj->cut_class_rules_tbl_);
915 }
916
findTechLayerCutClassRule(const char * name) const917 dbTechLayerCutClassRule* dbTechLayer::findTechLayerCutClassRule(
918 const char* name) const
919 {
920 _dbTechLayer* obj = (_dbTechLayer*) this;
921 return (dbTechLayerCutClassRule*) obj->cut_class_rules_hash_.find(name);
922 }
923
getTechLayerSpacingEolRules() const924 dbSet<dbTechLayerSpacingEolRule> dbTechLayer::getTechLayerSpacingEolRules()
925 const
926 {
927 _dbTechLayer* obj = (_dbTechLayer*) this;
928 return dbSet<dbTechLayerSpacingEolRule>(obj, obj->spacing_eol_rules_tbl_);
929 }
930
getTechLayerCutSpacingRules() const931 dbSet<dbTechLayerCutSpacingRule> dbTechLayer::getTechLayerCutSpacingRules()
932 const
933 {
934 _dbTechLayer* obj = (_dbTechLayer*) this;
935 return dbSet<dbTechLayerCutSpacingRule>(obj, obj->cut_spacing_rules_tbl_);
936 }
937
getTechLayerMinStepRules() const938 dbSet<dbTechLayerMinStepRule> dbTechLayer::getTechLayerMinStepRules() const
939 {
940 _dbTechLayer* obj = (_dbTechLayer*) this;
941 return dbSet<dbTechLayerMinStepRule>(obj, obj->minstep_rules_tbl_);
942 }
943
944 dbSet<dbTechLayerCornerSpacingRule>
getTechLayerCornerSpacingRules() const945 dbTechLayer::getTechLayerCornerSpacingRules() const
946 {
947 _dbTechLayer* obj = (_dbTechLayer*) this;
948 return dbSet<dbTechLayerCornerSpacingRule>(obj,
949 obj->corner_spacing_rules_tbl_);
950 }
951
952 dbSet<dbTechLayerSpacingTablePrlRule>
getTechLayerSpacingTablePrlRules() const953 dbTechLayer::getTechLayerSpacingTablePrlRules() const
954 {
955 _dbTechLayer* obj = (_dbTechLayer*) this;
956 return dbSet<dbTechLayerSpacingTablePrlRule>(
957 obj, obj->spacing_table_prl_rules_tbl_);
958 }
959
960 dbSet<dbTechLayerCutSpacingTableOrthRule>
getTechLayerCutSpacingTableOrthRules() const961 dbTechLayer::getTechLayerCutSpacingTableOrthRules() const
962 {
963 _dbTechLayer* obj = (_dbTechLayer*) this;
964 return dbSet<dbTechLayerCutSpacingTableOrthRule>(
965 obj, obj->cut_spacing_table_orth_tbl_);
966 }
967
968 dbSet<dbTechLayerCutSpacingTableDefRule>
getTechLayerCutSpacingTableDefRules() const969 dbTechLayer::getTechLayerCutSpacingTableDefRules() const
970 {
971 _dbTechLayer* obj = (_dbTechLayer*) this;
972 return dbSet<dbTechLayerCutSpacingTableDefRule>(
973 obj, obj->cut_spacing_table_def_tbl_);
974 }
975
getTechLayerCutEnclosureRules() const976 dbSet<dbTechLayerCutEnclosureRule> dbTechLayer::getTechLayerCutEnclosureRules()
977 const
978 {
979 _dbTechLayer* obj = (_dbTechLayer*) this;
980 return dbSet<dbTechLayerCutEnclosureRule>(obj, obj->cut_enc_rules_tbl_);
981 }
982
getTechLayerEolExtensionRules() const983 dbSet<dbTechLayerEolExtensionRule> dbTechLayer::getTechLayerEolExtensionRules()
984 const
985 {
986 _dbTechLayer* obj = (_dbTechLayer*) this;
987 return dbSet<dbTechLayerEolExtensionRule>(obj, obj->eol_ext_rules_tbl_);
988 }
989
getTechLayerEolKeepOutRules() const990 dbSet<dbTechLayerEolKeepOutRule> dbTechLayer::getTechLayerEolKeepOutRules()
991 const
992 {
993 _dbTechLayer* obj = (_dbTechLayer*) this;
994 return dbSet<dbTechLayerEolKeepOutRule>(obj, obj->eol_keep_out_rules_tbl_);
995 }
996
setRectOnly(bool rect_only)997 void dbTechLayer::setRectOnly(bool rect_only)
998 {
999 _dbTechLayer* obj = (_dbTechLayer*) this;
1000
1001 obj->flags_.rect_only_ = rect_only;
1002 }
1003
isRectOnly() const1004 bool dbTechLayer::isRectOnly() const
1005 {
1006 _dbTechLayer* obj = (_dbTechLayer*) this;
1007
1008 return obj->flags_.rect_only_;
1009 }
1010
setRightWayOnGridOnly(bool right_way_on_grid_only)1011 void dbTechLayer::setRightWayOnGridOnly(bool right_way_on_grid_only)
1012 {
1013 _dbTechLayer* obj = (_dbTechLayer*) this;
1014
1015 obj->flags_.right_way_on_grid_only_ = right_way_on_grid_only;
1016 }
1017
isRightWayOnGridOnly() const1018 bool dbTechLayer::isRightWayOnGridOnly() const
1019 {
1020 _dbTechLayer* obj = (_dbTechLayer*) this;
1021
1022 return obj->flags_.right_way_on_grid_only_;
1023 }
1024
setRightWayOnGridOnlyCheckMask(bool right_way_on_grid_only_check_mask)1025 void dbTechLayer::setRightWayOnGridOnlyCheckMask(
1026 bool right_way_on_grid_only_check_mask)
1027 {
1028 _dbTechLayer* obj = (_dbTechLayer*) this;
1029
1030 obj->flags_.right_way_on_grid_only_check_mask_
1031 = right_way_on_grid_only_check_mask;
1032 }
1033
isRightWayOnGridOnlyCheckMask() const1034 bool dbTechLayer::isRightWayOnGridOnlyCheckMask() const
1035 {
1036 _dbTechLayer* obj = (_dbTechLayer*) this;
1037
1038 return obj->flags_.right_way_on_grid_only_check_mask_;
1039 }
1040
setRectOnlyExceptNonCorePins(bool rect_only_except_non_core_pins)1041 void dbTechLayer::setRectOnlyExceptNonCorePins(
1042 bool rect_only_except_non_core_pins)
1043 {
1044 _dbTechLayer* obj = (_dbTechLayer*) this;
1045
1046 obj->flags_.rect_only_except_non_core_pins_ = rect_only_except_non_core_pins;
1047 }
1048
isRectOnlyExceptNonCorePins() const1049 bool dbTechLayer::isRectOnlyExceptNonCorePins() const
1050 {
1051 _dbTechLayer* obj = (_dbTechLayer*) this;
1052
1053 return obj->flags_.rect_only_except_non_core_pins_;
1054 }
1055
1056 // User Code Begin dbTechLayerPublicMethods
1057
setLef58Type(LEF58_TYPE type)1058 void dbTechLayer::setLef58Type(LEF58_TYPE type)
1059 {
1060 _dbTechLayer* layer = (_dbTechLayer*) this;
1061 layer->flags_.lef58_type_ = (uint) type;
1062 }
1063
getLef58Type() const1064 dbTechLayer::LEF58_TYPE dbTechLayer::getLef58Type() const
1065 {
1066 _dbTechLayer* layer = (_dbTechLayer*) this;
1067 return (dbTechLayer::LEF58_TYPE) layer->flags_.lef58_type_;
1068 }
1069
getName() const1070 std::string dbTechLayer::getName() const
1071 {
1072 _dbTechLayer* layer = (_dbTechLayer*) this;
1073 return layer->_name;
1074 }
1075
getConstName() const1076 const char* dbTechLayer::getConstName() const
1077 {
1078 _dbTechLayer* layer = (_dbTechLayer*) this;
1079 return layer->_name;
1080 }
1081
hasAlias()1082 bool dbTechLayer::hasAlias()
1083 {
1084 _dbTechLayer* layer = (_dbTechLayer*) this;
1085 return layer->flags_.has_alias_ == 1;
1086 }
1087
getAlias()1088 std::string dbTechLayer::getAlias()
1089 {
1090 _dbTechLayer* layer = (_dbTechLayer*) this;
1091
1092 if (layer->_alias == NULL) {
1093 return "";
1094 }
1095
1096 return layer->_alias;
1097 }
1098
setAlias(const char * alias)1099 void dbTechLayer::setAlias(const char* alias)
1100 {
1101 _dbTechLayer* layer = (_dbTechLayer*) this;
1102
1103 if (layer->_alias)
1104 free((void*) layer->_alias);
1105
1106 layer->flags_.has_alias_ = 1;
1107 layer->_alias = strdup(alias);
1108 ZALLOCATED(layer->_alias);
1109 }
1110
getWidth() const1111 uint dbTechLayer::getWidth() const
1112 {
1113 _dbTechLayer* layer = (_dbTechLayer*) this;
1114 return layer->_width;
1115 }
1116
setWidth(int width)1117 void dbTechLayer::setWidth(int width)
1118 {
1119 _dbTechLayer* layer = (_dbTechLayer*) this;
1120 layer->_width = width;
1121 }
1122
getSpacing()1123 int dbTechLayer::getSpacing()
1124 {
1125 _dbTechLayer* layer = (_dbTechLayer*) this;
1126 return layer->_spacing;
1127 }
1128
setSpacing(int spacing)1129 void dbTechLayer::setSpacing(int spacing)
1130 {
1131 _dbTechLayer* layer = (_dbTechLayer*) this;
1132 layer->_spacing = spacing;
1133 }
1134
getEdgeCapacitance()1135 double dbTechLayer::getEdgeCapacitance()
1136 {
1137 _dbTechLayer* layer = (_dbTechLayer*) this;
1138 return layer->_edge_capacitance;
1139 }
1140
setEdgeCapacitance(double cap)1141 void dbTechLayer::setEdgeCapacitance(double cap)
1142 {
1143 _dbTechLayer* layer = (_dbTechLayer*) this;
1144 layer->_edge_capacitance = cap;
1145 }
1146
getWireExtension()1147 uint dbTechLayer::getWireExtension()
1148 {
1149 _dbTechLayer* layer = (_dbTechLayer*) this;
1150 return layer->_wire_extension;
1151 }
1152
setWireExtension(uint ext)1153 void dbTechLayer::setWireExtension(uint ext)
1154 {
1155 _dbTechLayer* layer = (_dbTechLayer*) this;
1156 layer->_wire_extension = ext;
1157 }
1158
getSpacing(int w,int l)1159 int dbTechLayer::getSpacing(int w, int l)
1160 {
1161 _dbTechLayer* layer = (_dbTechLayer*) this;
1162 dbSet<dbTechLayerSpacingRule> v54rules;
1163
1164 bool found_spacing = false;
1165 uint spacing = MAX_INT;
1166
1167 bool found_over_spacing = false;
1168 uint over_spacing = MAX_INT;
1169 uint width = (uint) w;
1170 uint length = (uint) l;
1171
1172 if (getV54SpacingRules(v54rules)) {
1173 dbSet<dbTechLayerSpacingRule>::iterator ritr;
1174 dbTechLayerSpacingRule* cur_rule;
1175 uint rmin, rmax;
1176
1177 for (ritr = v54rules.begin(); ritr != v54rules.end(); ++ritr) {
1178 cur_rule = *ritr;
1179 if (cur_rule->getRange(rmin, rmax)) {
1180 if ((width >= rmin) && (width <= rmax)) {
1181 spacing = MIN(spacing, cur_rule->getSpacing());
1182 found_spacing = true;
1183 }
1184 if (width > rmax) {
1185 found_over_spacing = true;
1186 over_spacing = MIN(over_spacing, cur_rule->getSpacing());
1187 }
1188 }
1189 }
1190 }
1191
1192 std::vector<std::vector<uint>> v55rules;
1193 uint i, j;
1194 if (getV55SpacingTable(v55rules)) {
1195 for (i = 1; (i < layer->_v55sp_width_idx.size())
1196 && (width > layer->_v55sp_width_idx[i]);
1197 i++)
1198 ;
1199 for (j = 1; (j < layer->_v55sp_length_idx.size())
1200 && (length > layer->_v55sp_length_idx[j]);
1201 j++)
1202 ;
1203 found_spacing = true;
1204 spacing = v55rules[i - 1][j - 1];
1205 }
1206
1207 if ((!found_spacing) && (found_over_spacing)) {
1208 found_spacing = true;
1209 spacing = over_spacing;
1210 }
1211
1212 return (found_spacing) ? spacing : layer->_spacing;
1213 }
1214
1215 //
1216 // Get the low end of the uppermost range for wide wire design rules.
1217 //
getMaxWideDRCRange(int & owidth,int & olength)1218 void dbTechLayer::getMaxWideDRCRange(int& owidth, int& olength)
1219 {
1220 _dbTechLayer* layer = (_dbTechLayer*) this;
1221 dbSet<dbTechLayerSpacingRule> v54rules;
1222
1223 owidth = getWidth();
1224 olength = owidth;
1225
1226 if (getV54SpacingRules(v54rules)) {
1227 dbSet<dbTechLayerSpacingRule>::iterator ritr;
1228 uint rmin, rmax;
1229
1230 for (ritr = v54rules.begin(); ritr != v54rules.end(); ++ritr) {
1231 if ((*ritr)->getRange(rmin, rmax)) {
1232 if (rmin > (uint) owidth) {
1233 owidth = rmin;
1234 olength = rmin;
1235 }
1236 }
1237 }
1238 }
1239
1240 if (hasV55SpacingRules()) {
1241 owidth = layer->_v55sp_width_idx[layer->_v55sp_width_idx.size() - 1];
1242 olength = layer->_v55sp_length_idx[layer->_v55sp_length_idx.size() - 1];
1243 }
1244 }
1245
1246 //
1247 // Get the low end of the lowermost range for wide wire design rules.
1248 //
getMinWideDRCRange(int & owidth,int & olength)1249 void dbTechLayer::getMinWideDRCRange(int& owidth, int& olength)
1250 {
1251 _dbTechLayer* layer = (_dbTechLayer*) this;
1252 dbSet<dbTechLayerSpacingRule> v54rules;
1253
1254 owidth = getWidth();
1255 olength = owidth;
1256
1257 if (getV54SpacingRules(v54rules)) {
1258 dbSet<dbTechLayerSpacingRule>::iterator ritr;
1259 uint rmin, rmax;
1260 bool range_found = false;
1261
1262 for (ritr = v54rules.begin(); ritr != v54rules.end(); ++ritr) {
1263 if ((*ritr)->getRange(rmin, rmax)) {
1264 if ((rmin < (uint) owidth) || !range_found) {
1265 owidth = rmin;
1266 olength = rmin;
1267 }
1268 }
1269 }
1270 }
1271
1272 if (hasV55SpacingRules()) {
1273 owidth = layer->_v55sp_width_idx[1];
1274 olength = layer->_v55sp_length_idx[1];
1275 }
1276 }
1277
getV54SpacingRules(dbSet<dbTechLayerSpacingRule> & sp_rules) const1278 bool dbTechLayer::getV54SpacingRules(
1279 dbSet<dbTechLayerSpacingRule>& sp_rules) const
1280 {
1281 _dbTechLayer* layer = (_dbTechLayer*) this;
1282
1283 sp_rules = dbSet<dbTechLayerSpacingRule>(layer, layer->_spacing_rules_tbl);
1284 return true;
1285 }
1286
hasV55SpacingRules() const1287 bool dbTechLayer::hasV55SpacingRules() const
1288 {
1289 _dbTechLayer* layer = (_dbTechLayer*) this;
1290 return ((layer->_v55sp_length_idx.size() > 0)
1291 && (layer->_v55sp_width_idx.size() > 0)
1292 && (layer->_v55sp_spacing.numElems() > 0));
1293 }
1294
getV55SpacingWidthsAndLengths(std::vector<uint> & width_idx,std::vector<uint> & length_idx) const1295 bool dbTechLayer::getV55SpacingWidthsAndLengths(
1296 std::vector<uint>& width_idx,
1297 std::vector<uint>& length_idx) const
1298 {
1299 if (!hasV55SpacingRules())
1300 return false;
1301 _dbTechLayer* layer = (_dbTechLayer*) this;
1302 width_idx = layer->_v55sp_width_idx;
1303 length_idx = layer->_v55sp_length_idx;
1304 return true;
1305 }
1306
printV55SpacingRules(lefout & writer) const1307 void dbTechLayer::printV55SpacingRules(lefout& writer) const
1308 {
1309 _dbTechLayer* layer = (_dbTechLayer*) this;
1310
1311 fprintf(writer.out(), "SPACINGTABLE\n");
1312 fprintf(writer.out(), " PARALLELRUNLENGTH");
1313 dbVector<uint>::const_iterator v55_itr;
1314 uint wddx, lndx;
1315
1316 for (v55_itr = layer->_v55sp_length_idx.begin();
1317 v55_itr != layer->_v55sp_length_idx.end();
1318 v55_itr++)
1319 fprintf(writer.out(), " %.3f", writer.lefdist(*v55_itr));
1320
1321 for (wddx = 0, v55_itr = layer->_v55sp_width_idx.begin();
1322 v55_itr != layer->_v55sp_width_idx.end();
1323 wddx++, v55_itr++) {
1324 fprintf(writer.out(), "\n");
1325 fprintf(writer.out(), " WIDTH %.3f\t", writer.lefdist(*v55_itr));
1326 for (lndx = 0; lndx < layer->_v55sp_spacing.numCols(); lndx++)
1327 fprintf(writer.out(),
1328 " %.3f",
1329 writer.lefdist(layer->_v55sp_spacing(wddx, lndx)));
1330 }
1331
1332 fprintf(writer.out(), " ;\n");
1333 }
1334
getV55SpacingTable(std::vector<std::vector<uint>> & sptbl) const1335 bool dbTechLayer::getV55SpacingTable(
1336 std::vector<std::vector<uint>>& sptbl) const
1337 {
1338 _dbTechLayer* layer = (_dbTechLayer*) this;
1339
1340 if (layer->_v55sp_spacing.numElems() == 0)
1341 return false;
1342
1343 uint i, j;
1344 sptbl.clear();
1345 sptbl.resize(layer->_v55sp_spacing.numRows());
1346 std::vector<uint> tmpvec;
1347 tmpvec.reserve(layer->_v55sp_spacing.numCols());
1348 for (i = 0; i < layer->_v55sp_spacing.numRows(); i++) {
1349 tmpvec.clear();
1350 for (j = 0; j < layer->_v55sp_spacing.numCols(); j++)
1351 tmpvec.push_back(layer->_v55sp_spacing(i, j));
1352 sptbl[i] = tmpvec;
1353 }
1354
1355 return true;
1356 }
1357
findV55Spacing(const int width,const int prl) const1358 int dbTechLayer::findV55Spacing(const int width, const int prl) const
1359 {
1360 if (!hasV55SpacingRules())
1361 return 0;
1362 _dbTechLayer* layer = (_dbTechLayer*) this;
1363 uint rowIdx = layer->getV55RowIdx(width);
1364 uint colIdx = layer->getV55ColIdx(prl);
1365 return layer->_v55sp_spacing(rowIdx, colIdx);
1366 }
1367
initV55LengthIndex(uint numelems)1368 void dbTechLayer::initV55LengthIndex(uint numelems)
1369 {
1370 _dbTechLayer* layer = (_dbTechLayer*) this;
1371 layer->_v55sp_length_idx.reserve(numelems);
1372 }
1373
addV55LengthEntry(uint length)1374 void dbTechLayer::addV55LengthEntry(uint length)
1375 {
1376 _dbTechLayer* layer = (_dbTechLayer*) this;
1377 layer->_v55sp_length_idx.push_back(length);
1378 }
1379
initV55WidthIndex(uint numelems)1380 void dbTechLayer::initV55WidthIndex(uint numelems)
1381 {
1382 _dbTechLayer* layer = (_dbTechLayer*) this;
1383 layer->_v55sp_width_idx.reserve(numelems);
1384 }
1385
addV55WidthEntry(uint width)1386 void dbTechLayer::addV55WidthEntry(uint width)
1387 {
1388 _dbTechLayer* layer = (_dbTechLayer*) this;
1389 layer->_v55sp_width_idx.push_back(width);
1390 }
1391
initV55SpacingTable(uint numrows,uint numcols)1392 void dbTechLayer::initV55SpacingTable(uint numrows, uint numcols)
1393 {
1394 _dbTechLayer* layer = (_dbTechLayer*) this;
1395 layer->_v55sp_spacing.resize(numrows, numcols);
1396 }
1397
addV55SpacingTableEntry(uint inrow,uint incol,uint spacing)1398 void dbTechLayer::addV55SpacingTableEntry(uint inrow, uint incol, uint spacing)
1399 {
1400 _dbTechLayer* layer = (_dbTechLayer*) this;
1401 layer->_v55sp_spacing(inrow, incol) = spacing;
1402 }
1403
getV55InfluenceRules(std::vector<dbTechV55InfluenceEntry * > & inf_tbl)1404 bool dbTechLayer::getV55InfluenceRules(
1405 std::vector<dbTechV55InfluenceEntry*>& inf_tbl)
1406 {
1407 inf_tbl.clear();
1408 dbSet<dbTechV55InfluenceEntry> entries = getV55InfluenceEntries();
1409
1410 if (entries.size() == 0)
1411 return false;
1412
1413 dbSet<dbTechV55InfluenceEntry>::iterator itr;
1414
1415 for (itr = entries.begin(); itr != entries.end(); ++itr)
1416 inf_tbl.push_back(*itr);
1417
1418 return true;
1419 }
1420
hasTwoWidthsSpacingRules() const1421 bool dbTechLayer::hasTwoWidthsSpacingRules() const
1422 {
1423 _dbTechLayer* layer = (_dbTechLayer*) this;
1424 return ((layer->_two_widths_sp_idx.size() > 0)
1425 && (layer->_two_widths_sp_spacing.numElems() > 0));
1426 }
1427
printTwoWidthsSpacingRules(lefout & writer) const1428 void dbTechLayer::printTwoWidthsSpacingRules(lefout& writer) const
1429 {
1430 _dbTechLayer* layer = (_dbTechLayer*) this;
1431
1432 fprintf(writer.out(), "SPACINGTABLE TWOWIDTHS");
1433 dbVector<uint>::const_iterator itr;
1434 uint wddx, lndx;
1435
1436 for (wddx = 0, itr = layer->_two_widths_sp_idx.begin();
1437 itr != layer->_two_widths_sp_idx.end();
1438 wddx++, itr++) {
1439 fprintf(writer.out(), "\n WIDTH %.3f\t", writer.lefdist(*itr));
1440 for (lndx = 0; lndx < layer->_two_widths_sp_spacing.numCols(); lndx++)
1441 fprintf(writer.out(),
1442 " %.3f",
1443 writer.lefdist(layer->_two_widths_sp_spacing(wddx, lndx)));
1444 }
1445
1446 fprintf(writer.out(), " ;\n");
1447 }
1448
getTwoWidthsSpacingTableEntry(uint row,uint col) const1449 uint dbTechLayer::getTwoWidthsSpacingTableEntry(uint row, uint col) const
1450 {
1451 _dbTechLayer* layer = (_dbTechLayer*) this;
1452 return layer->_two_widths_sp_spacing(row, col);
1453 }
1454
getTwoWidthsSpacingTableNumWidths() const1455 uint dbTechLayer::getTwoWidthsSpacingTableNumWidths() const
1456 {
1457 _dbTechLayer* layer = (_dbTechLayer*) this;
1458 return layer->_two_widths_sp_idx.size();
1459 }
1460
getTwoWidthsSpacingTableWidth(uint row) const1461 uint dbTechLayer::getTwoWidthsSpacingTableWidth(uint row) const
1462 {
1463 _dbTechLayer* layer = (_dbTechLayer*) this;
1464 return layer->_two_widths_sp_idx.at(row);
1465 }
1466
getTwoWidthsSpacingTableHasPRL(uint row) const1467 bool dbTechLayer::getTwoWidthsSpacingTableHasPRL(uint row) const
1468 {
1469 _dbTechLayer* layer = (_dbTechLayer*) this;
1470 return layer->_two_widths_sp_prl.at(row) >= 0;
1471 }
1472
getTwoWidthsSpacingTablePRL(uint row) const1473 uint dbTechLayer::getTwoWidthsSpacingTablePRL(uint row) const
1474 {
1475 _dbTechLayer* layer = (_dbTechLayer*) this;
1476 return layer->_two_widths_sp_prl.at(row);
1477 }
1478
getTwoWidthsSpacingTable(std::vector<std::vector<uint>> & sptbl) const1479 bool dbTechLayer::getTwoWidthsSpacingTable(
1480 std::vector<std::vector<uint>>& sptbl) const
1481 {
1482 _dbTechLayer* layer = (_dbTechLayer*) this;
1483
1484 if (layer->_two_widths_sp_spacing.numElems() == 0)
1485 return false;
1486
1487 uint i, j;
1488 sptbl.clear();
1489 sptbl.resize(layer->_two_widths_sp_spacing.numRows());
1490 std::vector<uint> tmpvec;
1491 tmpvec.reserve(layer->_two_widths_sp_spacing.numCols());
1492 for (i = 0; i < layer->_two_widths_sp_spacing.numRows(); i++) {
1493 tmpvec.clear();
1494 for (j = 0; j < layer->_two_widths_sp_spacing.numCols(); j++)
1495 tmpvec.push_back(layer->_two_widths_sp_spacing(i, j));
1496 sptbl[i] = tmpvec;
1497 }
1498
1499 return true;
1500 }
1501
initTwoWidths(uint num_widths)1502 void dbTechLayer::initTwoWidths(uint num_widths)
1503 {
1504 _dbTechLayer* layer = (_dbTechLayer*) this;
1505 layer->_two_widths_sp_idx.reserve(num_widths);
1506 layer->_two_widths_sp_spacing.resize(num_widths, num_widths);
1507 }
1508
addTwoWidthsIndexEntry(uint width,int parallel_run_length)1509 void dbTechLayer::addTwoWidthsIndexEntry(uint width, int parallel_run_length)
1510 {
1511 _dbTechLayer* layer = (_dbTechLayer*) this;
1512 layer->_two_widths_sp_idx.push_back(width);
1513 layer->_two_widths_sp_prl.push_back(parallel_run_length);
1514 }
1515
addTwoWidthsSpacingTableEntry(uint inrow,uint incol,uint spacing)1516 void dbTechLayer::addTwoWidthsSpacingTableEntry(uint inrow,
1517 uint incol,
1518 uint spacing)
1519 {
1520 _dbTechLayer* layer = (_dbTechLayer*) this;
1521 layer->_two_widths_sp_spacing(inrow, incol) = spacing;
1522 }
1523
findTwSpacing(const int width1,const int width2,const int prl) const1524 int dbTechLayer::findTwSpacing(const int width1,
1525 const int width2,
1526 const int prl) const
1527 {
1528 if (!hasTwoWidthsSpacingRules())
1529 return 0;
1530 _dbTechLayer* layer = (_dbTechLayer*) this;
1531 auto rowIdx = layer->getTwIdx(width1, prl);
1532 auto colIdx = layer->getTwIdx(width2, prl);
1533 return layer->_two_widths_sp_spacing(rowIdx, colIdx);
1534 }
1535
getMinimumCutRules(std::vector<dbTechMinCutRule * > & cut_rules)1536 bool dbTechLayer::getMinimumCutRules(std::vector<dbTechMinCutRule*>& cut_rules)
1537 {
1538 cut_rules.clear();
1539 dbSet<dbTechMinCutRule> rules = getMinCutRules();
1540
1541 if (rules.size() == 0)
1542 return false;
1543
1544 dbSet<dbTechMinCutRule>::iterator itr;
1545
1546 for (itr = rules.begin(); itr != rules.end(); ++itr)
1547 cut_rules.push_back((dbTechMinCutRule*) *itr);
1548
1549 return true;
1550 }
1551
getMinCutRules()1552 dbSet<dbTechMinCutRule> dbTechLayer::getMinCutRules()
1553 {
1554 dbSet<dbTechMinCutRule> rules;
1555 _dbTechLayer* layer = (_dbTechLayer*) this;
1556 rules = dbSet<dbTechMinCutRule>(layer, layer->_min_cut_rules_tbl);
1557 return rules;
1558 }
1559
getMinEncRules()1560 dbSet<dbTechMinEncRule> dbTechLayer::getMinEncRules()
1561 {
1562 dbSet<dbTechMinEncRule> rules;
1563 _dbTechLayer* layer = (_dbTechLayer*) this;
1564 rules = dbSet<dbTechMinEncRule>(layer, layer->_min_enc_rules_tbl);
1565 return rules;
1566 }
1567
getV55InfluenceEntries()1568 dbSet<dbTechV55InfluenceEntry> dbTechLayer::getV55InfluenceEntries()
1569 {
1570 dbSet<dbTechV55InfluenceEntry> rules;
1571 _dbTechLayer* layer = (_dbTechLayer*) this;
1572 rules = dbSet<dbTechV55InfluenceEntry>(layer, layer->_v55inf_tbl);
1573 return rules;
1574 }
1575
getMinEnclosureRules(std::vector<dbTechMinEncRule * > & enc_rules)1576 bool dbTechLayer::getMinEnclosureRules(
1577 std::vector<dbTechMinEncRule*>& enc_rules)
1578 {
1579 enc_rules.clear();
1580
1581 dbSet<dbTechMinEncRule> rules = getMinEncRules();
1582
1583 if (rules.size() == 0)
1584 return false;
1585
1586 dbSet<dbTechMinEncRule>::iterator itr;
1587
1588 for (itr = rules.begin(); itr != rules.end(); ++itr)
1589 enc_rules.push_back(*itr);
1590
1591 return true;
1592 }
1593
createDefaultAntennaRule()1594 dbTechLayerAntennaRule* dbTechLayer::createDefaultAntennaRule()
1595 {
1596 _dbTechLayer* layer = (_dbTechLayer*) this;
1597 _dbTechLayerAntennaRule* r
1598 = (_dbTechLayerAntennaRule*) getDefaultAntennaRule();
1599
1600 // Reinitialize the object to its default state...
1601 if (r != NULL) {
1602 r->~_dbTechLayerAntennaRule();
1603 new (r) _dbTechLayerAntennaRule(layer->getDatabase());
1604 r->_layer = getImpl()->getOID();
1605 } else {
1606 _dbTech* tech = (_dbTech*) layer->getOwner();
1607 r = tech->_antenna_rule_tbl->create();
1608 layer->_oxide1 = r->getOID();
1609 r->_layer = getImpl()->getOID();
1610 }
1611
1612 return (dbTechLayerAntennaRule*) r;
1613 }
1614
createOxide2AntennaRule()1615 dbTechLayerAntennaRule* dbTechLayer::createOxide2AntennaRule()
1616 {
1617 _dbTechLayer* layer = (_dbTechLayer*) this;
1618 _dbTechLayerAntennaRule* r
1619 = (_dbTechLayerAntennaRule*) getOxide2AntennaRule();
1620
1621 // Reinitialize the object to its default state...
1622 if (r != NULL) {
1623 r->~_dbTechLayerAntennaRule();
1624 new (r) _dbTechLayerAntennaRule(layer->getDatabase());
1625 r->_layer = getImpl()->getOID();
1626 } else {
1627 _dbTech* tech = (_dbTech*) layer->getOwner();
1628 r = tech->_antenna_rule_tbl->create();
1629 layer->_oxide2 = r->getOID();
1630 r->_layer = getImpl()->getOID();
1631 }
1632
1633 return (dbTechLayerAntennaRule*) r;
1634 }
1635
hasDefaultAntennaRule() const1636 bool dbTechLayer::hasDefaultAntennaRule() const
1637 {
1638 _dbTechLayer* layer = (_dbTechLayer*) this;
1639 return (layer->_oxide1 != 0);
1640 }
1641
hasOxide2AntennaRule() const1642 bool dbTechLayer::hasOxide2AntennaRule() const
1643 {
1644 _dbTechLayer* layer = (_dbTechLayer*) this;
1645 return (layer->_oxide2 != 0);
1646 }
1647
getDefaultAntennaRule() const1648 dbTechLayerAntennaRule* dbTechLayer::getDefaultAntennaRule() const
1649 {
1650 _dbTechLayer* layer = (_dbTechLayer*) this;
1651 _dbTech* tech = (_dbTech*) layer->getOwner();
1652
1653 if (layer->_oxide1 == 0)
1654 return NULL;
1655
1656 return (dbTechLayerAntennaRule*) tech->_antenna_rule_tbl->getPtr(
1657 layer->_oxide1);
1658 }
1659
getOxide2AntennaRule() const1660 dbTechLayerAntennaRule* dbTechLayer::getOxide2AntennaRule() const
1661 {
1662 _dbTechLayer* layer = (_dbTechLayer*) this;
1663 _dbTech* tech = (_dbTech*) layer->getOwner();
1664
1665 if (layer->_oxide2 == 0)
1666 return NULL;
1667
1668 return (dbTechLayerAntennaRule*) tech->_antenna_rule_tbl->getPtr(
1669 layer->_oxide2);
1670 }
1671
writeAntennaRulesLef(lefout & writer) const1672 void dbTechLayer::writeAntennaRulesLef(lefout& writer) const
1673 {
1674 bool prt_model = (hasDefaultAntennaRule() && hasOxide2AntennaRule());
1675
1676 if (prt_model)
1677 fprintf(writer.out(), " ANTENNAMODEL OXIDE1 ;\n");
1678 if (hasDefaultAntennaRule())
1679 getDefaultAntennaRule()->writeLef(writer);
1680
1681 if (prt_model)
1682 fprintf(writer.out(), " ANTENNAMODEL OXIDE2 ;\n");
1683 if (hasOxide2AntennaRule())
1684 getOxide2AntennaRule()->writeLef(writer);
1685 }
1686
getNumMasks() const1687 uint dbTechLayer::getNumMasks() const
1688 {
1689 _dbTechLayer* layer = (_dbTechLayer*) this;
1690 return layer->flags_.num_masks_;
1691 }
1692
setNumMasks(uint number)1693 void dbTechLayer::setNumMasks(uint number)
1694 {
1695 _dbTechLayer* layer = (_dbTechLayer*) this;
1696 if (number < 1 || number > 3) {
1697 getImpl()->getLogger()->error(
1698 utl::ODB, 282, "setNumMask {} not in range [1,3]", number);
1699 }
1700 layer->flags_.num_masks_ = number;
1701 }
1702
getThickness(uint & inthk) const1703 bool dbTechLayer::getThickness(uint& inthk) const
1704 {
1705 _dbTechLayer* layer = (_dbTechLayer*) this;
1706 if (layer->flags_.has_thickness_) {
1707 inthk = layer->_thickness;
1708 return true;
1709 }
1710
1711 return false;
1712 }
1713
setThickness(uint thickness)1714 void dbTechLayer::setThickness(uint thickness)
1715 {
1716 _dbTechLayer* layer = (_dbTechLayer*) this;
1717 layer->flags_.has_thickness_ = 1;
1718 layer->_thickness = thickness;
1719 }
1720
hasArea() const1721 bool dbTechLayer::hasArea() const
1722 {
1723 _dbTechLayer* layer = (_dbTechLayer*) this;
1724 return (layer->flags_.has_area_);
1725 }
1726
1727 double // Now denominated in squm
getArea() const1728 dbTechLayer::getArea() const
1729 {
1730 _dbTechLayer* layer = (_dbTechLayer*) this;
1731 if (layer->flags_.has_area_)
1732 return layer->_area;
1733
1734 return 0.0; // Default
1735 }
1736
setArea(double area)1737 void dbTechLayer::setArea(double area)
1738 {
1739 _dbTechLayer* layer = (_dbTechLayer*) this;
1740 layer->flags_.has_area_ = 1;
1741 layer->_area = area;
1742 }
1743
hasMaxWidth() const1744 bool dbTechLayer::hasMaxWidth() const
1745 {
1746 _dbTechLayer* layer = (_dbTechLayer*) this;
1747 return (layer->flags_.has_max_width_);
1748 }
1749
getMaxWidth() const1750 uint dbTechLayer::getMaxWidth() const
1751 {
1752 _dbTechLayer* layer = (_dbTechLayer*) this;
1753 if (layer->flags_.has_max_width_)
1754 return layer->_max_width;
1755
1756 return MAX_INT; // Default
1757 }
1758
setMaxWidth(uint max_width)1759 void dbTechLayer::setMaxWidth(uint max_width)
1760 {
1761 _dbTechLayer* layer = (_dbTechLayer*) this;
1762 layer->flags_.has_max_width_ = 1;
1763 layer->_max_width = max_width;
1764 }
1765
getMinWidth() const1766 uint dbTechLayer::getMinWidth() const
1767 {
1768 _dbTechLayer* layer = (_dbTechLayer*) this;
1769 return layer->_min_width;
1770 }
1771
setMinWidth(uint min_width)1772 void dbTechLayer::setMinWidth(uint min_width)
1773 {
1774 _dbTechLayer* layer = (_dbTechLayer*) this;
1775 layer->_min_width = min_width;
1776 }
1777
hasMinStep() const1778 bool dbTechLayer::hasMinStep() const
1779 {
1780 _dbTechLayer* layer = (_dbTechLayer*) this;
1781 return (layer->_min_step >= 0);
1782 }
1783
getMinStep() const1784 uint dbTechLayer::getMinStep() const
1785 {
1786 _dbTechLayer* layer = (_dbTechLayer*) this;
1787 if (layer->_min_step >= 0)
1788 return layer->_min_step;
1789
1790 return 0; // Default
1791 }
1792
setMinStep(uint min_step)1793 void dbTechLayer::setMinStep(uint min_step)
1794 {
1795 _dbTechLayer* layer = (_dbTechLayer*) this;
1796 layer->_min_step = min_step;
1797 }
1798
hasProtrusion() const1799 bool dbTechLayer::hasProtrusion() const
1800 {
1801 _dbTechLayer* layer = (_dbTechLayer*) this;
1802 return (layer->flags_.has_protrusion_);
1803 }
1804
getProtrusionWidth() const1805 uint dbTechLayer::getProtrusionWidth() const
1806 {
1807 _dbTechLayer* layer = (_dbTechLayer*) this;
1808 if (layer->flags_.has_protrusion_)
1809 return layer->_pt._width;
1810
1811 return 0; // Default
1812 }
1813
getProtrusionLength() const1814 uint dbTechLayer::getProtrusionLength() const
1815 {
1816 _dbTechLayer* layer = (_dbTechLayer*) this;
1817 if (layer->flags_.has_protrusion_)
1818 return layer->_pt._length;
1819
1820 return 0; // Default
1821 }
1822
getProtrusionFromWidth() const1823 uint dbTechLayer::getProtrusionFromWidth() const
1824 {
1825 _dbTechLayer* layer = (_dbTechLayer*) this;
1826 if (layer->flags_.has_protrusion_)
1827 return layer->_pt._from_width;
1828
1829 return 0; // Default
1830 }
1831
setProtrusion(uint pt_width,uint pt_length,uint pt_from_width)1832 void dbTechLayer::setProtrusion(uint pt_width,
1833 uint pt_length,
1834 uint pt_from_width)
1835 {
1836 _dbTechLayer* layer = (_dbTechLayer*) this;
1837 layer->flags_.has_protrusion_ = 1;
1838 layer->_pt._width = pt_width;
1839 layer->_pt._length = pt_length;
1840 layer->_pt._from_width = pt_from_width;
1841 }
1842
getPitch()1843 int dbTechLayer::getPitch()
1844 {
1845 _dbTechLayer* layer = (_dbTechLayer*) this;
1846 return layer->_pitch_x;
1847 }
1848
getPitchX()1849 int dbTechLayer::getPitchX()
1850 {
1851 _dbTechLayer* layer = (_dbTechLayer*) this;
1852 return layer->_pitch_x;
1853 }
1854
getPitchY()1855 int dbTechLayer::getPitchY()
1856 {
1857 _dbTechLayer* layer = (_dbTechLayer*) this;
1858 return layer->_pitch_y;
1859 }
1860
setPitch(int pitch)1861 void dbTechLayer::setPitch(int pitch)
1862 {
1863 _dbTechLayer* layer = (_dbTechLayer*) this;
1864 layer->_pitch_x = pitch;
1865 layer->_pitch_y = pitch;
1866 layer->flags_.has_xy_pitch_ = false;
1867 }
1868
setPitchXY(int pitch_x,int pitch_y)1869 void dbTechLayer::setPitchXY(int pitch_x, int pitch_y)
1870 {
1871 _dbTechLayer* layer = (_dbTechLayer*) this;
1872 layer->_pitch_x = pitch_x;
1873 layer->_pitch_y = pitch_y;
1874 layer->flags_.has_xy_pitch_ = true;
1875 }
1876
hasXYPitch()1877 bool dbTechLayer::hasXYPitch()
1878 {
1879 _dbTechLayer* layer = (_dbTechLayer*) this;
1880 return layer->flags_.has_xy_pitch_;
1881 }
1882
getOffset()1883 int dbTechLayer::getOffset()
1884 {
1885 _dbTechLayer* layer = (_dbTechLayer*) this;
1886 return layer->_offset_x;
1887 }
1888
getOffsetX()1889 int dbTechLayer::getOffsetX()
1890 {
1891 _dbTechLayer* layer = (_dbTechLayer*) this;
1892 return layer->_offset_x;
1893 }
1894
getOffsetY()1895 int dbTechLayer::getOffsetY()
1896 {
1897 _dbTechLayer* layer = (_dbTechLayer*) this;
1898 return layer->_offset_y;
1899 }
1900
setOffset(int offset)1901 void dbTechLayer::setOffset(int offset)
1902 {
1903 _dbTechLayer* layer = (_dbTechLayer*) this;
1904 layer->_offset_x = offset;
1905 layer->_offset_y = offset;
1906 layer->flags_.has_xy_offset_ = false;
1907 }
1908
setOffsetXY(int offset_x,int offset_y)1909 void dbTechLayer::setOffsetXY(int offset_x, int offset_y)
1910 {
1911 _dbTechLayer* layer = (_dbTechLayer*) this;
1912 layer->_offset_x = offset_x;
1913 layer->_offset_y = offset_y;
1914 layer->flags_.has_xy_offset_ = true;
1915 }
1916
hasXYOffset()1917 bool dbTechLayer::hasXYOffset()
1918 {
1919 _dbTechLayer* layer = (_dbTechLayer*) this;
1920 return layer->flags_.has_xy_offset_;
1921 }
1922
getDirection()1923 dbTechLayerDir dbTechLayer::getDirection()
1924 {
1925 _dbTechLayer* layer = (_dbTechLayer*) this;
1926 return dbTechLayerDir(layer->flags_.direction_);
1927 }
1928
setDirection(dbTechLayerDir direction)1929 void dbTechLayer::setDirection(dbTechLayerDir direction)
1930 {
1931 _dbTechLayer* layer = (_dbTechLayer*) this;
1932 layer->flags_.direction_ = direction.getValue();
1933 }
1934
getMinStepType() const1935 dbTechLayerMinStepType dbTechLayer::getMinStepType() const
1936 {
1937 _dbTechLayer* layer = (_dbTechLayer*) this;
1938 return dbTechLayerMinStepType(layer->flags_.minstep_type_);
1939 }
1940
setMinStepType(dbTechLayerMinStepType type)1941 void dbTechLayer::setMinStepType(dbTechLayerMinStepType type)
1942 {
1943 _dbTechLayer* layer = (_dbTechLayer*) this;
1944 layer->flags_.minstep_type_ = type.getValue();
1945 }
1946
hasMinStepMaxLength() const1947 bool dbTechLayer::hasMinStepMaxLength() const
1948 {
1949 _dbTechLayer* layer = (_dbTechLayer*) this;
1950 return layer->_min_step_max_length >= 0;
1951 }
1952
getMinStepMaxLength() const1953 uint dbTechLayer::getMinStepMaxLength() const
1954 {
1955 _dbTechLayer* layer = (_dbTechLayer*) this;
1956 return layer->_min_step_max_length;
1957 }
1958
setMinStepMaxLength(uint length)1959 void dbTechLayer::setMinStepMaxLength(uint length)
1960 {
1961 _dbTechLayer* layer = (_dbTechLayer*) this;
1962 layer->_min_step_max_length = length;
1963 }
1964
hasMinStepMaxEdges() const1965 bool dbTechLayer::hasMinStepMaxEdges() const
1966 {
1967 _dbTechLayer* layer = (_dbTechLayer*) this;
1968 return layer->_min_step_max_edges >= 0;
1969 }
1970
getMinStepMaxEdges() const1971 uint dbTechLayer::getMinStepMaxEdges() const
1972 {
1973 _dbTechLayer* layer = (_dbTechLayer*) this;
1974 return layer->_min_step_max_edges;
1975 }
1976
setMinStepMaxEdges(uint edges)1977 void dbTechLayer::setMinStepMaxEdges(uint edges)
1978 {
1979 _dbTechLayer* layer = (_dbTechLayer*) this;
1980 layer->_min_step_max_edges = edges;
1981 }
1982
getType()1983 dbTechLayerType dbTechLayer::getType()
1984 {
1985 _dbTechLayer* layer = (_dbTechLayer*) this;
1986 return dbTechLayerType(layer->flags_.type_);
1987 }
1988
getResistance()1989 double dbTechLayer::getResistance()
1990 {
1991 _dbTechLayer* layer = (_dbTechLayer*) this;
1992 return layer->_resistance;
1993 }
1994
setResistance(double resistance)1995 void dbTechLayer::setResistance(double resistance)
1996 {
1997 _dbTechLayer* layer = (_dbTechLayer*) this;
1998 layer->_resistance = resistance;
1999 }
2000
getCapacitance()2001 double dbTechLayer::getCapacitance()
2002 {
2003 _dbTechLayer* layer = (_dbTechLayer*) this;
2004 return layer->_capacitance;
2005 }
2006
setCapacitance(double capacitance)2007 void dbTechLayer::setCapacitance(double capacitance)
2008 {
2009 _dbTechLayer* layer = (_dbTechLayer*) this;
2010 layer->_capacitance = capacitance;
2011 }
2012
getNumber() const2013 int dbTechLayer::getNumber() const
2014 {
2015 _dbTechLayer* layer = (_dbTechLayer*) this;
2016 return layer->_number;
2017 }
2018
getRoutingLevel()2019 int dbTechLayer::getRoutingLevel()
2020 {
2021 _dbTechLayer* layer = (_dbTechLayer*) this;
2022 return layer->_rlevel;
2023 }
2024
getLowerLayer()2025 dbTechLayer* dbTechLayer::getLowerLayer()
2026 {
2027 _dbTechLayer* layer = (_dbTechLayer*) this;
2028 _dbTech* tech = (_dbTech*) layer->getOwner();
2029
2030 if (layer->_lower == 0)
2031 return NULL;
2032
2033 return (dbTechLayer*) tech->_layer_tbl->getPtr(layer->_lower);
2034 }
2035
getUpperLayer()2036 dbTechLayer* dbTechLayer::getUpperLayer()
2037 {
2038 _dbTechLayer* layer = (_dbTechLayer*) this;
2039 _dbTech* tech = (_dbTech*) layer->getOwner();
2040
2041 if (layer->_upper == 0)
2042 return NULL;
2043
2044 return (dbTechLayer*) tech->_layer_tbl->getPtr(layer->_upper);
2045 }
2046
getTech()2047 dbTech* dbTechLayer::getTech()
2048 {
2049 return (dbTech*) getImpl()->getOwner();
2050 }
2051
create(dbTech * tech_,const char * name_,dbTechLayerType type)2052 dbTechLayer* dbTechLayer::create(dbTech* tech_,
2053 const char* name_,
2054 dbTechLayerType type)
2055 {
2056 if (type.getValue() == dbTechLayerType::NONE)
2057 return NULL;
2058
2059 if (tech_->findLayer(name_))
2060 return NULL;
2061
2062 _dbTech* tech = (_dbTech*) tech_;
2063 _dbTechLayer* layer = tech->_layer_tbl->create();
2064 layer->_name = strdup(name_);
2065 ZALLOCATED(layer->_name);
2066 layer->_number = tech->_layer_cnt++;
2067 layer->flags_.type_ = type.getValue();
2068
2069 if (type.getValue() == dbTechLayerType::ROUTING) {
2070 layer->_rlevel = ++tech->_rlayer_cnt;
2071 }
2072
2073 if (tech->_bottom == 0) {
2074 tech->_bottom = layer->getOID();
2075 tech->_top = layer->getOID();
2076 return (dbTechLayer*) layer;
2077 }
2078
2079 _dbTechLayer* top = tech->_layer_tbl->getPtr(tech->_top);
2080 top->_upper = layer->getOID();
2081 layer->_lower = top->getOID();
2082 tech->_top = layer->getOID();
2083
2084 return (dbTechLayer*) layer;
2085 }
2086
getTechLayer(dbTech * tech_,uint dbid_)2087 dbTechLayer* dbTechLayer::getTechLayer(dbTech* tech_, uint dbid_)
2088 {
2089 _dbTech* tech = (_dbTech*) tech_;
2090 return (dbTechLayer*) tech->_layer_tbl->getPtr(dbid_);
2091 }
2092
2093 // User Code End dbTechLayerPublicMethods
2094 } // namespace odb
2095 // Generator Code End Cpp
2096