More debugging support

This commit is contained in:
Matthias Koefferlein 2025-04-24 22:01:56 +02:00
parent 8ece7bcce1
commit f0943dea53
5 changed files with 53 additions and 9 deletions

View File

@ -400,16 +400,19 @@ Class<pex::RNetwork> decl_RNetwork ("pex", "RNetwork",
"This class has been introduced in version 0.30.1\n" "This class has been introduced in version 0.30.1\n"
); );
static pex::RExtractor *new_sqc_rextractor (double dbu) static pex::RExtractor *new_sqc_rextractor (double dbu, bool skip_simplify)
{ {
return new pex::SquareCountingRExtractor (dbu); auto res = new pex::SquareCountingRExtractor (dbu);
res->set_skip_simplfy (skip_simplify);
return res;
} }
static pex::RExtractor *new_tesselation_rextractor (double dbu, double min_b, double max_area) static pex::RExtractor *new_tesselation_rextractor (double dbu, double min_b, double max_area, bool skip_reduction)
{ {
auto res = new pex::TriangulationRExtractor (dbu); auto res = new pex::TriangulationRExtractor (dbu);
res->triangulation_parameters ().min_b = min_b; res->triangulation_parameters ().min_b = min_b;
res->triangulation_parameters ().max_area = max_area; res->triangulation_parameters ().max_area = max_area;
res->set_skip_reduction (skip_reduction);
return res; return res;
} }
@ -421,7 +424,7 @@ static pex::RNetwork *extract_ipolygon (pex::RExtractor *rex, const db::Polygon
} }
Class<pex::RExtractor> decl_RExtractor ("pex", "RExtractor", Class<pex::RExtractor> decl_RExtractor ("pex", "RExtractor",
gsi::constructor ("square_counting_extractor", &new_sqc_rextractor, gsi::arg ("dbu"), gsi::constructor ("square_counting_extractor", &new_sqc_rextractor, gsi::arg ("dbu"), gsi::arg ("skip_simplify", false),
"@brief Creates a square counting R extractor\n" "@brief Creates a square counting R extractor\n"
"The square counting extractor extracts resistances from a polygon with ports using the following approach:\n" "The square counting extractor extracts resistances from a polygon with ports using the following approach:\n"
"\n" "\n"
@ -440,9 +443,10 @@ Class<pex::RExtractor> decl_RExtractor ("pex", "RExtractor",
"values, multiply the element resistance values by the sheet resistance.\n" "values, multiply the element resistance values by the sheet resistance.\n"
"\n" "\n"
"@param dbu The database unit of the polygons the extractor will work on\n" "@param dbu The database unit of the polygons the extractor will work on\n"
"@param skip_simplify If true, the final step to simplify the netlist will be skipped. This feature is for testing mainly.\n"
"@return A new \\RExtractor object that implements the square counting extractor\n" "@return A new \\RExtractor object that implements the square counting extractor\n"
) + ) +
gsi::constructor ("tesselation_extractor", &new_tesselation_rextractor, gsi::arg ("dbu"), gsi::arg ("min_b", 0.3), gsi::arg ("max_area", 0.0), gsi::constructor ("tesselation_extractor", &new_tesselation_rextractor, gsi::arg ("dbu"), gsi::arg ("min_b", 0.3), gsi::arg ("max_area", 0.0), gsi::arg ("skip_reduction", false),
"@brief Creates a tesselation R extractor\n" "@brief Creates a tesselation R extractor\n"
"The tesselation extractor starts with a triangulation of the original polygon. The triangulation is " "The tesselation extractor starts with a triangulation of the original polygon. The triangulation is "
"turned into a resistor network and simplified.\n" "turned into a resistor network and simplified.\n"
@ -464,6 +468,7 @@ Class<pex::RExtractor> decl_RExtractor ("pex", "RExtractor",
"@param dbu The database unit of the polygons the extractor will work on\n" "@param dbu The database unit of the polygons the extractor will work on\n"
"@param min_b Defines the min 'b' value of the refined Delaunay triangulation (see \\Polygon#delaunay)\n" "@param min_b Defines the min 'b' value of the refined Delaunay triangulation (see \\Polygon#delaunay)\n"
"@param max_area Defines maximum area value of the refined Delaunay triangulation (see \\Polygon#delaunay). The value is given in square micrometer units.\n" "@param max_area Defines maximum area value of the refined Delaunay triangulation (see \\Polygon#delaunay). The value is given in square micrometer units.\n"
"@param skip_reduction If true, the reduction step for the netlist will be skipped. This feature is for testing mainly. The resulting R graph will contain all the original triangles and the internal nodes representing the vertexes.\n"
"@return A new \\RExtractor object that implements the square counting extractor\n" "@return A new \\RExtractor object that implements the square counting extractor\n"
) + ) +
gsi::factory_ext ("extract", &extract_ipolygon, gsi::arg ("polygon"), gsi::arg ("vertex_ports", std::vector<db::Point> (), "[]"), gsi::arg ("polygon_ports", std::vector<db::Polygon> (), "[]"), gsi::factory_ext ("extract", &extract_ipolygon, gsi::arg ("polygon"), gsi::arg ("vertex_ports", std::vector<db::Point> (), "[]"), gsi::arg ("polygon_ports", std::vector<db::Polygon> (), "[]"),

View File

@ -71,6 +71,7 @@ struct JoinEdgeSets
SquareCountingRExtractor::SquareCountingRExtractor (double dbu) SquareCountingRExtractor::SquareCountingRExtractor (double dbu)
{ {
m_dbu = dbu; m_dbu = dbu;
m_skip_simplify = false;
m_decomp_param.split_edges = true; m_decomp_param.split_edges = true;
m_decomp_param.with_segments = false; m_decomp_param.with_segments = false;
@ -162,8 +163,7 @@ SquareCountingRExtractor::do_extract (const db::Polygon &db_poly, const std::vec
++em; ++em;
} }
// @@@ TODO: multiply with sheet rho! // TODO: width dependency?
// @@@ TODO: width dependency
if (r == 0) { if (r == 0) {
rnetwork.create_element (pex::RElement::short_value (), pl->second, pl_next->second); rnetwork.create_element (pex::RElement::short_value (), pl->second, pl_next->second);
} else { } else {
@ -292,8 +292,10 @@ SquareCountingRExtractor::extract (const db::Polygon &polygon, const std::vector
} }
if (! m_skip_simplify) {
rnetwork.simplify (); rnetwork.simplify ();
} }
}
} }

View File

@ -64,6 +64,22 @@ public:
return m_decomp_param; return m_decomp_param;
} }
/**
* @brief Sets a value indicating whether to skip the simplify step
*/
void set_skip_simplfy (bool f)
{
m_skip_simplify = f;
}
/**
* @brief Gets a value indicating whether to skip the simplify step
*/
bool skip_simplify () const
{
return m_skip_simplify;
}
/** /**
* @brief Sets the database unit * @brief Sets the database unit
*/ */
@ -129,6 +145,7 @@ protected:
private: private:
db::plc::ConvexDecompositionParameters m_decomp_param; db::plc::ConvexDecompositionParameters m_decomp_param;
double m_dbu; double m_dbu;
bool m_skip_simplify;
}; };
} }

