Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhishengZeng committed Dec 6, 2024
1 parent a43c55b commit 8cd11c5
Show file tree
Hide file tree
Showing 8 changed files with 304 additions and 155 deletions.
105 changes: 75 additions & 30 deletions src/operation/iRT/interface/RTInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void RTInterface::clearDef()
std::vector<idb::IdbPin*> remove_pin_list;
for (idb::IdbPin* io_pin : idb_pin_list->get_pin_list()) {
if (io_pin->get_port_box_list().empty()) {
RTLOG.info(Loc::current(), "del io_pin: ",io_pin->get_pin_name());
RTLOG.info(Loc::current(), "del io_pin: ", io_pin->get_pin_name());
remove_pin_list.push_back(io_pin);
}
}
Expand Down Expand Up @@ -428,49 +428,94 @@ void RTInterface::wrapRoutingDesignRule(RoutingLayer& routing_layer, idb::IdbLay
// eol
{
idb::IdbLayerRouting* idb_routing_layer = dynamic_cast<idb::IdbLayerRouting*>(idb_layer);
int32_t eol_spacing = 0;
int32_t eol_within = 0;
if (!idb_routing_layer->get_lef58_spacing_eol_list().empty()) {
eol_spacing = idb_routing_layer->get_lef58_spacing_eol_list().front().get()->get_eol_space();
eol_within = idb_routing_layer->get_lef58_spacing_eol_list().front().get()->get_eol_within().value();
int32_t eol_spacing = idb_routing_layer->get_lef58_spacing_eol_list().front().get()->get_eol_space();
int32_t eol_within = idb_routing_layer->get_lef58_spacing_eol_list().front().get()->get_eol_within().value();
for (std::shared_ptr<routinglayer::Lef58SpacingEol>& idb_rule_eol : idb_routing_layer->get_lef58_spacing_eol_list()) {
if (idb_rule_eol.get()->get_eol_space() < eol_spacing) {
eol_spacing = idb_rule_eol.get()->get_eol_space();
eol_within = idb_rule_eol.get()->get_eol_within().value();
}
}
}
if (eol_spacing == 0 && eol_within == 0) {
routing_layer.set_eol_spacing(eol_spacing);
routing_layer.set_eol_within(eol_within);
} else {
RTLOG.warn(Loc::current(), "The idb layer ", idb_layer->get_name(), " eol_spacing is empty!");
routing_layer.set_eol_spacing(0);
routing_layer.set_eol_within(0);
}
routing_layer.set_eol_spacing(eol_spacing);
routing_layer.set_eol_within(eol_within);
}
}

