Important bug fix for LVS

It's very important for LVS to use the same compare delegates
for layout and schematic. Otherwise the sorting of the devices
won't be identical and fake mismatches will occure.
This is achieved in a bit hacky way to imposing the layout
compare delegates to the schematic netlist.
This commit is contained in:
Matthias Koefferlein 2021-03-15 15:40:02 +01:00
parent af4395e9a8
commit 738e830c8d
2 changed files with 36 additions and 0 deletions

View File

@ -252,6 +252,7 @@ public:
DeviceParameterCompareDelegate () { }
virtual ~DeviceParameterCompareDelegate () { }
virtual DeviceParameterCompareDelegate *clone () const = 0;
virtual bool less (const db::Device &a, const db::Device &b) const = 0;
virtual bool equal (const db::Device &a, const db::Device &b) const = 0;
};
@ -273,6 +274,11 @@ public:
virtual bool less (const db::Device &a, const db::Device &b) const;
virtual bool equal (const db::Device &a, const db::Device &b) const;
virtual DeviceParameterCompareDelegate *clone () const
{
return new EqualDeviceParameters (*this);
}
EqualDeviceParameters &operator+= (const EqualDeviceParameters &other);
EqualDeviceParameters operator+ (const EqualDeviceParameters &other) const
@ -298,6 +304,11 @@ public:
virtual bool less (const db::Device &a, const db::Device &b) const;
virtual bool equal (const db::Device &a, const db::Device &b) const;
virtual DeviceParameterCompareDelegate *clone () const
{
return new AllDeviceParametersAreEqual (*this);
}
private:
double m_relative;
};
@ -574,6 +585,14 @@ public:
/**
* @brief Gets the parameter compare delegate or null if no such delegate is registered
*/
const db::DeviceParameterCompareDelegate *parameter_compare_delegate () const
{
return mp_pc_delegate.get ();
}
/**
* @brief Gets the parameter compare delegate or null if no such delegate is registered (non-const version)
*/
db::DeviceParameterCompareDelegate *parameter_compare_delegate ()
{
return mp_pc_delegate.get ();

View File

@ -2991,6 +2991,23 @@ NetlistComparer::compare (const db::Netlist *a, const db::Netlist *b) const
}
}
// impose the compare tolerances of the layout (first netlist) on the schematic (second netlist)
// TODO: this is kind of clumsy. But it's very important to use the same device sorting for both netlists, so we play this trick.
// A better solution was to have a common compare framework for both netlists.
for (std::map<size_t, std::pair<const db::DeviceClass *, const db::DeviceClass *> >::const_iterator i = cat2dc.begin (); i != cat2dc.end (); ++i) {
if (i->second.first && i->second.second) {
const db::DeviceClass *da = i->second.first;
db::DeviceClass *db = const_cast<db::DeviceClass *> (i->second.second);
const db::DeviceParameterCompareDelegate *cmp = da->parameter_compare_delegate ();
db->set_parameter_compare_delegate (cmp ? cmp->clone () : 0);
}
}
// device whether to use a device category in strict mode
device_categorizer.clear_strict_device_categories ();