Fixed a problem with via uniquification - via definitions may be DEF local, so we need to clean them between different DEF reads.

This commit is contained in:
Matthias Koefferlein 2025-05-18 00:48:10 +02:00
parent 8221923ccb
commit a07d742bee
3 changed files with 25 additions and 1 deletions

View File

@ -1182,8 +1182,10 @@ DEFImporter::read_vias (db::Layout &layout, db::Cell & /*design*/, double scale)
if (rule_based_vg.get () && geo_based_vg.get ()) {
error (tl::to_string (tr ("A via can only be defined through a VIARULE or geometry, not both ways")));
} else if (rule_based_vg.get ()) {
rule_based_vg->def_local = true;
reader_state ()->register_via_cell (n, std::string (), rule_based_vg.release ());
} else if (geo_based_vg.get ()) {
geo_based_vg->def_local = true;
reader_state ()->register_via_cell (n, std::string (), geo_based_vg.release ());
} else {
error (tl::to_string (tr ("Too little information to generate a via")));

View File

@ -1810,9 +1810,29 @@ std::set<unsigned int> LEFDEFReaderState::open_layer_uncached(db::Layout &layout
void
LEFDEFReaderState::start ()
{
// Start over for a new DEF file - this function is used in LEF context mode
// i.e. when LEFs are cached during multiple DEF reads. It is called when a new DEF is read.
CommonReaderBase::start ();
m_foreign_cells.clear ();
// Remove the via generators that were added by DEF
// TODO: there is no concept for "local LEFs" currently. Even LEFs stored along
// with DEFs are considered "global".
for (auto vg = m_via_generators.begin (); vg != m_via_generators.end (); ) {
auto vg_here = vg;
++vg;
if (vg_here->second->def_local) {
delete vg_here->second;
m_via_generators.erase (vg_here);
}
}
// We always create fresh via cells for different DEFs to avoid potential
// content conflicts. Problem is: vias can be generated by both LEF (global)
// and DEF (local)
m_via_cells.clear ();
}
void

View File

@ -1141,12 +1141,14 @@ public:
class DB_PLUGIN_PUBLIC LEFDEFLayoutGenerator
{
public:
LEFDEFLayoutGenerator () { }
LEFDEFLayoutGenerator () : def_local (false) { }
virtual ~LEFDEFLayoutGenerator () { }
virtual void create_cell (LEFDEFReaderState &reader, db::Layout &layout, db::Cell &cell, const std::vector<std::string> *maskshift_layers, const std::vector<unsigned int> &masks, const LEFDEFNumberOfMasks *nm) = 0;
virtual std::vector<std::string> maskshift_layers () const = 0;
virtual bool is_fixedmask () const = 0;
bool def_local;
};
/**