Skip to content

Commit 32ae71b

Browse files
authored
Merge pull request #10915 from AcKoucher/rcx-set-block-from-chip-arg
rcx: make setBlockFromChip actually have a chip argument
2 parents 52ce7d8 + 989b78c commit 32ae71b

3 files changed

Lines changed: 21 additions & 31 deletions

File tree

src/rcx/include/rcx/extRCap.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2094,8 +2094,7 @@ class extMain
20942094
uint32_t getMultiples(uint32_t cnt, uint32_t base);
20952095
uint32_t getExtLayerCnt(odb::dbTech* tech);
20962096

2097-
void setBlockFromChip();
2098-
void setBlock(odb::dbBlock* block);
2097+
void setBlockFromChip(odb::dbChip* chip);
20992098
odb::dbBlock* getBlock() { return _block; }
21002099
odb::dbTech* getTech() { return _tech; }
21012100
extRCModel* getRCModel() { return _modelTable->get(0); }

src/rcx/src/ext.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ void Ext::setLogger(Logger* logger)
4343
}
4444
void Ext::write_rules(const std::string& name, const std::string& file)
4545
{
46-
_ext->setBlockFromChip();
46+
_ext->setBlockFromChip(_db->getChip());
4747
_ext->writeRules(name.c_str(), file.c_str());
4848
}
4949
void Ext::bench_wires(const BenchWiresOptions& bwo)
@@ -148,7 +148,7 @@ void Ext::bench_wires_gen(const PatternOptions& opt)
148148

149149
void Ext::bench_verilog(const std::string& file)
150150
{
151-
_ext->setBlockFromChip();
151+
_ext->setBlockFromChip(_db->getChip());
152152
char* filename = (char*) file.c_str();
153153
if (!filename || !filename[0]) {
154154
logger_->error(RCX, 147, "bench_verilog: file is not defined!");
@@ -162,7 +162,7 @@ void Ext::bench_verilog(const std::string& file)
162162

163163
void Ext::define_process_corner(int ext_model_index, const std::string& name)
164164
{
165-
_ext->setBlockFromChip();
165+
_ext->setBlockFromChip(_db->getChip());
166166
char* cornerName = _ext->addRCCorner(name.c_str(), ext_model_index);
167167

168168
if (cornerName != nullptr) {
@@ -211,7 +211,7 @@ void Ext::get_ext_db_corner(int& index, const std::string& name)
211211

212212
void Ext::extract(ExtractOptions options)
213213
{
214-
_ext->setBlockFromChip();
214+
_ext->setBlockFromChip(_db->getChip());
215215
odb::dbBlock* block = _ext->getBlock();
216216

217217
odb::orderWires(logger_, block);
@@ -260,13 +260,13 @@ void Ext::write_spef_nets(odb::dbObject* block,
260260
bool parallel,
261261
int corner)
262262
{
263-
_ext->setBlockFromChip();
263+
_ext->setBlockFromChip(_db->getChip());
264264
_ext->write_spef_nets(flatten, parallel);
265265
}
266266

267267
void Ext::write_spef(const SpefOptions& options)
268268
{
269-
_ext->setBlockFromChip();
269+
_ext->setBlockFromChip(_db->getChip());
270270
if (options.end) {
271271
_ext->writeSPEF(true);
272272
return;
@@ -309,7 +309,7 @@ void Ext::write_spef(const SpefOptions& options)
309309

310310
void Ext::read_spef(ReadSpefOpts& opt)
311311
{
312-
_ext->setBlockFromChip();
312+
_ext->setBlockFromChip(_db->getChip());
313313
logger_->info(RCX, 1, "Reading SPEF file: {}", opt.file);
314314

315315
bool stampWire = opt.stamp_wire;
@@ -362,7 +362,7 @@ void Ext::read_spef(ReadSpefOpts& opt)
362362

363363
void Ext::diff_spef(const DiffOptions& opt)
364364
{
365-
_ext->setBlockFromChip();
365+
_ext->setBlockFromChip(_db->getChip());
366366
std::string filename(opt.file);
367367
if (filename.empty()) {
368368
logger_->error(
@@ -440,7 +440,7 @@ bool Ext::gen_rcx_model(const std::string& spef_file_list,
440440
const std::string& version,
441441
int pattern)
442442
{
443-
_ext->setBlockFromChip();
443+
_ext->setBlockFromChip(_db->getChip());
444444

445445
if (spef_file_list.empty()) {
446446
logger_->error(
@@ -484,7 +484,7 @@ bool Ext::define_rcx_corners(const std::string& corner_list)
484484
RCX, 146, "\nCorner List option -corner_list is required\n");
485485
}
486486

487-
_ext->setBlockFromChip();
487+
_ext->setBlockFromChip(_db->getChip());
488488

489489
Parser parser(logger_);
490490
int n1 = parser.mkWords(corner_list.c_str());

src/rcx/src/extmain.cpp

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -391,37 +391,28 @@ double extMain::getResistance(const uint32_t level,
391391
return getLefResistance(level, width, len, model);
392392
}
393393

394-
void extMain::setBlockFromChip()
394+
void extMain::setBlockFromChip(odb::dbChip* chip)
395395
{
396-
if (_db->getChip() == nullptr) {
396+
if (!chip) {
397397
logger_->error(RCX, 497, "No design is loaded.");
398398
}
399-
_tech = _db->getTech();
400-
_block = _db->getChip()->getBlock();
401-
_blockId = _block->getId();
402-
_prevControl = _block->getExtControl();
403-
_block->setExtmi(this);
404399

405-
if (_spef != nullptr) {
406-
_spef = nullptr;
407-
_extracted = false;
408-
}
400+
_tech = chip->getTech();
401+
_block = chip->getBlock();
409402

410-
_bufSpefCnt = 0;
411-
_origSpefFilePrefix = nullptr;
412-
_newSpefFilePrefix = nullptr;
413-
}
403+
if (!_block) {
404+
logger_->error(RCX, 14, "Could not get the block from the chip.");
405+
}
414406

415-
void extMain::setBlock(dbBlock* block)
416-
{
417-
_block = block;
407+
_blockId = _block->getId();
418408
_prevControl = _block->getExtControl();
419409
_block->setExtmi(this);
420-
_blockId = _block->getId();
410+
421411
if (_spef) {
422412
_spef = nullptr;
423413
_extracted = false;
424414
}
415+
425416
_bufSpefCnt = 0;
426417
_origSpefFilePrefix = nullptr;
427418
_newSpefFilePrefix = nullptr;

0 commit comments

Comments
 (0)