3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-07-20 14:15:49 +00:00

stat bugfix

This commit is contained in:
Akash Levy 2026-06-28 20:28:23 -07:00
parent d0380bf8f0
commit 77cd9e1edc
2 changed files with 52 additions and 4 deletions

View file

@ -772,13 +772,17 @@ statdata_t hierarchy_builder(const RTLIL::Design *design, const RTLIL::Module *t
mod_data.local_area_cells_by_type.erase(cell->type);
} else {
// deal with blackbox cells
// The read_liberty/read_liberty2json frontends store the cell
// area as a string attribute, so parse it as a floating point
// value rather than reinterpreting the raw attribute bits.
if (design->module(cell->type)->attributes.count(ID::area) &&
design->module(cell->type)->attributes.at(ID::area).size() == 0) {
design->module(cell->type)->attributes.at(ID::area).size() != 0) {
double blackbox_area =
atof(design->module(cell->type)->attributes.at(ID::area).decode_string().c_str());
mod_data.num_submodules_by_type[cell->type]++;
mod_data.num_submodules++;
mod_data.submodules_area_by_type[cell->type] +=
double(design->module(cell->type)->attributes.at(ID::area).as_int());
mod_data.area += double(design->module(cell->type)->attributes.at(ID::area).as_int());
mod_data.submodules_area_by_type[cell->type] += blackbox_area;
mod_data.area += blackbox_area;
mod_data.unknown_cell_area.erase(cell->type);
mod_data.num_cells -=
(mod_data.num_cells_by_type.count(cell->type) != 0) ? mod_data.num_cells_by_type.at(cell->type) : 0;