void RTInterface::wrapCutDesignRule(CutLayer& cut_layer, idb::IdbLayerCut* idb_layer)
{
if (!idb_layer->get_spacings().empty()) {
cut_layer.set_prl_spacing(0);
cut_layer.set_x_spacing(idb_layer->get_spacings().front()->get_spacing());
cut_layer.set_y_spacing(idb_layer->get_spacings().front()->get_spacing());
} else if (!idb_layer->get_lef58_spacing_table().empty()) {
idb::cutlayer::Lef58SpacingTable* spacing_table = idb_layer->get_lef58_spacing_table().front().get();
int32_t prl_spacing = 0;
if (spacing_table->get_prl().value().get_prl() < 0) {
prl_spacing = -1 * spacing_table->get_prl().value().get_prl();
}
idb::cutlayer::Lef58SpacingTable::CutSpacing cut_spacing = spacing_table->get_cutclass().get_cut_spacing(0, 0);
int32_t x_spacing = cut_spacing.get_cut_spacing1().value();
int32_t y_spacing = cut_spacing.get_cut_spacing2().value();
cut_layer.set_prl_spacing(prl_spacing);
cut_layer.set_x_spacing(x_spacing);
cut_layer.set_y_spacing(y_spacing);
} else {
cut_layer.set_prl_spacing(0);
cut_layer.set_x_spacing(0);
cut_layer.set_y_spacing(0);
RTLOG.warn(Loc::current(), "The idb layer ", idb_layer->get_name(), " spacing table is empty!");
// curr layer
{
if (!idb_layer->get_spacings().empty()) {
cut_layer.set_curr_prl_spacing(0);
cut_layer.set_curr_x_spacing(idb_layer->get_spacings().front()->get_spacing());
cut_layer.set_curr_y_spacing(idb_layer->get_spacings().front()->get_spacing());
} else if (!idb_layer->get_lef58_spacing_table().empty()) {
idb::cutlayer::Lef58SpacingTable* spacing_table = nullptr;
for (std::shared_ptr<idb::cutlayer::Lef58SpacingTable>& spacing_table_ptr : idb_layer->get_lef58_spacing_table()) {
if (spacing_table_ptr.get()->get_second_layer().has_value()) {
continue;
}
spacing_table = spacing_table_ptr.get();
}
if (spacing_table != nullptr) {
idb::cutlayer::Lef58SpacingTable::CutSpacing cut_spacing = spacing_table->get_cutclass().get_cut_spacing(0, 0);

int32_t curr_prl_spacing = -1 * spacing_table->get_prl().value().get_prl();
int32_t curr_x_spacing = cut_spacing.get_cut_spacing1().value();
int32_t curr_y_spacing = cut_spacing.get_cut_spacing2().value();
cut_layer.set_curr_prl_spacing(curr_prl_spacing);
cut_layer.set_curr_x_spacing(curr_x_spacing);
cut_layer.set_curr_y_spacing(curr_y_spacing);
} else {
cut_layer.set_curr_prl_spacing(0);
cut_layer.set_curr_x_spacing(0);
cut_layer.set_curr_y_spacing(0);
RTLOG.warn(Loc::current(), "The idb layer ", idb_layer->get_name(), " curr layer spacing is empty!");
}
} else {
cut_layer.set_curr_prl_spacing(0);
cut_layer.set_curr_x_spacing(0);
cut_layer.set_curr_y_spacing(0);
RTLOG.warn(Loc::current(), "The idb layer ", idb_layer->get_name(), " curr layer spacing is empty!");
}
}
// below layer
{
if (!idb_layer->get_lef58_spacing_table().empty()) {
idb::cutlayer::Lef58SpacingTable* spacing_table = nullptr;
for (std::shared_ptr<idb::cutlayer::Lef58SpacingTable>& spacing_table_ptr : idb_layer->get_lef58_spacing_table()) {
if (!spacing_table_ptr.get()->get_second_layer().has_value()) {
continue;
}
spacing_table = spacing_table_ptr.get();
}
if (spacing_table != nullptr) {
idb::cutlayer::Lef58SpacingTable::CutSpacing cut_spacing = spacing_table->get_cutclass().get_cut_spacing(0, 0);

int32_t below_prl_spacing = -1 * spacing_table->get_prl().value().get_prl();
int32_t below_x_spacing = cut_spacing.get_cut_spacing1().value();
int32_t below_y_spacing = cut_spacing.get_cut_spacing2().value();
cut_layer.set_below_prl_spacing(below_prl_spacing);
cut_layer.set_below_x_spacing(below_x_spacing);
cut_layer.set_below_y_spacing(below_y_spacing);
} else {
cut_layer.set_below_prl_spacing(0);
cut_layer.set_below_x_spacing(0);
cut_layer.set_below_y_spacing(0);
RTLOG.warn(Loc::current(), "The idb layer ", idb_layer->get_name(), " below layer spacing is empty!");
}
} else {
cut_layer.set_below_prl_spacing(0);
cut_layer.set_below_x_spacing(0);
cut_layer.set_below_y_spacing(0);
RTLOG.warn(Loc::current(), "The idb layer ", idb_layer->get_name(), " below layer spacing is empty!");
}
}
}

Expand Down
75 changes: 53 additions & 22 deletions src/operation/iRT/source/data_manager/DataManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,12 @@ void DataManager::transLayerList()
}

void DataManager::makeLayerList()
{
makeRoutingLayerList();
makeCutLayerList();
}

