WIP: fixed unit tests, bug fix in DeepRegion -> and and not shall return a DeepRegion always.

This commit is contained in:
Matthias Koefferlein 2019-06-24 20:56:20 +02:00
parent 33bb85e4f3
commit 37012efba0
6 changed files with 36 additions and 15 deletions

View File

@ -23,7 +23,6 @@
#include "dbDeepRegion.h"
#include "dbDeepShapeStore.h"
#include "dbEmptyRegion.h"
#include "dbEmptyEdgePairs.h"
#include "dbRegion.h"
#include "dbRegionUtils.h"
@ -462,10 +461,13 @@ DeepRegion::and_with (const Region &other) const
{
const DeepRegion *other_deep = dynamic_cast <const DeepRegion *> (other.delegate ());
if (empty () || other.empty ()) {
if (empty ()) {
// Nothing to do
return new EmptyRegion ();
return clone ();
} else if (other.empty ()) {
return other.delegate ()->clone ();
} else if (! other_deep) {
@ -483,14 +485,8 @@ DeepRegion::not_with (const Region &other) const
{
const DeepRegion *other_deep = dynamic_cast <const DeepRegion *> (other.delegate ());
if (empty ()) {
if (empty () || other.empty ()) {
// Nothing to do
return new EmptyRegion ();
} else if (other.empty ()) {
// Nothing to do
return clone ();
} else if (! other_deep) {
@ -1231,6 +1227,12 @@ DeepRegion::merged (bool min_coherence, unsigned int min_wc) const
RegionDelegate *
DeepRegion::sized (coord_type d, unsigned int mode) const
{
if (empty ()) {
// Nothing to do - NOTE: don't return EmptyRegion because we want to
// maintain "deepness"
return clone ();
}
ensure_merged_polygons_valid ();
db::Layout &layout = m_merged_polygons.layout ();
@ -1299,6 +1301,12 @@ struct XYAnisotropyAndMagnificationReducer
RegionDelegate *
DeepRegion::sized (coord_type dx, coord_type dy, unsigned int mode) const
{
if (empty ()) {
// Nothing to do - NOTE: don't return EmptyRegion because we want to
// maintain "deepness"
return clone ();
}
if (dx == dy) {
return sized (dx, mode);
}

View File

@ -232,6 +232,13 @@ Region::Region (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db:
mp_delegate = new DeepRegion (si, dss, trans, merged_semantics, area_ratio, max_vertex_count);
}
Region::Region (DeepShapeStore &dss)
{
tl_assert (dss.is_singular ());
unsigned int layout_index = 0; // singular layout index
mp_delegate = new db::DeepRegion (db::DeepLayer (&dss, layout_index, dss.layout (layout_index).insert_layer ()));
}
const db::RecursiveShapeIterator &
Region::iter () const
{

View File

@ -345,6 +345,12 @@ public:
*/
explicit Region (const RecursiveShapeIterator &si, DeepShapeStore &dss, const db::ICplxTrans &trans, bool merged_semantics = true, double area_ratio = 3.0, size_t max_vertex_count = 16);
/**
* @brief Creates a new empty layer inside the dss
* This method requires the DSS to be singular.
*/
explicit Region (DeepShapeStore &dss);
/**
* @brief Gets the underlying delegate object
*/

View File

@ -1136,7 +1136,7 @@ TEST(5_ResAndCapWithBulkExtraction)
db::Region rmetal2_lbl (db::RecursiveShapeIterator (ly, tc, metal2_lbl), dss);
db::Region rcap (db::RecursiveShapeIterator (ly, tc, cap), dss);
db::Region rres (db::RecursiveShapeIterator (ly, tc, res), dss);
db::Region rbulk;
db::Region rbulk (dss);
// derived regions
@ -1409,7 +1409,7 @@ TEST(6_BJT3TransistorExtraction)
db::Region rmetal2_lbl (db::RecursiveShapeIterator (ly, tc, metal2_lbl), dss);
db::Region rpplus (db::RecursiveShapeIterator (ly, tc, pplus), dss);
db::Region rnplus (db::RecursiveShapeIterator (ly, tc, nplus), dss);
db::Region rbulk;
db::Region rbulk (dss);
// derived regions

View File

@ -400,7 +400,7 @@ module DRC
id = data.data_id
if @layers[id]
if @layers && @layers[id]
# already registered
return
end

View File

@ -54,7 +54,7 @@ connect(metal2, metal2_lbl)
# Actually performs the extraction
join_nets("{VDDZ,VSSZ,NEXT,FB}")
connect_implicit("{VDDZ,VSSZ,NEXT,FB}")
netlist = l2n_data.netlist