Skip to content

Commit 2a9bae2

Browse files
committed
odb, rcx: add set_extraction_rules_file and deprecate -ext_model_file option
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
1 parent 9348ba4 commit 2a9bae2

40 files changed

Lines changed: 157 additions & 34 deletions

src/odb/README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,25 @@ add_3dblox_alignment_marker_rule
490490
| `-tolerance` | Maximum allowed center-to-center misalignment in microns. Must be positive. Defaults to 0 (exact alignment required). |
491491
| `-relative_orientations` | Optional Tcl list of allowed orientations of master_b relative to master_a (e.g. `{R0 MY}`). When omitted, orientations are not constrained. |
492492

493+
### Set Extraction Rules File
494+
495+
Sets the path to the parasitics extraction rules file. For a design in which
496+
multiple technologies are used, the user must specify the technology for which
497+
they want to set the rules path.
498+
499+
```tcl
500+
set_extraction_rules_file
501+
[-tech tech_name]
502+
rules_file
503+
```
504+
505+
#### Options
506+
507+
| Switch Name | Description |
508+
| ----- | ----- |
509+
| `-tech` | Technology for which to set the extraction rules path. |
510+
| `rules_file` | Path to the extraction rules file. |
511+
493512
## Regression tests
494513

495514
There are a set of regression tests in `./test`. For more information, refer to this [section](../../README.md#regression-tests).

src/odb/include/odb/db.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5889,6 +5889,10 @@ class dbTech : public dbObject
58895889
///
58905890
std::string getName();
58915891

5892+
void setExtractionRulesFile(const std::string& path);
5893+
5894+
std::string getExtractionRulesFile();
5895+
58925896
///
58935897
/// Get the Database units per micron.
58945898
///
@@ -7588,6 +7592,8 @@ class dbDatabase : public dbObject
75887592

75897593
dbChip* findChip(const char* name) const;
75907594

7595+
bool hasHierarchicalChip() const;
7596+
75917597
dbSet<dbProperty> getProperties() const;
75927598

75937599
dbSet<dbChipInst> getChipInsts() const;

src/odb/src/db/dbDatabase.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,17 @@ dbChip* dbDatabase::findChip(const char* name) const
704704
return (dbChip*) obj->chip_hash_.find(name);
705705
}
706706

707+
bool dbDatabase::hasHierarchicalChip() const
708+
{
709+
for (dbChip* chip : getChips()) {
710+
if (chip->getChipType() == dbChip::ChipType::HIER) {
711+
return true;
712+
}
713+
}
714+
715+
return false;
716+
}
717+
707718
dbSet<dbProperty> dbDatabase::getProperties() const
708719
{
709720
_dbDatabase* obj = (_dbDatabase*) this;

src/odb/src/db/dbDatabase.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ namespace odb {
5050
inline constexpr uint32_t kSchemaMajor = 0; // Not used...
5151
inline constexpr uint32_t kSchemaInitial = 57;
5252

53-
inline constexpr uint32_t kSchemaMinor = 134; // Current revision number
53+
inline constexpr uint32_t kSchemaMinor = 135; // Current revision number
54+
55+
// Revision where dbTech::extraction_rules_file_ was added
56+
inline constexpr uint32_t kSchemaTechExtractionRulesFile = 135;
5457

5558
// Revision where the per-corner child-block feature for parasitics was removed
5659
inline constexpr uint32_t kSchemaRemovePerCornerBlock = 134;

src/odb/src/db/dbTech.cpp

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,10 @@ bool _dbTech::operator==(const _dbTech& rhs) const
8686
return false;
8787
}
8888

89+
if (extraction_rules_file_ != rhs.extraction_rules_file_) {
90+
return false;
91+
}
92+
8993
if (via_cnt_ != rhs.via_cnt_) {
9094
return false;
9195
}
@@ -330,6 +334,7 @@ dbOStream& operator<<(dbOStream& stream, const _dbTech& tech)
330334
stream << NamedTable("cell_edge_spacing_tbl_", tech.cell_edge_spacing_tbl_);
331335
stream << *tech.name_cache_;
332336
stream << tech.via_hash_;
337+
stream << tech.extraction_rules_file_;
333338
return stream;
334339
}
335340