void DataManager::makeRoutingLayerList()
{
Die& die = _database.get_die();
std::vector<RoutingLayer>& routing_layer_list = _database.get_routing_layer_list();
Expand Down Expand Up @@ -706,6 +712,22 @@ void DataManager::makeLayerList()
}
}

void DataManager::makeCutLayerList()
{
std::vector<CutLayer>& cut_layer_list = _database.get_cut_layer_list();

for (size_t i = 1; i < cut_layer_list.size(); i++) {
CutLayer& pre_cut_layer = cut_layer_list[i - 1];
CutLayer& curr_cut_layer = cut_layer_list[i];
pre_cut_layer.set_above_prl_spacing(curr_cut_layer.get_below_prl_spacing());
pre_cut_layer.set_above_x_spacing(curr_cut_layer.get_below_x_spacing());
pre_cut_layer.set_above_y_spacing(curr_cut_layer.get_below_y_spacing());
}
cut_layer_list.back().set_above_prl_spacing(0);
cut_layer_list.back().set_above_x_spacing(0);
cut_layer_list.back().set_above_y_spacing(0);
}

void DataManager::checkLayerList()
{
std::vector<RoutingLayer>& routing_layer_list = _database.get_routing_layer_list();
Expand Down Expand Up @@ -736,37 +758,46 @@ void DataManager::checkLayerList()
}
SpacingTable& prl_spacing_table = routing_layer.get_prl_spacing_table();
if (prl_spacing_table.get_width_list().empty()) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' spacing width list is empty!");
RTLOG.error(Loc::current(), "The layer '", layer_name, "' spacing width_list is empty!");
}
for (int32_t width : prl_spacing_table.get_width_list()) {
if (width < 0) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' width < 0!");
}
if (prl_spacing_table.get_parallel_length_list().empty()) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' spacing parallel_length_list is empty!");
}
for (int32_t parallel_length : prl_spacing_table.get_parallel_length_list()) {
if (parallel_length < 0) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' parallel_length < 0!");
}
if (routing_layer.get_eol_spacing() == -1) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' eol_spacing == -1!");
}
GridMap<int32_t>& width_parallel_length_map = prl_spacing_table.get_width_parallel_length_map();
for (int32_t width_idx = 0; width_idx < width_parallel_length_map.get_x_size(); width_idx++) {
for (int32_t parallel_length_idx = 0; parallel_length_idx < width_parallel_length_map.get_y_size(); parallel_length_idx++) {
if (width_parallel_length_map[width_idx][parallel_length_idx] < 0) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' spacing < 0!");
}
}
if (routing_layer.get_eol_within() == -1) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' eol_within == -1!");
}
}
for (CutLayer& cut_layer : cut_layer_list) {
std::string& layer_name = cut_layer.get_layer_name();
if (cut_layer.get_prl_spacing() < 0) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' prl_spacing < 0!");
if (cut_layer.get_curr_prl_spacing() == -1) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' curr_prl_spacing == -1!");
}
if (cut_layer.get_curr_x_spacing() == -1) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' curr_x_spacing == -1!");
}
if (cut_layer.get_curr_y_spacing() == -1) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' curr_y_spacing == -1!");
}
if (cut_layer.get_above_prl_spacing() == -1) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' above_prl_spacing == -1!");
}
if (cut_layer.get_above_x_spacing() == -1) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' above_x_spacing == -1!");
}
if (cut_layer.get_above_y_spacing() == -1) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' above_y_spacing == -1!");
}
if (cut_layer.get_below_prl_spacing() == -1) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' below_prl_spacing == -1!");
}
if (cut_layer.get_x_spacing() < 0) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' x_spacing < 0!");
if (cut_layer.get_below_x_spacing() == -1) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' below_x_spacing == -1!");
}
if (cut_layer.get_y_spacing() < 0) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' y_spacing < 0!");
if (cut_layer.get_below_y_spacing() == -1) {
RTLOG.error(Loc::current(), "The layer '", layer_name, "' below_y_spacing == -1!");
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/operation/iRT/source/data_manager/DataManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ class DataManager
void buildLayerList();
void transLayerList();
void makeLayerList();
void makeRoutingLayerList();
void makeCutLayerList();
void checkLayerList();
void buildLayerInfo();
void buildLayerViaMasterList();
Expand Down
39 changes: 30 additions & 9 deletions src/operation/iRT/source/data_manager/advance/CutLayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,45 @@ class CutLayer
int32_t get_layer_idx() const { return _layer_idx; }
int32_t get_layer_order() const { return _layer_order; }
std::string& get_layer_name() { return _layer_name; }
int32_t get_prl_spacing() const { return _prl_spacing; }
int32_t get_x_spacing() const { return _x_spacing; }
int32_t get_y_spacing() const { return _y_spacing; }
int32_t get_curr_prl_spacing() const { return _curr_prl_spacing; }
int32_t get_curr_x_spacing() const { return _curr_x_spacing; }
int32_t get_curr_y_spacing() const { return _curr_y_spacing; }
int32_t get_above_prl_spacing() const { return _above_prl_spacing; }
int32_t get_above_x_spacing() const { return _above_x_spacing; }
int32_t get_above_y_spacing() const { return _above_y_spacing; }
int32_t get_below_prl_spacing() const { return _below_prl_spacing; }
int32_t get_below_x_spacing() const { return _below_x_spacing; }
int32_t get_below_y_spacing() const { return _below_y_spacing; }
// setter
void set_layer_idx(const int32_t layer_idx) { _layer_idx = layer_idx; }
void set_layer_order(const int32_t layer_order) { _layer_order = layer_order; }
void set_layer_name(const std::string& layer_name) { _layer_name = layer_name; }
void set_prl_spacing(const int32_t prl_spacing) { _prl_spacing = prl_spacing; }
void set_x_spacing(const int32_t x_spacing) { _x_spacing = x_spacing; }
void set_y_spacing(const int32_t y_spacing) { _y_spacing = y_spacing; }
void set_curr_prl_spacing(const int32_t curr_prl_spacing) { _curr_prl_spacing = curr_prl_spacing; }
void set_curr_x_spacing(const int32_t curr_x_spacing) { _curr_x_spacing = curr_x_spacing; }
void set_curr_y_spacing(const int32_t curr_y_spacing) { _curr_y_spacing = curr_y_spacing; }
void set_above_prl_spacing(const int32_t above_prl_spacing) { _above_prl_spacing = above_prl_spacing; }
void set_above_x_spacing(const int32_t above_x_spacing) { _above_x_spacing = above_x_spacing; }
void set_above_y_spacing(const int32_t above_y_spacing) { _above_y_spacing = above_y_spacing; }
void set_below_prl_spacing(const int32_t below_prl_spacing) { _below_prl_spacing = below_prl_spacing; }
void set_below_x_spacing(const int32_t below_x_spacing) { _below_x_spacing = below_x_spacing; }
void set_below_y_spacing(const int32_t below_y_spacing) { _below_y_spacing = below_y_spacing; }
// function
private:
int32_t _layer_idx = -1;
int32_t _layer_order = -1;
std::string _layer_name;
int32_t _prl_spacing = -1;
int32_t _x_spacing = -1;
int32_t _y_spacing = -1;
// curr
int32_t _curr_prl_spacing = -1;
int32_t _curr_x_spacing = -1;
int32_t _curr_y_spacing = -1;
// above
int32_t _above_prl_spacing = -1;
int32_t _above_x_spacing = -1;
int32_t _above_y_spacing = -1;
// below
int32_t _below_prl_spacing = -1;
int32_t _below_x_spacing = -1;
int32_t _below_y_spacing = -1;
};

} // namespace irt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class RoutingLayer
int32_t _min_area = 0;
Direction _prefer_direction = Direction::kNone;
ScaleAxis _track_axis;
// prl
SpacingTable _prl_spacing_table;
// eol
int32_t _eol_spacing = -1;
int32_t _eol_within = -1;
};
Expand Down
Loading

0 comments on commit 8cd11c5

Please sign in to comment.