WIP: bugfix of refactoriung, update test data.

This commit is contained in:
Matthias Koefferlein 2019-12-15 00:16:47 +01:00
parent 1e5d02b1bc
commit da1ac3661f
12 changed files with 38 additions and 16 deletions

View File

@ -1518,8 +1518,6 @@ private:
db::ICplxTrans t1i = t1.inverted (); db::ICplxTrans t1i = t1.inverted ();
db::ICplxTrans t2i = t2.inverted (); db::ICplxTrans t2i = t2.inverted ();
std::list<std::pair<ClusterInstance, ClusterInstance> > ii_interactions;
// @@@ optimize for single inst? // @@@ optimize for single inst?
for (db::CellInstArray::iterator ii1 = i1element.at_end () ? i1.begin_touching (common_all.transformed (t1i), mp_layout) : i1element; ! ii1.at_end (); ++ii1) { for (db::CellInstArray::iterator ii1 = i1element.at_end () ? i1.begin_touching (common_all.transformed (t1i), mp_layout) : i1element; ! ii1.at_end (); ++ii1) {
@ -1553,6 +1551,7 @@ private:
const db::Cell &cell2 = mp_layout->cell (i2.cell_index ()); const db::Cell &cell2 = mp_layout->cell (i2.cell_index ());
for (db::Cell::touching_iterator jj2 = cell2.begin_touching (common12.transformed (tt2.inverted ())); ! jj2.at_end (); ++jj2) { for (db::Cell::touching_iterator jj2 = cell2.begin_touching (common12.transformed (tt2.inverted ())); ! jj2.at_end (); ++jj2) {
std::list<std::pair<ClusterInstance, ClusterInstance> > ii_interactions;
consider_instance_pair (common12, i1, t1, ii1, *jj2, tt2, db::CellInstArray::iterator (), ii_interactions); consider_instance_pair (common12, i1, t1, ii1, *jj2, tt2, db::CellInstArray::iterator (), ii_interactions);
for (std::list<std::pair<ClusterInstance, ClusterInstance> >::iterator i = ii_interactions.begin (); i != ii_interactions.end (); ++i) { for (std::list<std::pair<ClusterInstance, ClusterInstance> >::iterator i = ii_interactions.begin (); i != ii_interactions.end (); ++i) {
@ -1577,6 +1576,7 @@ private:
const db::Cell &cell1 = mp_layout->cell (i1.cell_index ()); const db::Cell &cell1 = mp_layout->cell (i1.cell_index ());
for (db::Cell::touching_iterator jj1 = cell1.begin_touching (common1.transformed (tt1.inverted ())); ! jj1.at_end (); ++jj1) { for (db::Cell::touching_iterator jj1 = cell1.begin_touching (common1.transformed (tt1.inverted ())); ! jj1.at_end (); ++jj1) {
std::list<std::pair<ClusterInstance, ClusterInstance> > ii_interactions;
consider_instance_pair (common1, *jj1, tt1, db::CellInstArray::iterator (), i2, t2, i2element, ii_interactions); consider_instance_pair (common1, *jj1, tt1, db::CellInstArray::iterator (), i2, t2, i2element, ii_interactions);
for (std::list<std::pair<ClusterInstance, ClusterInstance> >::iterator i = ii_interactions.begin (); i != ii_interactions.end (); ++i) { for (std::list<std::pair<ClusterInstance, ClusterInstance> >::iterator i = ii_interactions.begin (); i != ii_interactions.end (); ++i) {

View File

@ -734,6 +734,30 @@ private:
typedef std::list<std::pair<ClusterInstance, ClusterInstance> > cluster_instance_pair_list_type; typedef std::list<std::pair<ClusterInstance, ClusterInstance> > cluster_instance_pair_list_type;
inline bool equal_array_delegates (const db::ArrayBase *a, const db::ArrayBase *b)
{
if ((a == 0) != (b == 0)) {
return false;
} else if (a) {
static const db::array_base_ptr_cmp_f arr_less;
return ! arr_less (a, b) && ! arr_less (b, a);
} else {
return true;
}
}
inline bool less_array_delegates (const db::ArrayBase *a, const db::ArrayBase *b)
{
if ((a == 0) != (b == 0)) {
return (a == 0) < (b == 0);
} else if (a) {
static const db::array_base_ptr_cmp_f arr_less;
return arr_less (a, b);
} else {
return false;
}
}
/** /**
* @brief A helper struct to describe a pair of cell instances with a specific relative transformation * @brief A helper struct to describe a pair of cell instances with a specific relative transformation
*/ */
@ -747,7 +771,8 @@ struct InstanceToInstanceInteraction
{ {
static const db::array_base_ptr_cmp_f arr_less; static const db::array_base_ptr_cmp_f arr_less;
return ci1 == other.ci1 && ci2 == other.ci2 && t21.equal (other.t21) && return ci1 == other.ci1 && ci2 == other.ci2 && t21.equal (other.t21) &&
(array1 == 0) == (array2 == 0) && array1 != 0 && ! arr_less (array1, array2) && ! arr_less (array2, array1); equal_array_delegates (array1, other.array1) &&
equal_array_delegates (array2, other.array2);
} }
bool operator< (const InstanceToInstanceInteraction &other) const bool operator< (const InstanceToInstanceInteraction &other) const
@ -761,15 +786,12 @@ struct InstanceToInstanceInteraction
if (! t21.equal (other.t21)) { if (! t21.equal (other.t21)) {
return t21.less (other.t21); return t21.less (other.t21);
} }
if ((array1 == 0) != (array2 == 0)) { if (less_array_delegates (array1, other.array1)) {
return (array1 == 0) < (array2 == 0); return true;
} } else if (less_array_delegates (other.array1, array1)) {
if (array1 != 0) {
static const db::array_base_ptr_cmp_f arr_less;
return arr_less (array1, array2);
} else {
return false; return false;
} }
return less_array_delegates (array2, other.array2);
} }
db::cell_index_type ci1, ci2; db::cell_index_type ci1, ci2;

View File

@ -791,7 +791,7 @@ TEST(2_Probing)
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I18"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I18");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I5"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I3");
// doesn't do anything here, but we test that this does not destroy anything: // doesn't do anything here, but we test that this does not destroy anything:
l2n.netlist ()->combine_devices (); l2n.netlist ()->combine_devices ();
@ -833,7 +833,7 @@ TEST(2_Probing)
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I18"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I18");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I5"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I3");
} }
TEST(3_GlobalNetConnections) TEST(3_GlobalNetConnections)
@ -1071,7 +1071,7 @@ TEST(3_GlobalNetConnections)
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I22"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I22");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I6"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I4");
// doesn't do anything here, but we test that this does not destroy anything: // doesn't do anything here, but we test that this does not destroy anything:
l2n.netlist ()->combine_devices (); l2n.netlist ()->combine_devices ();
@ -1113,7 +1113,7 @@ TEST(3_GlobalNetConnections)
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I22"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I22");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I6"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I4");
} }
TEST(4_GlobalNetDeviceExtraction) TEST(4_GlobalNetDeviceExtraction)
@ -1357,7 +1357,7 @@ TEST(4_GlobalNetDeviceExtraction)
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I22"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I22");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I6"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I4");
// doesn't do anything here, but we test that this does not destroy anything: // doesn't do anything here, but we test that this does not destroy anything:
l2n.netlist ()->combine_devices (); l2n.netlist ()->combine_devices ();
@ -1399,7 +1399,7 @@ TEST(4_GlobalNetDeviceExtraction)
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VSS");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I22"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I22");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I6"); EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "INV2PAIR:$I4");
} }
TEST(5_DeviceExtractionWithDeviceCombination) TEST(5_DeviceExtractionWithDeviceCombination)

Binary file not shown.

Binary file not shown.

Binary file not shown.