View File

@ -32,6 +32,7 @@ namespace pex
TriangulationRExtractor::TriangulationRExtractor (double dbu) TriangulationRExtractor::TriangulationRExtractor (double dbu)
{ {
m_dbu = dbu; m_dbu = dbu;
m_skip_reduction = false;
m_tri_param.min_b = 0.3; m_tri_param.min_b = 0.3;
m_tri_param.max_area = 0.0; m_tri_param.max_area = 0.0;
@ -206,8 +207,10 @@ TriangulationRExtractor::extract (const db::Polygon &polygon, const std::vector<
// eliminate internal nodes // eliminate internal nodes
if (! m_skip_reduction) {
eliminate_all (rnetwork); eliminate_all (rnetwork);
} }
}
void void
TriangulationRExtractor::create_conductances (const db::plc::Polygon &tri, const std::unordered_map<const db::plc::Vertex *, pex::RNode *> &vertex2node, RNetwork &rnetwork) TriangulationRExtractor::create_conductances (const db::plc::Polygon &tri, const std::unordered_map<const db::plc::Vertex *, pex::RNode *> &vertex2node, RNetwork &rnetwork)

View File

@ -65,6 +65,22 @@ public:
return m_tri_param; return m_tri_param;
} }
/**
* @brief Sets a value indicating whether to skip the reduction step
*/
void set_skip_reduction (bool f)
{
m_skip_reduction = f;
}
/**
* @brief Gets a value indicating whether to skip the reduction step
*/
bool skip_reduction () const
{
return m_skip_reduction;
}
/** /**
* @brief Sets the database unit * @brief Sets the database unit
*/ */
@ -89,6 +105,7 @@ public:
private: private:
db::plc::TriangulationParameters m_tri_param; db::plc::TriangulationParameters m_tri_param;
double m_dbu; double m_dbu;
bool m_skip_reduction;
void create_conductances (const db::plc::Polygon &tri, const std::unordered_map<const db::plc::Vertex *, RNode *> &vertex2node, RNetwork &rnetwork); void create_conductances (const db::plc::Polygon &tri, const std::unordered_map<const db::plc::Vertex *, RNode *> &vertex2node, RNetwork &rnetwork);
void eliminate_node (pex::RNode *node, RNetwork &rnetwork); void eliminate_node (pex::RNode *node, RNetwork &rnetwork);