Skip to content

Commit 982dc13

Browse files
committed
rcx: make setBlockFromChip actually have a chip argument
Signed-off-by: Arthur Koucher <arthurkoucher@precisioninno.com>
1 parent d046747 commit 982dc13

3 files changed

Lines changed: 17 additions & 32 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);
@@ -250,13 +250,13 @@ void Ext::write_spef_nets(odb::dbObject* block,
250250
bool parallel,
251251
int corner)
252252
{
253-
_ext->setBlockFromChip();
253+
_ext->setBlockFromChip(_db->getChip());
254254
_ext->write_spef_nets(flatten, parallel);
255255
}
256256

257257
void Ext::write_spef(const SpefOptions& options)
258258
{
259-
_ext->setBlockFromChip();
259+
_ext->setBlockFromChip(_db->getChip());
260260
if (options.end) {
261261
_ext->writeSPEF(true);
262262
return;
@@ -299,7 +299,7 @@ void Ext::write_spef(const SpefOptions& options)
299299

300300
void Ext::read_spef(ReadSpefOpts& opt)
301301
{
302-
_ext->setBlockFromChip();
302+
_ext->setBlockFromChip(_db->getChip());
303303
logger_->info(RCX, 1, "Reading SPEF file: {}", opt.file);
304304

305305
bool stampWire = opt.stamp_wire;
@@ -352,7 +352,7 @@ void Ext::read_spef(ReadSpefOpts& opt)
352352

353353
void Ext::diff_spef(const DiffOptions& opt)
354354
{
355-
_ext->setBlockFromChip();
355+
_ext->setBlockFromChip(_db->getChip());
356356
std::string filename(opt.file);
357357
if (filename.empty()) {
358358
logger_->error(
@@ -430,7 +430,7 @@ bool Ext::gen_rcx_model(const std::string& spef_file_list,
430430
const std::string& version,
431431
int pattern)
432432
{
433-
_ext->setBlockFromChip();
433+
_ext->setBlockFromChip(_db->getChip());
434434

435435
if (spef_file_list.empty()) {
436436
logger_->error(
@@ -474,7 +474,7 @@ bool Ext::define_rcx_corners(const std::string& corner_list)
474474
RCX, 146, "\nCorner List option -corner_list is required\n");
475475
}
476476

477-
_ext->setBlockFromChip();
477+
_ext->setBlockFromChip(_db->getChip());
478478

479479
Parser parser(logger_);
480480
int n1 = parser.mkWords(corner_list.c_str());

src/rcx/src/extmain.cpp

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -392,37 +392,23 @@ double extMain::getResistance(const uint32_t level,
392392
return getLefResistance(level, width, len, model);
393393
}
394394

395-
void extMain::setBlockFromChip()
395+
void extMain::setBlockFromChip(odb::dbChip* chip)
396396
{
397-
if (_db->getChip() == nullptr) {
397+
if (!chip) {
398398
logger_->error(RCX, 497, "No design is loaded.");
399399
}
400-
_tech = _db->getTech();
401-
_block = _db->getChip()->getBlock();
400+
401+
_tech = chip->getTech();
402+
_block = chip->getBlock();
402403
_blockId = _block->getId();
403404
_prevControl = _block->getExtControl();
404405
_block->setExtmi(this);
405406

406-
if (_spef != nullptr) {
407-
_spef = nullptr;
408-
_extracted = false;
409-
}
410-
411-
_bufSpefCnt = 0;
412-
_origSpefFilePrefix = nullptr;
413-
_newSpefFilePrefix = nullptr;
414-
}
415-
416-
void extMain::setBlock(dbBlock* block)
417-
{
418-
_block = block;
419-
_prevControl = _block->getExtControl();
420-
_block->setExtmi(this);
421-
_blockId = _block->getId();
422407
if (_spef) {
423408
_spef = nullptr;
424409
_extracted = false;
425410
}
411+
426412
_bufSpefCnt = 0;
427413
_origSpefFilePrefix = nullptr;
428414
_newSpefFilePrefix = nullptr;

0 commit comments

Comments
 (0)