15 Commits

Author SHA1 Message Date
  Emin 86a0006451
!86 fix bugs for auto place io pins in prefer direction 1 month ago
  Yell-walkalone 436c17f7ac fix bugs for auto place io pins in prefer direction 1 month ago
  ZhishengZeng a57767d299
!105 Merge branch 'master' of gitee.com:ieda-ipd/iEDA into nn_master 1 month ago
  ZhishengZeng 879146207f Merge branch 'master' of gitee.com:ieda-ipd/iEDA into nn_master 1 month ago
  ZhishengZeng a3b1142729 update 1 month ago
  0xharry ed27abc037 fix: layout json format error for single metal net 1 month ago
  ZhishengZeng 58b343d8d9
!104 Merge branch 'master' of gitee.com:ieda-ipd/iEDA into nn_master 1 month ago
  ZhishengZeng d927e38a50 Merge branch 'master' of gitee.com:ieda-ipd/iEDA into nn_master 1 month ago
  ZhishengZeng fa3a36d0d5 add ert 1 month ago
  ZhishengZeng 75c997811c
!103 fix egr bug 1 month ago
  ZhishengZeng 7e5d9b9fb4
!102 update dr size 1 month ago
  ZhishengZeng fe074463ff fix egr bug 1 month ago
  ZhishengZeng 9e5e9caef8 update dr size 1 month ago
  ZhishengZeng 5659b2ed1b yaoyao make_heap 1 month ago
  ZhishengZeng 401667dfe9 yaoyao fix buildNodeNeighbor bug 1 month ago
28 changed files with 420 additions and 303 deletions
Split View
  1. +5
    -5
      src/database/manager/parser/json/GJWriter.cpp
  2. +2
    -1
      src/evaluation/src/util/init_egr.cpp
  3. +39
    -44
      src/evaluation/src/util/init_sta.cc
  4. +11
    -4
      src/interface/python/py_irt/py_irt.cpp
  5. +1
    -1
      src/interface/python/py_irt/py_irt.h
  6. +1
    -1
      src/interface/python/py_irt/py_register_irt.h
  7. +1
    -1
      src/interface/tcl/tcl_irt/CMakeLists.txt
  8. +1
    -1
      src/interface/tcl/tcl_irt/include/tcl_register_irt.h
  9. +3
    -3
      src/interface/tcl/tcl_irt/include/tcl_rt.h
  10. +7
    -3
      src/interface/tcl/tcl_irt/src/tcl_run_ert.cpp
  11. +18
    -14
      src/operation/iFP/source/module/io_placer/io_placer.cpp
  12. +2
    -3
      src/operation/iRT/interface/RTInterface.cpp
  13. +1
    -1
      src/operation/iRT/interface/RTInterface.hpp
  14. +95
    -0
      src/operation/iRT/source/data_manager/basic/OpenQueue.hpp
  15. +90
    -0
      src/operation/iRT/source/data_manager/basic/OpenQueueNode.hpp
  16. +0
    -36
      src/operation/iRT/source/data_manager/basic/PriorityQueue.hpp
  17. +24
    -44
      src/operation/iRT/source/module/detailed_router/DetailedRouter.cpp
  18. +4
    -4
      src/operation/iRT/source/module/detailed_router/dr_data_manager/DRBox.hpp
  19. +65
    -56
      src/operation/iRT/source/module/early_router/EarlyRouter.cpp
  20. +2
    -2
      src/operation/iRT/source/module/early_router/EarlyRouter.hpp
  21. +6
    -2
      src/operation/iRT/source/module/early_router/er_data_manager/ERComParam.hpp
  22. +0
    -1
      src/operation/iRT/source/module/layer_assigner/la_data_manager/LAModel.hpp
  23. +18
    -38
      src/operation/iRT/source/module/pin_accessor/PinAccessor.cpp
  24. +4
    -4
      src/operation/iRT/source/module/pin_accessor/pa_data_manager/PABox.hpp
  25. +6
    -13
      src/operation/iRT/source/module/space_router/SpaceRouter.cpp
  26. +4
    -4
      src/operation/iRT/source/module/space_router/sr_data_manager/SRBox.hpp
  27. +6
    -13
      src/operation/iRT/source/module/track_assigner/TrackAssigner.cpp
  28. +4
    -4
      src/operation/iRT/source/module/track_assigner/ta_data_manager/TAPanel.hpp

+ 5
- 5
src/database/manager/parser/json/GJWriter.cpp View File

@@ -355,7 +355,7 @@ void JsonTextWriter::writeStruct(int i)
// if (j != element_list.size() - 1) {
// }
}
if(element_list.size()>1)
// if(element_list.size()>1)
(*_stream) <<std::endl<<indent3<<"]";
write_endstr(i+1,0);

@@ -454,16 +454,16 @@ void JsonTextWriter::write_bgnstr(JsonStruct* str,int i) const
std::string indent2(4*(i+1), ' ');
std::string indent3(4*(i+2), ' ');
(*_stream) <<indent<< "{" << std::endl;
if(str->get_element_list().size()>1){
// if(str->get_element_list().size()>1){
(*_stream) <<indent2<< "\"type\" : \"group\"," <<std::endl;
}
// }
// else
// (*_stream) <<indent2<< "\"type\" : \"not a group\"," <<std::endl;
(*_stream) <<indent2<< "\"struct name\" :"<<"\""<<str->get_name()<<"\"";
// myHash_temp[str->get_name()]++;
if(str->get_element_list().size()>1){
// if(str->get_element_list().size()>1){
(*_stream) <<"," <<std::endl<<indent2<< "\"children\":[" <<std::endl;
}
// }
// (*_stream) <<indent3<< "\"lastmodify\" : \""<< fmt_time(str->get_last_mod()) <<"\""<<std::endl;
// (*_stream) << "\"lastmodify\" : \""<<fmt_time(str->get_bgn_str()) << " " << fmt_time(str->get_last_mod()) << std::endl;
}


+ 2
- 1
src/evaluation/src/util/init_egr.cpp View File

@@ -63,7 +63,8 @@ void InitEGR::runEGR(bool enable_timing)
config_map.insert({"-enable_timing", 1});
}
rt_interface.initRT(config_map);
rt_interface.runEGR();
std::map<std::string, std::any> ert_config_map;
rt_interface.runERT(ert_config_map);
rt_interface.destroyRT();
}



+ 39
- 44
src/evaluation/src/util/init_sta.cc View File

@@ -111,7 +111,8 @@ void InitSTA::runPlaceVecSTA(const std::string& routing_type, const bool& rt_don
updateResult(routing_type);
}