@@ -381,6 +386,9 @@ dbIStream& operator>>(dbIStream& stream, _dbTech& tech)
381386
}
382387
stream >> *tech.name_cache_;
383388
stream >> tech.via_hash_;
389+
if (db->isSchema(kSchemaTechExtractionRulesFile)) {
390+
stream >> tech.extraction_rules_file_;
391+
}
384392

385393
return stream;
386394
}
@@ -391,6 +399,18 @@ std::string dbTech::getName()
391399
return tech->name_;
392400
}
393401

402+
void dbTech::setExtractionRulesFile(const std::string& path)
403+
{
404+
_dbTech* tech = (_dbTech*) this;
405+
tech->extraction_rules_file_ = path;
406+
}
407+
408+
std::string dbTech::getExtractionRulesFile()
409+
{
410+
_dbTech* tech = (_dbTech*) this;
411+
return tech->extraction_rules_file_;
412+
}
413+
394414
double _dbTech::getLefVersion() const
395415
{
396416
return version_;

src/odb/src/db/dbTech.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class _dbTech : public _dbObject
7373
public:
7474
// PERSISTANT-MEMBERS
7575
std::string name_;
76+
std::string extraction_rules_file_;
7677
int via_cnt_;
7778
int layer_cnt_;
7879
int rlayer_cnt_;

src/odb/src/swig/tcl/odb.tcl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,6 +1210,32 @@ proc add_3dblox_alignment_marker_rule { args } {
12101210
}
12111211
}
12121212

1213+
sta::define_cmd_args "set_extraction_rules_file" {
1214+
[-tech tech_name] rules_file
1215+
}
1216+
1217+
proc set_extraction_rules_file { args } {
1218+
sta::parse_key_args "set_extraction_rules_file" args \
1219+
keys {-tech} flags {}
1220+
sta::check_argc_eq1 "set_extraction_rules_file" $args
1221+
1222+
set db [ord::get_db]
1223+
if { [info exists keys(-tech)] } {
1224+
set tech [$db findTech $keys(-tech)]
1225+
} elseif { [$db hasHierarchicalChip] } {
1226+
utl::error ODB 478 "Could not set extraction rules file.\
1227+
Use -tech to specify a technology in a 3D design."
1228+
} else {
1229+
set tech [$db getTech]
1230+
}
1231+
1232+
if { $tech == "NULL" } {
1233+
utl::error ODB 477 "Could not set extraction rules file. Tech not found."
1234+
}
1235+
1236+
$tech setExtractionRulesFile $args
1237+
}
1238+
12131239
namespace eval odb {
12141240
proc resolve_master { cell { lib_name "" } } {
12151241
set db [ord::get_db]

src/rcx/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ returned.
5050

5151
```tcl
5252
extract_parasitics
53-
[-ext_model_file filename]
53+
[-ext_model_file filename]
5454
[-corner cornerIndex]
5555
[-corner_cnt count]
5656
[-max_res ohms]
@@ -70,7 +70,7 @@ extract_parasitics
7070

7171
| Switch Name | Description |
7272
| ----- | ----- |
73-
| `-ext_model_file` | Specify the Extraction Rules file used for the extraction. |
73+
| `-ext_model_file` | Deprecated. Use the `set_extraction_rules_file` command instead. |
7474
| `-corner cornerIndex` | Corner to extract. Default -1. |
7575
| `-corner_cnt` | Defines the number of corners used during the parasitic extraction. |
7676
| `-max_res` | Combines resistors in series up to the threshold value. |

src/rcx/src/OpenRCX.tcl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ proc extract_parasitics { args } {
8383

8484
set ext_model_file ""
8585
if { [info exists keys(-ext_model_file)] } {
86-
set ext_model_file $keys(-ext_model_file)
86+
utl::warn RCX 514 "-ext_model_file is deprecated, use\
87+
set_extraction_rules_file instead."
88+
set_extraction_rules_file $keys(-ext_model_file)
8789
}
8890

8991
set corner_cnt 1

src/rcx/src/ext.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@ void Ext::extract(ExtractOptions options)
216216

217217
odb::orderWires(logger_, block);
218218

219+
std::string rules_file = block->getTech()->getExtractionRulesFile();
220+
if (!rules_file.empty()) {
221+
options.ext_model_file = rules_file.c_str();
222+
}
223+
219224
_ext->set_debug_nets(options.debug_net);
220225

221226
_ext->_lef_res = options.lef_res;

0 commit comments

Comments
 (0)