void InitSTA::runSpefVecSTA(std::string work_dir) {
void InitSTA::runSpefVecSTA(std::string work_dir)
{
initStaEngine();

buildSpefRCTree(work_dir);
@@ -120,19 +121,20 @@ void InitSTA::runSpefVecSTA(std::string work_dir) {
}

///@brief save ppa index into csv.
void InitSTA::saveTimingPowerBenchmark() {
void InitSTA::saveTimingPowerBenchmark()
{
// get freq、TNS、Top100 path delay
std::map<std::string, std::pair<double, double>> clock_freq_map; // clock_name, <freq, TNS>
std::map<std::string, std::pair<double, double>> clock_freq_map; // clock_name, <freq, TNS>
auto all_clocks = STA_INST->getClockList();
for (auto* clock : all_clocks) {
double clock_period = clock->getPeriodNs();
double slack = STA_INST->getWNS(clock->get_clock_name(), ista::AnalysisMode::kMax);
double clock_period = clock->getPeriodNs();
double slack = STA_INST->getWNS(clock->get_clock_name(), ista::AnalysisMode::kMax);

// freq is period inverse.
double freq_MHz = 1000 / (clock_period - slack);
// freq is period inverse.
double freq_MHz = 1000 / (clock_period - slack);

double TNS = STA_INST->getTNS(clock->get_clock_name(), ista::AnalysisMode::kMax);
clock_freq_map[clock->get_clock_name()] = std::make_pair(freq_MHz, TNS);
double TNS = STA_INST->getTNS(clock->get_clock_name(), ista::AnalysisMode::kMax);
clock_freq_map[clock->get_clock_name()] = std::make_pair(freq_MHz, TNS);
}

std::vector<std::pair<std::string, double>> end_vertex_to_path_delay;
@@ -151,7 +153,7 @@ void InitSTA::saveTimingPowerBenchmark() {
double leakage_power = PW_INST->get_power()->getSumLeakagePower();
double internal_power = PW_INST->get_power()->getSumInternalPower();
double switch_power = PW_INST->get_power()->getSumSwitchPower();
// net density need in single file.
// save to json.

@@ -161,7 +163,7 @@ void InitSTA::saveTimingPowerBenchmark() {
std::ofstream json_file(benchmark_file_path, std::ios::out | std::ios::trunc);
if (!json_file.is_open()) {
LOG_ERROR << "Fail to open timing_power_benchmark.json";
return;
return;
}

json json_data;
@@ -337,7 +339,8 @@ void InitSTA::callRT(const std::string& routing_type)
RT_INST.initRT(config_map);

if (routing_type == "EGR") {
RT_INST.runEGR();
std::map<std::string, std::any> ert_config_map;
RT_INST.runERT(ert_config_map);
} else if (routing_type == "DR") {
RT_INST.runRT();
}
@@ -653,7 +656,8 @@ void InitSTA::buildVecRCTree(ivec::VecLayout* vec_layout, std::string work_dir)
STA_INST->reportWirePaths(10000);
}

void InitSTA::buildSpefRCTree(std::string work_dir) {
void InitSTA::buildSpefRCTree(std::string work_dir)
{
std::string spef_path = dmInst->get_config().get_spef_path();
LOG_INFO << "spef path: " << spef_path;
STA_INST->readSpef(spef_path.c_str());
@@ -665,7 +669,6 @@ void InitSTA::buildSpefRCTree(std::string work_dir) {
STA_INST->reportWirePaths(10000);
}


void InitSTA::initPowerEngine()
{
if (!PW_INST->isBuildGraph()) {
@@ -714,7 +717,7 @@ void InitSTA::updateResult(const std::string& routing_type)
}
_power[routing_type]["static_power"] = static_power;
_power[routing_type]["dynamic_power"] = dynamic_power;
// save benchmark file for test.
saveTimingPowerBenchmark();
}
@@ -1058,7 +1061,7 @@ TimingWireGraph InitSTA::getTimingWireGraph()

auto* ista = STA_INST->get_ista();
LOG_ERROR_IF(!ista->isBuildGraph()) << "timing graph is not build";
// build equivalent library cells map
auto& all_libs = ista->getAllLib();
std::vector<LibLibrary*> equiv_libs;
@@ -1186,7 +1189,7 @@ TimingWireGraph InitSTA::getTimingWireGraph()
power_feature._sp = pwr_vertex->getSPData(std::nullopt);

power_feature._node_internal_power = pwr_vertex->getInternalPower();
double switch_power = 0.0;
if (vertex_to_switch_power.contains(pwr_vertex)) {
switch_power = vertex_to_switch_power[pwr_vertex];
@@ -1258,28 +1261,26 @@ TimingWireGraph InitSTA::getTimingWireGraph()
ieda::Stats stats2;
auto& from_node = wire_edge->get_from();
auto& to_node = wire_edge->get_to();
// from node
auto wire_from_node_index = create_net_node(from_node);
auto& wire_from_node = timing_wire_graph.getNode(wire_from_node_index);
wire_from_node._node_feature._node_slews
= {max_rise_all_nodes_slew[from_node.get_name()], max_fall_all_nodes_slew[from_node.get_name()],
min_rise_all_nodes_slew[from_node.get_name()], min_fall_all_nodes_slew[from_node.get_name()]};
wire_from_node._node_feature._node_caps = {from_node.cap(AnalysisMode::kMax, TransType::kRise),
from_node.cap(AnalysisMode::kMax, TransType::kFall),
from_node.cap(AnalysisMode::kMin, TransType::kRise),
from_node.cap(AnalysisMode::kMin, TransType::kFall)};
wire_from_node._node_feature._node_caps
= {from_node.cap(AnalysisMode::kMax, TransType::kRise), from_node.cap(AnalysisMode::kMax, TransType::kFall),
from_node.cap(AnalysisMode::kMin, TransType::kRise), from_node.cap(AnalysisMode::kMin, TransType::kFall)};

// to node
auto wire_to_node_index = create_net_node(to_node);
auto& wire_to_node = timing_wire_graph.getNode(wire_to_node_index);
wire_to_node._node_feature._node_slews
= {max_rise_all_nodes_slew[to_node.get_name()], max_fall_all_nodes_slew[to_node.get_name()],
min_rise_all_nodes_slew[to_node.get_name()], min_fall_all_nodes_slew[to_node.get_name()]};
wire_to_node._node_feature._node_caps = {to_node.cap(AnalysisMode::kMax, TransType::kRise),
to_node.cap(AnalysisMode::kMax, TransType::kFall),
to_node.cap(AnalysisMode::kMin, TransType::kRise),
to_node.cap(AnalysisMode::kMin, TransType::kFall)};
wire_to_node._node_feature._node_caps
= {to_node.cap(AnalysisMode::kMax, TransType::kRise), to_node.cap(AnalysisMode::kMax, TransType::kFall),
to_node.cap(AnalysisMode::kMin, TransType::kRise), to_node.cap(AnalysisMode::kMin, TransType::kFall)};

auto& net_wire_edge = timing_wire_graph.addEdge(wire_from_node_index, wire_to_node_index);
net_wire_edge._edge_feature._edge_resistance = wire_edge->get_res();
@@ -1315,7 +1316,7 @@ TimingWireGraph InitSTA::getTimingWireGraph()
auto* the_pwr_arc = ipower->get_power_graph().staToPwrArc(the_arc);
if (the_pwr_arc) {
edge_power_feature._inst_arc_internal_power = dynamic_cast<ipower::PwrInstArc*>(the_pwr_arc)->getInternalPower();
}
}

inst_arc_edge._edge_feature = edge_feature;
inst_arc_edge._power_feature = edge_power_feature;
@@ -1357,9 +1358,7 @@ TimingInstanceGraph InitSTA::getTimingInstanceGraph()
timing_instance_graph._nodes.reserve(the_timing_graph->get_vertexes().size() * 10);

/// create node in instance graph
auto create_node = [&timing_instance_graph, ipower](
std::string& node_name,
ista::DesignObject* obj) -> unsigned {
auto create_node = [&timing_instance_graph, ipower](std::string& node_name, ista::DesignObject* obj) -> unsigned {
auto index = timing_instance_graph.findNode(node_name);
if (!index) {
TimingInstanceNode the_node;
@@ -1447,16 +1446,16 @@ void SaveTimingGraph(const TimingWireGraph& timing_wire_graph, const std::string

node_feature_json["node_coord"] = json::array({node_feature._node_coord.first, node_feature._node_coord.second});
node_feature_json["node_slews"] = json::array({std::get<0>(node_feature._node_slews), std::get<1>(node_feature._node_slews),
std::get<2>(node_feature._node_slews), std::get<3>(node_feature._node_slews)});
std::get<2>(node_feature._node_slews), std::get<3>(node_feature._node_slews)});
node_feature_json["node_capacitances"] = json::array({std::get<0>(node_feature._node_caps), std::get<1>(node_feature._node_caps),
std::get<2>(node_feature._node_caps), std::get<3>(node_feature._node_caps)});
std::get<2>(node_feature._node_caps), std::get<3>(node_feature._node_caps)});
node_feature_json["node_arrive_times"] = json::array({std::get<0>(node_feature._node_ats), std::get<1>(node_feature._node_ats),
std::get<2>(node_feature._node_ats), std::get<3>(node_feature._node_ats)});
std::get<2>(node_feature._node_ats), std::get<3>(node_feature._node_ats)});
node_feature_json["node_required_times"] = json::array({std::get<0>(node_feature._node_rats), std::get<1>(node_feature._node_rats),
std::get<2>(node_feature._node_rats), std::get<3>(node_feature._node_rats)});
node_feature_json["node_net_load_delays"] = json::array(
{std::get<0>(node_feature._node_net_delays), std::get<1>(node_feature._node_net_delays),
std::get<2>(node_feature._node_net_delays), std::get<3>(node_feature._node_net_delays)});
std::get<2>(node_feature._node_rats), std::get<3>(node_feature._node_rats)});
node_feature_json["node_net_load_delays"]
= json::array({std::get<0>(node_feature._node_net_delays), std::get<1>(node_feature._node_net_delays),
std::get<2>(node_feature._node_net_delays), std::get<3>(node_feature._node_net_delays)});

node_feature_json["node_toggle"] = node._power_feature._toggle;
node_feature_json["node_sp"] = node._power_feature._sp;
@@ -1480,13 +1479,12 @@ void SaveTimingGraph(const TimingWireGraph& timing_wire_graph, const std::string
auto& edge_feature = edge._edge_feature;
json edge_feature_json;
edge_feature_json["edge_delay"] = json::array({std::get<0>(edge_feature._edge_delay), std::get<1>(edge_feature._edge_delay),
std::get<2>(edge_feature._edge_delay), std::get<3>(edge_feature._edge_delay)});
std::get<2>(edge_feature._edge_delay), std::get<3>(edge_feature._edge_delay)});
edge_feature_json["edge_resistance"] = edge_feature._edge_resistance;

auto& edge_power_feature = edge._power_feature;
edge_feature_json["inst_arc_internal_power"] = edge_power_feature._inst_arc_internal_power;


j.push_back({{"id", edge_id_str},
{"from_node", edge._from_node},
{"to_node", edge._to_node},
@@ -1527,10 +1525,7 @@ void SaveTimingInstanceGraph(const TimingInstanceGraph& timing_instance_graph, c
json j = json::array();
for (unsigned node_id = 0; auto& node : timing_instance_graph._nodes) {
std::string id_str = "node_" + std::to_string(node_id++);
j.push_back({{"id", id_str},
{"name", node._name},
{"leakage_power",
node._node_feature._leakage_power}});
j.push_back({{"id", id_str}, {"name", node._name}, {"leakage_power", node._node_feature._leakage_power}});
}
nodes_json = j;
});


+ 11
- 4
src/interface/python/py_irt/py_irt.cpp View File

@@ -24,15 +24,24 @@
#include "flow_config.h"
namespace python_interface {

bool initConfigMapByJSON(const std::string& config, std::map<std::string, std::any>& config_map);

bool destroyRT()
{
RTI.destroyRT();
return true;
}

bool runEGR()
bool runERT(std::string& config, std::map<std::string, std::string>& config_dict)
{
RTI.runEGR();
std::map<std::string, std::any> config_map;

bool pass = false;
pass = !pass ? initConfigMapByJSON(config, config_map) : pass;
if (!pass) {
return false;
}
RTI.runERT(config_map);
return true;
}

@@ -42,8 +51,6 @@ bool runRT()
return true;
}

bool initConfigMapByJSON(const std::string& config, std::map<std::string, std::any>& config_map);

bool initRT(std::string& config, std::map<std::string, std::string>& config_dict)
{
iplf::flowConfigInst->set_status_stage("iRT - Routing");


+ 1
- 1
src/interface/python/py_irt/py_irt.h View File

@@ -23,7 +23,7 @@ namespace python_interface {
bool destroyRT();
bool initRT(std::string& config, std::map<std::string, std::string>& config_dict);
bool runDR();
bool runEGR();
bool runERT(std::string& config, std::map<std::string, std::string>& config_dict);
bool runRT();

} // namespace python_interface

+ 1
- 1
src/interface/python/py_irt/py_register_irt.h View File

@@ -26,7 +26,7 @@ void register_irt(py::module& m)
{
m.def("destroy_rt", destroyRT);
m.def("init_rt", initRT, py::arg("config") = "", py::arg("config_dict") = std::map<std::string, std::string>{});
m.def("run_egr", runEGR);
m.def("run_ert", runERT, py::arg("config") = "", py::arg("config_dict") = std::map<std::string, std::string>{});
m.def("run_rt", runRT);
}
} // namespace python_interface

+ 1
- 1
src/interface/tcl/tcl_irt/CMakeLists.txt View File

@@ -1,6 +1,6 @@
add_library(tcl_irt
${HOME_INTERFACE}/tcl/tcl_irt/src/tcl_init_rt.cpp
${HOME_INTERFACE}/tcl/tcl_irt/src/tcl_run_egr.cpp
${HOME_INTERFACE}/tcl/tcl_irt/src/tcl_run_ert.cpp
${HOME_INTERFACE}/tcl/tcl_irt/src/tcl_run_rt.cpp
${HOME_INTERFACE}/tcl/tcl_irt/src/tcl_destroy_rt.cpp
${HOME_INTERFACE}/tcl/tcl_irt/src/tcl_rt_clean_def.cpp


+ 1
- 1
src/interface/tcl/tcl_irt/include/tcl_register_irt.h View File

@@ -26,7 +26,7 @@ int registerCmdRT()
{
// rt
registerTclCmd(TclInitRT, "init_rt");
registerTclCmd(TclRunEGR, "run_egr");
registerTclCmd(TclRunERT, "run_ert");
registerTclCmd(TclRunRT, "run_rt");
registerTclCmd(TclDestroyRT, "destroy_rt");
// aux


+ 3
- 3
src/interface/tcl/tcl_irt/include/tcl_rt.h View File

@@ -36,11 +36,11 @@ class TclInitRT : public TclCmd
std::vector<std::pair<std::string, ValueType>> _config_list;
};

class TclRunEGR : public TclCmd
class TclRunERT : public TclCmd
{
public:
explicit TclRunEGR(const char* cmd_name);
~TclRunEGR() override = default;
explicit TclRunERT(const char* cmd_name);
~TclRunERT() override = default;

unsigned check() override { return 1; };



src/interface/tcl/tcl_irt/src/tcl_run_egr.cpp → src/interface/tcl/tcl_irt/src/tcl_run_ert.cpp View File

@@ -24,16 +24,20 @@

namespace tcl {

TclRunEGR::TclRunEGR(const char* cmd_name) : TclCmd(cmd_name)
TclRunERT::TclRunERT(const char* cmd_name) : TclCmd(cmd_name)
{
_config_list.push_back(std::make_pair("-resolve_congestion", ValueType::kString));

TclUtil::addOption(this, _config_list);
}

unsigned TclRunEGR::exec()
unsigned TclRunERT::exec()
{
if (!check()) {
return 0;
}
RTI.runEGR();
std::map<std::string, std::any> config_map = TclUtil::getConfigMap(this, _config_list);
RTI.runERT(config_map);
return 1;
}


+ 18
- 14
src/operation/iFP/source/module/io_placer/io_placer.cpp View File

@@ -97,25 +97,29 @@ bool IoPlacer::autoPlacePins(std::string layer_name, int width, int height, std:

auto idb_die = idb_layout->get_die();
auto idb_core = idb_layout->get_core();
idb::IdbLayer* left_right_layer = nullptr;
idb::IdbLayer* bottom_top_layer = nullptr;
idb::IdbLayer* horizontal_layer = nullptr;
idb::IdbLayer* vertical_layer = nullptr;
{
auto curr_layer = idb_layout->get_layers()->find_layer(layer_name);
idb::IdbLayerRouting* curr_routing_layer = dynamic_cast<idb::IdbLayerRouting*>(curr_layer);

if (curr_routing_layer->get_direction() == idb::IdbLayerDirection::kHorizontal) {
left_right_layer = curr_layer;
horizontal_layer = curr_layer;
} else {
bottom_top_layer = curr_layer;
vertical_layer = curr_layer;
}

auto above_layer = idb_layout->get_layers()->find_routing_layer(curr_layer->get_id() + 1);
idb::IdbLayerRouting* above_routing_layer = dynamic_cast<idb::IdbLayerRouting*>(above_layer);
auto neighbour_layer = dynamic_cast<idb::IdbLayerRouting*>(idb_layout->get_layers()->find_routing_layer(curr_layer->get_id() + 1));
if (neighbour_layer == nullptr) {
neighbour_layer = dynamic_cast<idb::IdbLayerRouting*>(idb_layout->get_layers()->find_routing_layer(curr_layer->get_id() - 1));
}

if (above_routing_layer->get_direction() == idb::IdbLayerDirection::kHorizontal) {
left_right_layer = above_layer;
} else {
bottom_top_layer = above_layer;
if (neighbour_layer != nullptr) {
if (neighbour_layer->get_direction() == idb::IdbLayerDirection::kHorizontal) {
horizontal_layer = neighbour_layer;
} else {
vertical_layer = neighbour_layer;
}
}
}
auto pin_list = idb_design->get_io_pin_list()->get_pin_list();
@@ -163,7 +167,7 @@ bool IoPlacer::autoPlacePins(std::string layer_name, int width, int height, std:
int shape_ury = shape_lly + width;

shape->add_rect(shape_llx - x, shape_lly - y, shape_urx - x, shape_ury - y);
shape->set_layer(left_right_layer);
shape->set_layer(horizontal_layer);
}
}

@@ -201,7 +205,7 @@ bool IoPlacer::autoPlacePins(std::string layer_name, int width, int height, std:
int shape_ury = shape_lly + width;

shape->add_rect(shape_llx - x, shape_lly - y, shape_urx - x, shape_ury - y);
shape->set_layer(left_right_layer);
shape->set_layer(horizontal_layer);
}
}

@@ -239,7 +243,7 @@ bool IoPlacer::autoPlacePins(std::string layer_name, int width, int height, std:
int shape_ury = shape_lly + height;

shape->add_rect(shape_llx - x, shape_lly - y, shape_urx - x, shape_ury - y);
shape->set_layer(bottom_top_layer);
shape->set_layer(vertical_layer);
}
}

@@ -278,7 +282,7 @@ bool IoPlacer::autoPlacePins(std::string layer_name, int width, int height, std:
int shape_ury = shape_lly + height;

shape->add_rect(shape_llx - x, shape_lly - y, shape_urx - x, shape_ury - y);
shape->set_layer(bottom_top_layer);
shape->set_layer(vertical_layer);
}
}



+ 2
- 3
src/operation/iRT/interface/RTInterface.cpp View File

@@ -92,7 +92,7 @@ void RTInterface::initRT(std::map<std::string, std::any> config_map)
RTLOG.info(Loc::current(), "Completed", monitor.getStatsInfo());
}

void RTInterface::runEGR()
void RTInterface::runERT(std::map<std::string, std::any> config_map)
{
Monitor monitor;
RTLOG.info(Loc::current(), "Starting...");
@@ -101,7 +101,7 @@ void RTInterface::runEGR()
RTGP.init();

EarlyRouter::initInst();
RTER.route();
RTER.route(config_map);
EarlyRouter::destroyInst();

destroyFlute();
@@ -382,7 +382,6 @@ void RTInterface::getCongestion()
RTDE.destroy();

RTLOG.info(Loc::current(), "Completed", monitor.getStatsInfo());

}

#endif


+ 1
- 1
src/operation/iRT/interface/RTInterface.hpp View File

@@ -76,7 +76,7 @@ class RTInterface

#if 1 // iRT
void initRT(std::map<std::string, std::any> config_map);
void runEGR();
void runERT(std::map<std::string, std::any> config_map);
void runRT();
void destroyRT();
void cleanDef();


+ 95
- 0
src/operation/iRT/source/data_manager/basic/OpenQueue.hpp View File

@@ -0,0 +1,95 @@
// ***************************************************************************************
// Copyright (c) 2023-2025 Peng Cheng Laboratory
// Copyright (c) 2023-2025 Institute of Computing Technology, Chinese Academy of Sciences
// Copyright (c) 2023-2025 Beijing Institute of Open Source Chip
//
// iEDA is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
//
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
//
// See the Mulan PSL v2 for more details.
// ***************************************************************************************
#pragma once

#include <queue>

#include "OpenQueueNode.hpp"

namespace irt {

template <class T>
class OpenQueue : private std::priority_queue<OpenQueueNode<T>*, std::vector<OpenQueueNode<T>*>, CmpOpenQueueNodeCost<T>>
{
public:
using Base = std::priority_queue<OpenQueueNode<T>*, std::vector<OpenQueueNode<T>*>, CmpOpenQueueNodeCost<T>>;
OpenQueue() = default;
~OpenQueue() = default;

T* top()
{
while (!Base::empty() && Base::top()->get_state() == OpenQueueNodeState::kDel) {
auto del_node = Base::top();
Base::pop();
delete del_node;
}
return Base::empty() ? nullptr : Base::top()->get_node();
}
T* pop()
{
T* node = top();
if (!Base::empty()) {
auto del_node = Base::top();
_node_to_priority_queue_node_map.erase(node);
Base::pop();
delete del_node;
real_size--;
}
return node;
}
void push(T* node)
{
if (_node_to_priority_queue_node_map.find(node) != _node_to_priority_queue_node_map.end()) {
_node_to_priority_queue_node_map[node]->set_state(OpenQueueNodeState::kDel);
real_size--;
}
OpenQueueNode<T>* pq_node = new OpenQueueNode<T>(node);
_node_to_priority_queue_node_map[node] = pq_node;
Base::push(pq_node);
real_size++;
if (Base::size() > real_size * 10) {
restruct();
}
}
void restruct()
{
std::priority_queue<OpenQueueNode<T>*, std::vector<OpenQueueNode<T>*>, CmpOpenQueueNodeCost<T>> temp;
for (auto& pq_node : this->c) {
if (pq_node->get_state() != OpenQueueNodeState::kDel) {
temp.push(pq_node);
} else {
delete pq_node;
}
}
temp.swap(*this);
}
void clear()
{
for (auto& pq_node : this->c) {
delete pq_node;
}
real_size = 0;
std::priority_queue<OpenQueueNode<T>*, std::vector<OpenQueueNode<T>*>, CmpOpenQueueNodeCost<T>>().swap(*this);
_node_to_priority_queue_node_map.clear();
}

private:
long unsigned int real_size = 0;
std::map<T*, OpenQueueNode<T>*> _node_to_priority_queue_node_map;
};

} // namespace irt

+ 90
- 0
src/operation/iRT/source/data_manager/basic/OpenQueueNode.hpp View File

@@ -0,0 +1,90 @@
// ***************************************************************************************
// Copyright (c) 2023-2025 Peng Cheng Laboratory
// Copyright (c) 2023-2025 Institute of Computing Technology, Chinese Academy of Sciences
// Copyright (c) 2023-2025 Beijing Institute of Open Source Chip
//
// iEDA is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
//
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
//
// See the Mulan PSL v2 for more details.
// ***************************************************************************************
#pragma once

#include "RTHeader.hpp"
#include "Utility.hpp"


namespace irt {

#if 1 // astar
enum class OpenQueueNodeState
{
kOpen = 1,
kDel = 2
};
#endif

template <typename T>
class OpenQueueNode {
public:
OpenQueueNode() = default;
~OpenQueueNode() = default;
OpenQueueNode(T* node)
: _node(node),
_neighbor_node_map_size(node->get_neighbor_node_map().size()),
_estimated_cost(node->get_estimated_cost()),
_known_cost(node->get_known_cost()) {
set_state(OpenQueueNodeState::kOpen);
}
// getter
double getEstimatedCost() const { return _estimated_cost; }
double get_known_cost() const { return _known_cost; }
double get_estimated_cost() const { return _estimated_cost; }
double get_neighbor_node_map_size() const { return _neighbor_node_map_size; }
T* get_node() const { return _node; }
OpenQueueNodeState get_state() const { return _state; }
// setter
void set_known_cost(const double known_cost) { _known_cost = known_cost; }
void set_estimated_cost(const double estimated_cost) { _estimated_cost = estimated_cost; }
void set_neighbor_node_map_size(int32_t size) { _neighbor_node_map_size = size; }
void set_node(T* node) { _node = node; }
void set_state(OpenQueueNodeState state) { _state = state; }
// function
double getTotalCost() { return (_known_cost + _estimated_cost); }
bool isOpen() { return _state == OpenQueueNodeState::kOpen; }
bool isDel() { return _state == OpenQueueNodeState::kDel; }

private:
T* _node;
int32_t _neighbor_node_map_size;
double _estimated_cost;
double _known_cost;
OpenQueueNodeState _state;
};

#if 1 // astar
template <typename T>
struct CmpOpenQueueNodeCost
{
bool operator()(OpenQueueNode<T>* a, OpenQueueNode<T>* b)
{
if (RTUTIL.equalDoubleByError(a->getTotalCost(), b->getTotalCost(), RT_ERROR)) {
if (RTUTIL.equalDoubleByError(a->get_estimated_cost(), b->get_estimated_cost(), RT_ERROR)) {
return a->get_neighbor_node_map_size() < b->get_neighbor_node_map_size();
} else {
return a->get_estimated_cost() > b->get_estimated_cost();
}
} else {
return a->getTotalCost() > b->getTotalCost();
}
}
};
#endif

} // namespace irt

+ 0
- 36
src/operation/iRT/source/data_manager/basic/PriorityQueue.hpp View File

@@ -1,36 +0,0 @@
// ***************************************************************************************
// Copyright (c) 2023-2025 Peng Cheng Laboratory
// Copyright (c) 2023-2025 Institute of Computing Technology, Chinese Academy of Sciences
// Copyright (c) 2023-2025 Beijing Institute of Open Source Chip
//
// iEDA is licensed under Mulan PSL v2.
// You can use this software according to the terms and conditions of the Mulan PSL v2.
// You may obtain a copy of Mulan PSL v2 at:
// http://license.coscl.org.cn/MulanPSL2
//
// THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
// EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
// MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
//
// See the Mulan PSL v2 for more details.
// ***************************************************************************************
#pragma once

#include <queue>

namespace irt {

template <class T, class Container = std::vector<T>, class Compare = std::less<typename Container::value_type>>
class PriorityQueue : public std::priority_queue<T, Container, Compare>
{
public:
PriorityQueue() = default;
~PriorityQueue() = default;
// function
Container::iterator begin() { return this->c.begin(); }
Container::iterator end() { return this->c.end(); }

private:
};

} // namespace irt

+ 24
- 44
src/operation/iRT/source/module/detailed_router/DetailedRouter.cpp View File

@@ -116,12 +116,12 @@ void DetailedRouter::routeDRModel(DRModel& dr_model)
*/
std::vector<DRIterParam> dr_iter_param_list;
// clang-format off
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 3, 0, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 3, 1, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 3, 2, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 3, 0, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 3, 1, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 3, 2, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 12, 0, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 12, 4, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 12, 8, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 12, 0, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 12, 4, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
dr_iter_param_list.emplace_back(prefer_wire_unit, non_prefer_wire_unit, bend_unit, via_unit, 12, 8, 3, fixed_rect_unit, routed_rect_unit, violation_unit, 3, 10);
// clang-format on
initRoutingState(dr_model);
for (int32_t i = 0, iter = 1; i < static_cast<int32_t>(dr_iter_param_list.size()); i++, iter++) {
@@ -690,6 +690,7 @@ void DetailedRouter::buildLayerShadowMap(DRBox& dr_box)

void DetailedRouter::buildDRNodeNeighbor(DRBox& dr_box)
{
std::vector<RoutingLayer>& routing_layer_list = RTDM.getDatabase().get_routing_layer_list();
int32_t bottom_routing_layer_idx = RTDM.getConfig().bottom_routing_layer_idx;
int32_t top_routing_layer_idx = RTDM.getConfig().top_routing_layer_idx;

@@ -701,34 +702,20 @@ void DetailedRouter::buildDRNodeNeighbor(DRBox& dr_box)
routing_hv = false;
}
GridMap<DRNode>& dr_node_map = layer_node_map[layer_idx];
std::set<int32_t> neighbor_layer_x_axis_set;
std::set<int32_t> neighbor_layer_y_axis_set;
if (layer_idx != 0) {
neighbor_layer_x_axis_set.insert(layer_axis_map[layer_idx - 1].first.begin(), layer_axis_map[layer_idx - 1].first.end());
neighbor_layer_y_axis_set.insert(layer_axis_map[layer_idx - 1].second.begin(), layer_axis_map[layer_idx - 1].second.end());
}
if (layer_idx != static_cast<int32_t>(layer_node_map.size()) - 1) {
neighbor_layer_x_axis_set.insert(layer_axis_map[layer_idx + 1].first.begin(), layer_axis_map[layer_idx + 1].first.end());
neighbor_layer_y_axis_set.insert(layer_axis_map[layer_idx + 1].second.begin(), layer_axis_map[layer_idx + 1].second.end());
}
std::set<int32_t>& curr_axis = (routing_layer_list[layer_idx].isPreferH()) ? layer_axis_map[layer_idx].first : layer_axis_map[layer_idx].second;
for (int32_t x = 0; x < dr_node_map.get_x_size(); x++) {
for (int32_t y = 0; y < dr_node_map.get_y_size(); y++) {
std::map<Orientation, DRNode*>& neighbor_node_map = dr_node_map[x][y].get_neighbor_node_map();
std::vector<RoutingLayer>& routing_layer_list = RTDM.getDatabase().get_routing_layer_list();
std::set<int32_t> neighbor_layer_x_axis_set;
std::set<int32_t> neighbor_layer_y_axis_set;
if (layer_idx != 0) {
for (int32_t x_scale : layer_axis_map[layer_idx - 1].first) {
neighbor_layer_x_axis_set.insert(x_scale);
}
for (int32_t y_scale : layer_axis_map[layer_idx - 1].second) {
neighbor_layer_y_axis_set.insert(y_scale);
}
}
if (layer_idx != static_cast<int32_t>(layer_node_map.size()) - 1) {
for (int32_t x_scale : layer_axis_map[layer_idx + 1].first) {
neighbor_layer_x_axis_set.insert(x_scale);
}
for (int32_t y_scale : layer_axis_map[layer_idx + 1].second) {
neighbor_layer_y_axis_set.insert(y_scale);
}
}
std::set<int32_t> curr_axis;
if (routing_layer_list[layer_idx].isPreferH()) {
curr_axis = layer_axis_map[layer_idx].first;
} else {
curr_axis = layer_axis_map[layer_idx].second;
}
if (routing_hv) {
if (!routing_layer_list[layer_idx].isPreferH()) {
if (RTUTIL.exist(curr_axis, dr_node_map[x][y].get_y())) {
@@ -1069,7 +1056,7 @@ bool DetailedRouter::searchEnded(DRBox& dr_box)

void DetailedRouter::expandSearching(DRBox& dr_box)
{
PriorityQueue<DRNode*, std::vector<DRNode*>, CmpDRNodeCost>& open_queue = dr_box.get_open_queue();
OpenQueue<DRNode>& open_queue = dr_box.get_open_queue();
DRNode* path_head_node = dr_box.get_path_head_node();

for (auto& [orientation, neighbor_node] : path_head_node->get_neighbor_node_map()) {
@@ -1083,8 +1070,7 @@ void DetailedRouter::expandSearching(DRBox& dr_box)
if (neighbor_node->isOpen() && known_cost < neighbor_node->get_known_cost()) {
neighbor_node->set_known_cost(known_cost);
neighbor_node->set_parent_node(path_head_node);
// 对优先队列中的值修改了,需要重新建堆
std::make_heap(open_queue.begin(), open_queue.end(), CmpDRNodeCost());
open_queue.push(neighbor_node);
} else if (neighbor_node->isNone()) {
neighbor_node->set_known_cost(known_cost);
neighbor_node->set_parent_node(path_head_node);
@@ -1179,9 +1165,7 @@ void DetailedRouter::resetStartAndEnd(DRBox& dr_box)

void DetailedRouter::resetSinglePath(DRBox& dr_box)
{
PriorityQueue<DRNode*, std::vector<DRNode*>, CmpDRNodeCost> empty_queue;
dr_box.set_open_queue(empty_queue);

dr_box.get_open_queue().clear();
std::vector<DRNode*>& single_path_visited_node_list = dr_box.get_single_path_visited_node_list();
for (DRNode* visited_node : single_path_visited_node_list) {
visited_node->set_state(DRNodeState::kNone);
@@ -1246,7 +1230,7 @@ void DetailedRouter::resetSingleRouteTask(DRBox& dr_box)

void DetailedRouter::pushToOpenList(DRBox& dr_box, DRNode* curr_node)
{
PriorityQueue<DRNode*, std::vector<DRNode*>, CmpDRNodeCost>& open_queue = dr_box.get_open_queue();
OpenQueue<DRNode>& open_queue = dr_box.get_open_queue();
std::vector<DRNode*>& single_task_visited_node_list = dr_box.get_single_task_visited_node_list();
std::vector<DRNode*>& single_path_visited_node_list = dr_box.get_single_path_visited_node_list();

@@ -1258,12 +1242,8 @@ void DetailedRouter::pushToOpenList(DRBox& dr_box, DRNode* curr_node)

DRNode* DetailedRouter::popFromOpenList(DRBox& dr_box)
{
PriorityQueue<DRNode*, std::vector<DRNode*>, CmpDRNodeCost>& open_queue = dr_box.get_open_queue();

DRNode* node = nullptr;
if (!open_queue.empty()) {
node = open_queue.top();
open_queue.pop();
DRNode* node = dr_box.get_open_queue().pop();
if (node != nullptr) {
node->set_state(DRNodeState::kClose);
}
return node;


+ 4
- 4
src/operation/iRT/source/module/detailed_router/dr_data_manager/DRBox.hpp View File

@@ -25,7 +25,7 @@
#include "DRTask.hpp"
#include "LayerCoord.hpp"
#include "LayerRect.hpp"
#include "PriorityQueue.hpp"
#include "OpenQueue.hpp"
#include "ScaleAxis.hpp"
#include "Violation.hpp"

@@ -117,11 +117,11 @@ class DRBox
}
void set_routing_segment_list(const std::vector<Segment<LayerCoord>>& routing_segment_list) { _routing_segment_list = routing_segment_list; }
// single path
PriorityQueue<DRNode*, std::vector<DRNode*>, CmpDRNodeCost>& get_open_queue() { return _open_queue; }
OpenQueue<DRNode>& get_open_queue() { return _open_queue; }
std::vector<DRNode*>& get_single_path_visited_node_list() { return _single_path_visited_node_list; }
DRNode* get_path_head_node() { return _path_head_node; }
int32_t get_end_node_list_idx() const { return _end_node_list_idx; }
void set_open_queue(const PriorityQueue<DRNode*, std::vector<DRNode*>, CmpDRNodeCost>& open_queue) { _open_queue = open_queue; }
void set_open_queue(const OpenQueue<DRNode>& open_queue) { _open_queue = open_queue; }
void set_single_path_visited_node_list(const std::vector<DRNode*>& single_path_visited_node_list)
{
_single_path_visited_node_list = single_path_visited_node_list;
@@ -173,7 +173,7 @@ class DRBox
std::vector<DRNode*> _single_task_visited_node_list;
std::vector<Segment<LayerCoord>> _routing_segment_list;
// single path
PriorityQueue<DRNode*, std::vector<DRNode*>, CmpDRNodeCost> _open_queue;
OpenQueue<DRNode> _open_queue;
std::vector<DRNode*> _single_path_visited_node_list;
DRNode* _path_head_node = nullptr;
int32_t _end_node_list_idx = -1;


+ 65
- 56
src/operation/iRT/source/module/early_router/EarlyRouter.cpp View File

@@ -50,12 +50,12 @@ void EarlyRouter::destroyInst()

// function

void EarlyRouter::route()
void EarlyRouter::route(std::map<std::string, std::any> config_map)
{
Monitor monitor;
RTLOG.info(Loc::current(), "Starting...");
ERModel er_model = initERModel();
setERComParam(er_model);
setERComParam(er_model, config_map);
initAccessPointList(er_model);
// debugPlotERModel(er_model, "before");
buildConflictList(er_model);
@@ -120,8 +120,10 @@ ERNet EarlyRouter::convertToERNet(Net& net)
return er_net;
}

void EarlyRouter::setERComParam(ERModel& er_model)
void EarlyRouter::setERComParam(ERModel& er_model, std::map<std::string, std::any> config_map)
{
std::string resolve_congestion = RTUTIL.getConfigValue<std::string>(config_map, "-resolve_congestion", "high");

int32_t max_candidate_point_num = 10;
int32_t supply_reduction = 0;
double boundary_wire_unit = 1;
@@ -136,11 +138,12 @@ void EarlyRouter::setERComParam(ERModel& er_model)
double overflow_unit = 4 * non_prefer_wire_unit;

/**
* max_candidate_point_num, supply_reduction, boundary_wire_unit, internal_wire_unit, internal_via_unit, topo_spilt_length, expand_step_num,
* expand_step_length, via_unit, overflow_unit
* resolve_congestion,max_candidate_point_num, supply_reduction, boundary_wire_unit, internal_wire_unit, internal_via_unit, topo_spilt_length,
* expand_step_num, expand_step_length, via_unit, overflow_unit
*/
ERComParam er_com_param(max_candidate_point_num, supply_reduction, boundary_wire_unit, internal_wire_unit, internal_via_unit, topo_spilt_length,
expand_step_num, expand_step_length, via_unit, overflow_unit);
ERComParam er_com_param(resolve_congestion, max_candidate_point_num, supply_reduction, boundary_wire_unit, internal_wire_unit, internal_via_unit,
topo_spilt_length, expand_step_num, expand_step_length, via_unit, overflow_unit);
RTLOG.info(Loc::current(), "resolve_congestion: ", er_com_param.get_resolve_congestion());
RTLOG.info(Loc::current(), "max_candidate_point_num: ", er_com_param.get_max_candidate_point_num());
RTLOG.info(Loc::current(), "supply_reduction: ", er_com_param.get_supply_reduction());
RTLOG.info(Loc::current(), "boundary_wire_unit: ", er_com_param.get_boundary_wire_unit());
@@ -387,55 +390,56 @@ void EarlyRouter::buildConflictList(ERModel& er_model)
Monitor monitor;
RTLOG.info(Loc::current(), "Starting...");

std::vector<ERConflictGroup>& er_conflict_group_list = er_model.get_er_conflict_group_list();

std::map<ERPin*, std::set<ERPin*>> pin_conflict_map;
for (auto& [curr_pin, conflict_pin_set] : getPinConlictMap(er_model)) {
pin_conflict_map[curr_pin] = conflict_pin_set;
}
for (auto& [curr_pin, conflict_pin_set] : pin_conflict_map) {
if (conflict_pin_set.empty()) {
continue;
if (er_model.get_er_com_param().get_resolve_congestion() == "high") {
std::map<ERPin*, std::set<ERPin*>> pin_conflict_map;
for (auto& [curr_pin, conflict_pin_set] : getPinConlictMap(er_model)) {
pin_conflict_map[curr_pin] = conflict_pin_set;
}
std::vector<std::pair<ERPin*, ERPin*>> conflict_list;
std::map<ERPin*, int32_t> pin_idx_map;
std::queue<ERPin*> pin_queue = RTUTIL.initQueue(curr_pin);
while (!pin_queue.empty()) {
ERPin* er_pin = RTUTIL.getFrontAndPop(pin_queue);
if (!RTUTIL.exist(pin_idx_map, er_pin)) {
pin_idx_map[er_pin] = pin_idx_map.size();
}
if (!RTUTIL.exist(pin_conflict_map, er_pin)) {
for (auto& [curr_pin, conflict_pin_set] : pin_conflict_map) {
if (conflict_pin_set.empty()) {
continue;
}
std::set<ERPin*>& conflict_pin_set = pin_conflict_map[er_pin];
for (ERPin* conflict_pin : conflict_pin_set) {
conflict_list.emplace_back(er_pin, conflict_pin);
pin_queue.push(conflict_pin);
std::vector<std::pair<ERPin*, ERPin*>> conflict_list;
std::map<ERPin*, int32_t> pin_idx_map;
std::queue<ERPin*> pin_queue = RTUTIL.initQueue(curr_pin);
while (!pin_queue.empty()) {
ERPin* er_pin = RTUTIL.getFrontAndPop(pin_queue);
if (!RTUTIL.exist(pin_idx_map, er_pin)) {
pin_idx_map[er_pin] = pin_idx_map.size();
}
if (!RTUTIL.exist(pin_conflict_map, er_pin)) {
continue;
}
std::set<ERPin*>& conflict_pin_set = pin_conflict_map[er_pin];
for (ERPin* conflict_pin : conflict_pin_set) {
conflict_list.emplace_back(er_pin, conflict_pin);
pin_queue.push(conflict_pin);
}
conflict_pin_set.clear();
}
ERConflictGroup er_conflict_group;
std::vector<std::vector<ERConflictPoint>>& conflict_point_list_list = er_conflict_group.get_conflict_point_list_list();
conflict_point_list_list.resize(pin_idx_map.size());
for (auto& [er_pin, conflict_point_list_idx] : pin_idx_map) {
std::vector<ERConflictPoint> conflict_point_list;
for (AccessPoint& access_point : er_pin->get_access_point_list()) {
ERConflictPoint conflict_point;
conflict_point.set_er_pin(er_pin);
conflict_point.set_access_point(&access_point);
conflict_point.set_coord(access_point.get_real_coord());
conflict_point.set_layer_idx(access_point.get_layer_idx());
conflict_point_list.push_back(conflict_point);
}
conflict_point_list_list[conflict_point_list_idx] = conflict_point_list;
}
conflict_pin_set.clear();
}
ERConflictGroup er_conflict_group;
std::vector<std::vector<ERConflictPoint>>& conflict_point_list_list = er_conflict_group.get_conflict_point_list_list();
conflict_point_list_list.resize(pin_idx_map.size());
for (auto& [er_pin, conflict_point_list_idx] : pin_idx_map) {
std::vector<ERConflictPoint> conflict_point_list;
for (AccessPoint& access_point : er_pin->get_access_point_list()) {
ERConflictPoint conflict_point;
conflict_point.set_er_pin(er_pin);
conflict_point.set_access_point(&access_point);
conflict_point.set_coord(access_point.get_real_coord());
conflict_point.set_layer_idx(access_point.get_layer_idx());
conflict_point_list.push_back(conflict_point);
std::map<int32_t, std::vector<int32_t>>& conflict_map = er_conflict_group.get_conflict_map();
for (std::pair<ERPin*, ERPin*>& conflict_pair : conflict_list) {
conflict_map[pin_idx_map[conflict_pair.first]].push_back(pin_idx_map[conflict_pair.second]);
}
conflict_point_list_list[conflict_point_list_idx] = conflict_point_list;
er_model.get_er_conflict_group_list().push_back(er_conflict_group);
}
std::map<int32_t, std::vector<int32_t>>& conflict_map = er_conflict_group.get_conflict_map();
for (std::pair<ERPin*, ERPin*>& conflict_pair : conflict_list) {
conflict_map[pin_idx_map[conflict_pair.first]].push_back(pin_idx_map[conflict_pair.second]);
}
er_conflict_group_list.push_back(er_conflict_group);
}

RTLOG.info(Loc::current(), "Completed", monitor.getStatsInfo());
}

@@ -562,7 +566,8 @@ std::vector<ERConflictPoint> EarlyRouter::getBestPointList(ERConflictGroup& er_c
curr_ap_list.push_back(conflict_point_list.front());
}
bool improved = true;
while (improved) {
int32_t iter_num = static_cast<int32_t>(conflict_point_list_list.size() * 2);
while (improved && iter_num--) {
improved = false;
for (int32_t i = 0; i < static_cast<int32_t>(conflict_point_list_list.size()); ++i) {
std::vector<int32_t> conflict_j_list;
@@ -1228,13 +1233,17 @@ std::vector<Segment<PlanarCoord>> EarlyRouter::getPlanarTopoList(ERModel& er_mod

std::vector<std::vector<Segment<PlanarCoord>>> EarlyRouter::getRoutingSegmentListList(ERModel& er_model, Segment<PlanarCoord>& planar_topo)
{
std::vector<std::function<std::vector<std::vector<Segment<PlanarCoord>>>(ERModel&, Segment<PlanarCoord>&)>> strategy_list;
strategy_list.push_back(std::bind(&EarlyRouter::getRoutingSegmentListByStraight, this, std::placeholders::_1, std::placeholders::_2));
strategy_list.push_back(std::bind(&EarlyRouter::getRoutingSegmentListByLPattern, this, std::placeholders::_1, std::placeholders::_2));
if (er_model.get_er_com_param().get_resolve_congestion() == "high") {
strategy_list.push_back(std::bind(&EarlyRouter::getRoutingSegmentListByZPattern, this, std::placeholders::_1, std::placeholders::_2));
strategy_list.push_back(std::bind(&EarlyRouter::getRoutingSegmentListByUPattern, this, std::placeholders::_1, std::placeholders::_2));
strategy_list.push_back(std::bind(&EarlyRouter::getRoutingSegmentListByInner3Bends, this, std::placeholders::_1, std::placeholders::_2));
strategy_list.push_back(std::bind(&EarlyRouter::getRoutingSegmentListByOuter3Bends, this, std::placeholders::_1, std::placeholders::_2));
}
std::vector<std::vector<Segment<PlanarCoord>>> routing_segment_list_list;
for (auto getRoutingSegmentList : {std::bind(&EarlyRouter::getRoutingSegmentListByStraight, this, std::placeholders::_1, std::placeholders::_2),
std::bind(&EarlyRouter::getRoutingSegmentListByLPattern, this, std::placeholders::_1, std::placeholders::_2),
std::bind(&EarlyRouter::getRoutingSegmentListByZPattern, this, std::placeholders::_1, std::placeholders::_2),
std::bind(&EarlyRouter::getRoutingSegmentListByUPattern, this, std::placeholders::_1, std::placeholders::_2),
std::bind(&EarlyRouter::getRoutingSegmentListByInner3Bends, this, std::placeholders::_1, std::placeholders::_2),
std::bind(&EarlyRouter::getRoutingSegmentListByOuter3Bends, this, std::placeholders::_1, std::placeholders::_2)}) {
for (auto getRoutingSegmentList : strategy_list) {
for (std::vector<Segment<PlanarCoord>> routing_segment_list : getRoutingSegmentList(er_model, planar_topo)) {
routing_segment_list_list.push_back(routing_segment_list);
}


+ 2
- 2
src/operation/iRT/source/module/early_router/EarlyRouter.hpp View File

@@ -36,7 +36,7 @@ class EarlyRouter
static EarlyRouter& getInst();
static void destroyInst();
// function
void route();
void route(std::map<std::string, std::any> config_map);

private:
// self
@@ -52,7 +52,7 @@ class EarlyRouter
ERModel initERModel();
std::vector<ERNet> convertToERNetList(std::vector<Net>& net_list);
ERNet convertToERNet(Net& net);
void setERComParam(ERModel& er_model);
void setERComParam(ERModel& er_model, std::map<std::string, std::any> config_map);
void initAccessPointList(ERModel& er_model);
std::vector<LayerCoord> getAccessCoordList(ERModel& er_model, std::vector<EXTLayerRect>& pin_shape_list);
void uniformSampleCoordList(ERModel& er_model, std::vector<LayerCoord>& layer_coord_list);


+ 6
- 2
src/operation/iRT/source/module/early_router/er_data_manager/ERComParam.hpp View File

@@ -24,9 +24,10 @@ class ERComParam
{
public:
ERComParam() = default;
ERComParam(int32_t max_candidate_point_num, int32_t supply_reduction, double boundary_wire_unit, double internal_wire_unit, double internal_via_unit,
int32_t topo_spilt_length, int32_t expand_step_num, int32_t expand_step_length, double via_unit, double overflow_unit)
ERComParam(std::string resolve_congestion, int32_t max_candidate_point_num, int32_t supply_reduction, double boundary_wire_unit, double internal_wire_unit,
double internal_via_unit, int32_t topo_spilt_length, int32_t expand_step_num, int32_t expand_step_length, double via_unit, double overflow_unit)
{
_resolve_congestion = resolve_congestion;
_max_candidate_point_num = max_candidate_point_num;
_supply_reduction = supply_reduction;
_boundary_wire_unit = boundary_wire_unit;
@@ -40,6 +41,7 @@ class ERComParam
}
~ERComParam() = default;
// getter
std::string& get_resolve_congestion() { return _resolve_congestion; }
int32_t get_max_candidate_point_num() const { return _max_candidate_point_num; }
int32_t get_supply_reduction() const { return _supply_reduction; }
double get_boundary_wire_unit() const { return _boundary_wire_unit; }
@@ -51,6 +53,7 @@ class ERComParam
double get_via_unit() const { return _via_unit; }
double get_overflow_unit() const { return _overflow_unit; }
// setter
void set_resolve_congestion(std::string& resolve_congestion) { _resolve_congestion = resolve_congestion; }
void set_max_candidate_point_num(const int32_t max_candidate_point_num) { _max_candidate_point_num = max_candidate_point_num; }
void set_supply_reduction(const int32_t supply_reduction) { _supply_reduction = supply_reduction; }
void set_boundary_wire_unit(const double boundary_wire_unit) { _boundary_wire_unit = boundary_wire_unit; }
@@ -63,6 +66,7 @@ class ERComParam
void set_overflow_unit(const double overflow_unit) { _overflow_unit = overflow_unit; }

private:
std::string _resolve_congestion;
int32_t _max_candidate_point_num = -1;
int32_t _supply_reduction = -1;
double _boundary_wire_unit = -1;


+ 0
- 1
src/operation/iRT/source/module/layer_assigner/la_data_manager/LAModel.hpp View File

@@ -19,7 +19,6 @@
#include "LAComParam.hpp"
#include "LANet.hpp"
#include "LANode.hpp"
#include "PriorityQueue.hpp"

namespace irt {



+ 18
- 38
src/operation/iRT/source/module/pin_accessor/PinAccessor.cpp View File

@@ -1093,6 +1093,7 @@ void PinAccessor::buildLayerShadowMap(PABox& pa_box)

void PinAccessor::buildPANodeNeighbor(PABox& pa_box)
{
std::vector<RoutingLayer>& routing_layer_list = RTDM.getDatabase().get_routing_layer_list();
int32_t bottom_routing_layer_idx = RTDM.getConfig().bottom_routing_layer_idx;
int32_t top_routing_layer_idx = RTDM.getConfig().top_routing_layer_idx;

@@ -1104,34 +1105,20 @@ void PinAccessor::buildPANodeNeighbor(PABox& pa_box)
routing_hv = false;
}
GridMap<PANode>& pa_node_map = layer_node_map[layer_idx];
std::set<int32_t> neighbor_layer_x_axis_set;
std::set<int32_t> neighbor_layer_y_axis_set;
if (layer_idx != 0) {
neighbor_layer_x_axis_set.insert(layer_axis_map[layer_idx - 1].first.begin(), layer_axis_map[layer_idx - 1].first.end());
neighbor_layer_y_axis_set.insert(layer_axis_map[layer_idx - 1].second.begin(), layer_axis_map[layer_idx - 1].second.end());
}
if (layer_idx != static_cast<int32_t>(layer_node_map.size()) - 1) {
neighbor_layer_x_axis_set.insert(layer_axis_map[layer_idx + 1].first.begin(), layer_axis_map[layer_idx + 1].first.end());
neighbor_layer_y_axis_set.insert(layer_axis_map[layer_idx + 1].second.begin(), layer_axis_map[layer_idx + 1].second.end());
}
std::set<int32_t>& curr_axis = (routing_layer_list[layer_idx].isPreferH()) ? layer_axis_map[layer_idx].first : layer_axis_map[layer_idx].second;
for (int32_t x = 0; x < pa_node_map.get_x_size(); x++) {
for (int32_t y = 0; y < pa_node_map.get_y_size(); y++) {
std::map<Orientation, PANode*>& neighbor_node_map = pa_node_map[x][y].get_neighbor_node_map();
std::vector<RoutingLayer>& routing_layer_list = RTDM.getDatabase().get_routing_layer_list();
std::set<int32_t> neighbor_layer_x_axis_set;
std::set<int32_t> neighbor_layer_y_axis_set;
if (layer_idx != 0) {
for (int32_t x_scale : layer_axis_map[layer_idx - 1].first) {
neighbor_layer_x_axis_set.insert(x_scale);
}
for (int32_t y_scale : layer_axis_map[layer_idx - 1].second) {
neighbor_layer_y_axis_set.insert(y_scale);
}
}
if (layer_idx != static_cast<int32_t>(layer_node_map.size()) - 1) {
for (int32_t x_scale : layer_axis_map[layer_idx + 1].first) {
neighbor_layer_x_axis_set.insert(x_scale);
}
for (int32_t y_scale : layer_axis_map[layer_idx + 1].second) {
neighbor_layer_y_axis_set.insert(y_scale);
}
}
std::set<int32_t> curr_axis;
if (routing_layer_list[layer_idx].isPreferH()) {
curr_axis = layer_axis_map[layer_idx].first;
} else {
curr_axis = layer_axis_map[layer_idx].second;
}
if (routing_hv) {
if (!routing_layer_list[layer_idx].isPreferH()) {
if (RTUTIL.exist(curr_axis, pa_node_map[x][y].get_y())) {
@@ -1488,7 +1475,7 @@ bool PinAccessor::searchEnded(PABox& pa_box)

void PinAccessor::expandSearching(PABox& pa_box)
{
PriorityQueue<PANode*, std::vector<PANode*>, CmpPANodeCost>& open_queue = pa_box.get_open_queue();
OpenQueue<PANode>& open_queue = pa_box.get_open_queue();
PANode* path_head_node = pa_box.get_path_head_node();

for (auto& [orientation, neighbor_node] : path_head_node->get_neighbor_node_map()) {
@@ -1502,8 +1489,7 @@ void PinAccessor::expandSearching(PABox& pa_box)
if (neighbor_node->isOpen() && known_cost < neighbor_node->get_known_cost()) {
neighbor_node->set_known_cost(known_cost);
neighbor_node->set_parent_node(path_head_node);
// 对优先队列中的值修改了,需要重新建堆
std::make_heap(open_queue.begin(), open_queue.end(), CmpPANodeCost());
open_queue.push(neighbor_node);
} else if (neighbor_node->isNone()) {
neighbor_node->set_known_cost(known_cost);
neighbor_node->set_parent_node(path_head_node);
@@ -1584,9 +1570,7 @@ void PinAccessor::resetStartAndEnd(PABox& pa_box)

void PinAccessor::resetSinglePath(PABox& pa_box)
{
PriorityQueue<PANode*, std::vector<PANode*>, CmpPANodeCost> empty_queue;
pa_box.set_open_queue(empty_queue);

pa_box.get_open_queue().clear();
std::vector<PANode*>& single_path_visited_node_list = pa_box.get_single_path_visited_node_list();
for (PANode* visited_node : single_path_visited_node_list) {
visited_node->set_state(PANodeState::kNone);
@@ -1649,7 +1633,7 @@ void PinAccessor::resetSingleRouteTask(PABox& pa_box)

void PinAccessor::pushToOpenList(PABox& pa_box, PANode* curr_node)
{
PriorityQueue<PANode*, std::vector<PANode*>, CmpPANodeCost>& open_queue = pa_box.get_open_queue();
OpenQueue<PANode>& open_queue = pa_box.get_open_queue();
std::vector<PANode*>& single_task_visited_node_list = pa_box.get_single_task_visited_node_list();
std::vector<PANode*>& single_path_visited_node_list = pa_box.get_single_path_visited_node_list();

@@ -1661,12 +1645,8 @@ void PinAccessor::pushToOpenList(PABox& pa_box, PANode* curr_node)

PANode* PinAccessor::popFromOpenList(PABox& pa_box)
{
PriorityQueue<PANode*, std::vector<PANode*>, CmpPANodeCost>& open_queue = pa_box.get_open_queue();

PANode* node = nullptr;
if (!open_queue.empty()) {
node = open_queue.top();
open_queue.pop();
PANode* node = pa_box.get_open_queue().pop();
if (node != nullptr) {
node->set_state(PANodeState::kClose);
}
return node;


+ 4
- 4
src/operation/iRT/source/module/pin_accessor/pa_data_manager/PABox.hpp View File

@@ -18,13 +18,13 @@

#include "LayerCoord.hpp"
#include "LayerRect.hpp"
#include "OpenQueue.hpp"
#include "PABoxId.hpp"
#include "PAIterParam.hpp"
#include "PANode.hpp"
#include "PAPatch.hpp"
#include "PAShadow.hpp"
#include "PATask.hpp"
#include "PriorityQueue.hpp"
#include "ScaleAxis.hpp"
#include "Violation.hpp"

@@ -119,11 +119,11 @@ class PABox
}
void set_routing_segment_list(const std::vector<Segment<LayerCoord>>& routing_segment_list) { _routing_segment_list = routing_segment_list; }
// single path
PriorityQueue<PANode*, std::vector<PANode*>, CmpPANodeCost>& get_open_queue() { return _open_queue; }
OpenQueue<PANode>& get_open_queue() { return _open_queue; }
std::vector<PANode*>& get_single_path_visited_node_list() { return _single_path_visited_node_list; }
PANode* get_path_head_node() { return _path_head_node; }
int32_t get_end_node_list_idx() const { return _end_node_list_idx; }
void set_open_queue(const PriorityQueue<PANode*, std::vector<PANode*>, CmpPANodeCost>& open_queue) { _open_queue = open_queue; }
void set_open_queue(const OpenQueue<PANode>& open_queue) { _open_queue = open_queue; }
void set_single_path_visited_node_list(const std::vector<PANode*>& single_path_visited_node_list)
{
_single_path_visited_node_list = single_path_visited_node_list;
@@ -177,7 +177,7 @@ class PABox
std::vector<PANode*> _single_task_visited_node_list;
std::vector<Segment<LayerCoord>> _routing_segment_list;
// single path
PriorityQueue<PANode*, std::vector<PANode*>, CmpPANodeCost> _open_queue;
OpenQueue<PANode> _open_queue;
std::vector<PANode*> _single_path_visited_node_list;
PANode* _path_head_node = nullptr;
int32_t _end_node_list_idx = -1;


+ 6
- 13
src/operation/iRT/source/module/space_router/SpaceRouter.cpp View File

@@ -896,7 +896,7 @@ bool SpaceRouter::searchEnded(SRBox& sr_box)

void SpaceRouter::expandSearching(SRBox& sr_box)
{
PriorityQueue<SRNode*, std::vector<SRNode*>, CmpSRNodeCost>& open_queue = sr_box.get_open_queue();
OpenQueue<SRNode>& open_queue = sr_box.get_open_queue();
SRNode* path_head_node = sr_box.get_path_head_node();

for (auto& [orientation, neighbor_node] : path_head_node->get_neighbor_node_map()) {
@@ -910,8 +910,7 @@ void SpaceRouter::expandSearching(SRBox& sr_box)
if (neighbor_node->isOpen() && known_cost < neighbor_node->get_known_cost()) {
neighbor_node->set_known_cost(known_cost);
neighbor_node->set_parent_node(path_head_node);
// 对优先队列中的值修改了,需要重新建堆
std::make_heap(open_queue.begin(), open_queue.end(), CmpSRNodeCost());
open_queue.push(neighbor_node);
} else if (neighbor_node->isNone()) {
neighbor_node->set_known_cost(known_cost);
neighbor_node->set_parent_node(path_head_node);
@@ -992,9 +991,7 @@ void SpaceRouter::resetStartAndEnd(SRBox& sr_box)

void SpaceRouter::resetSinglePath(SRBox& sr_box)
{
PriorityQueue<SRNode*, std::vector<SRNode*>, CmpSRNodeCost> empty_queue;
sr_box.set_open_queue(empty_queue);

sr_box.get_open_queue().clear();
std::vector<SRNode*>& single_path_visited_node_list = sr_box.get_single_path_visited_node_list();
for (SRNode* visited_node : single_path_visited_node_list) {
visited_node->set_state(SRNodeState::kNone);
@@ -1058,7 +1055,7 @@ void SpaceRouter::resetSingleTask(SRBox& sr_box)

void SpaceRouter::pushToOpenList(SRBox& sr_box, SRNode* curr_node)
{
PriorityQueue<SRNode*, std::vector<SRNode*>, CmpSRNodeCost>& open_queue = sr_box.get_open_queue();
OpenQueue<SRNode>& open_queue = sr_box.get_open_queue();
std::vector<SRNode*>& single_task_visited_node_list = sr_box.get_single_task_visited_node_list();
std::vector<SRNode*>& single_path_visited_node_list = sr_box.get_single_path_visited_node_list();

@@ -1070,12 +1067,8 @@ void SpaceRouter::pushToOpenList(SRBox& sr_box, SRNode* curr_node)

SRNode* SpaceRouter::popFromOpenList(SRBox& sr_box)
{
PriorityQueue<SRNode*, std::vector<SRNode*>, CmpSRNodeCost>& open_queue = sr_box.get_open_queue();

SRNode* node = nullptr;
if (!open_queue.empty()) {
node = open_queue.top();
open_queue.pop();
SRNode* node = sr_box.get_open_queue().pop();
if (node != nullptr) {
node->set_state(SRNodeState::kClose);
}
return node;


+ 4
- 4
src/operation/iRT/source/module/space_router/sr_data_manager/SRBox.hpp View File

@@ -18,7 +18,7 @@

#include "LayerCoord.hpp"
#include "LayerRect.hpp"
#include "PriorityQueue.hpp"
#include "OpenQueue.hpp"
#include "SRBoxId.hpp"
#include "SRIterParam.hpp"
#include "SRNode.hpp"
@@ -84,11 +84,11 @@ class SRBox
}
void set_routing_segment_list(const std::vector<Segment<LayerCoord>>& routing_segment_list) { _routing_segment_list = routing_segment_list; }
// single path
PriorityQueue<SRNode*, std::vector<SRNode*>, CmpSRNodeCost>& get_open_queue() { return _open_queue; }
OpenQueue<SRNode>& get_open_queue() { return _open_queue; }
std::vector<SRNode*>& get_single_path_visited_node_list() { return _single_path_visited_node_list; }
SRNode* get_path_head_node() { return _path_head_node; }
int32_t get_end_node_list_idx() const { return _end_node_list_idx; }
void set_open_queue(const PriorityQueue<SRNode*, std::vector<SRNode*>, CmpSRNodeCost>& open_queue) { _open_queue = open_queue; }
void set_open_queue(const OpenQueue<SRNode>& open_queue) { _open_queue = open_queue; }
void set_single_path_visited_node_list(const std::vector<SRNode*>& single_path_visited_node_list)
{
_single_path_visited_node_list = single_path_visited_node_list;
@@ -119,7 +119,7 @@ class SRBox
std::vector<SRNode*> _single_task_visited_node_list;
std::vector<Segment<LayerCoord>> _routing_segment_list;
// single path
PriorityQueue<SRNode*, std::vector<SRNode*>, CmpSRNodeCost> _open_queue;
OpenQueue<SRNode> _open_queue;
std::vector<SRNode*> _single_path_visited_node_list;
SRNode* _path_head_node = nullptr;
int32_t _end_node_list_idx = -1;


+ 6
- 13
src/operation/iRT/source/module/track_assigner/TrackAssigner.cpp View File

@@ -629,7 +629,7 @@ bool TrackAssigner::searchEnded(TAPanel& ta_panel)

void TrackAssigner::expandSearching(TAPanel& ta_panel)
{
PriorityQueue<TANode*, std::vector<TANode*>, CmpTANodeCost>& open_queue = ta_panel.get_open_queue();
OpenQueue<TANode>& open_queue = ta_panel.get_open_queue();
TANode* path_head_node = ta_panel.get_path_head_node();

for (auto& [orientation, neighbor_node] : path_head_node->get_neighbor_node_map()) {
@@ -646,8 +646,7 @@ void TrackAssigner::expandSearching(TAPanel& ta_panel)
if (neighbor_node->isOpen() && known_cost < neighbor_node->get_known_cost()) {
neighbor_node->set_known_cost(known_cost);
neighbor_node->set_parent_node(path_head_node);
// 对优先队列中的值修改了,需要重新建堆
std::make_heap(open_queue.begin(), open_queue.end(), CmpTANodeCost());
open_queue.push(neighbor_node);
} else if (neighbor_node->isNone()) {
neighbor_node->set_known_cost(known_cost);
neighbor_node->set_parent_node(path_head_node);
@@ -728,9 +727,7 @@ void TrackAssigner::resetStartAndEnd(TAPanel& ta_panel)

void TrackAssigner::resetSinglePath(TAPanel& ta_panel)
{
PriorityQueue<TANode*, std::vector<TANode*>, CmpTANodeCost> empty_queue;
ta_panel.set_open_queue(empty_queue);

ta_panel.get_open_queue().clear();
std::vector<TANode*>& single_path_visited_node_list = ta_panel.get_single_path_visited_node_list();
for (TANode* visited_node : single_path_visited_node_list) {
visited_node->set_state(TANodeState::kNone);
@@ -798,7 +795,7 @@ void TrackAssigner::resetSingleTask(TAPanel& ta_panel)

void TrackAssigner::pushToOpenList(TAPanel& ta_panel, TANode* curr_node)
{
PriorityQueue<TANode*, std::vector<TANode*>, CmpTANodeCost>& open_queue = ta_panel.get_open_queue();
OpenQueue<TANode>& open_queue = ta_panel.get_open_queue();
std::vector<TANode*>& single_task_visited_node_list = ta_panel.get_single_task_visited_node_list();
std::vector<TANode*>& single_path_visited_node_list = ta_panel.get_single_path_visited_node_list();

@@ -810,12 +807,8 @@ void TrackAssigner::pushToOpenList(TAPanel& ta_panel, TANode* curr_node)

TANode* TrackAssigner::popFromOpenList(TAPanel& ta_panel)
{
PriorityQueue<TANode*, std::vector<TANode*>, CmpTANodeCost>& open_queue = ta_panel.get_open_queue();

TANode* node = nullptr;
if (!open_queue.empty()) {
node = open_queue.top();
open_queue.pop();
TANode* node = ta_panel.get_open_queue().pop();
if (node != nullptr) {
node->set_state(TANodeState::kClose);
}
return node;


+ 4
- 4
src/operation/iRT/source/module/track_assigner/ta_data_manager/TAPanel.hpp View File

@@ -17,7 +17,7 @@
#pragma once

#include "LayerRect.hpp"
#include "PriorityQueue.hpp"
#include "OpenQueue.hpp"
#include "RTHeader.hpp"
#include "ScaleAxis.hpp"
#include "TAComParam.hpp"
@@ -77,11 +77,11 @@ class TAPanel
}
void set_routing_segment_list(const std::vector<Segment<LayerCoord>>& routing_segment_list) { _routing_segment_list = routing_segment_list; }
// single path
PriorityQueue<TANode*, std::vector<TANode*>, CmpTANodeCost>& get_open_queue() { return _open_queue; }
OpenQueue<TANode>& get_open_queue() { return _open_queue; }
std::vector<TANode*>& get_single_path_visited_node_list() { return _single_path_visited_node_list; }
TANode* get_path_head_node() { return _path_head_node; }
int32_t get_end_node_list_idx() const { return _end_node_list_idx; }
void set_open_queue(const PriorityQueue<TANode*, std::vector<TANode*>, CmpTANodeCost>& open_queue) { _open_queue = open_queue; }
void set_open_queue(const OpenQueue<TANode>& open_queue) { _open_queue = open_queue; }
void set_single_path_visited_node_list(const std::vector<TANode*>& single_path_visited_node_list)
{
_single_path_visited_node_list = single_path_visited_node_list;
@@ -111,7 +111,7 @@ class TAPanel
std::vector<TANode*> _single_task_visited_node_list;
std::vector<Segment<LayerCoord>> _routing_segment_list;
// single path
PriorityQueue<TANode*, std::vector<TANode*>, CmpTANodeCost> _open_queue;
OpenQueue<TANode> _open_queue;
std::vector<TANode*> _single_path_visited_node_list;
TANode* _path_head_node = nullptr;
int32_t _end_node_list_idx = -1;


Loading…
Cancel
Save
Baidu
map