Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 26 additions & 28 deletions src/db/db/dbHierNetworkProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

*/


#include "dbHierNetworkProcessor.h"
#include "dbShape.h"
#include "dbShapes.h"
Expand Down Expand Up @@ -1794,7 +1793,7 @@ class DB_PUBLIC cell_clusters_box_converter
cell_clusters_box_converter (const db::Layout &layout, const hier_clusters<T> &tree)
: mp_layout (&layout), mp_tree (&tree)
{
// .. nothing yet ..
m_cache.resize (layout.cells (), 0);
}

const box_type &operator() (const db::CellInst &cell_inst) const
Expand All @@ -1804,10 +1803,10 @@ class DB_PUBLIC cell_clusters_box_converter

const box_type &operator() (db::cell_index_type cell_index) const
{
typename std::map<db::cell_index_type, box_type>::const_iterator b = m_cache.find (cell_index);
if (b != m_cache.end ()) {
const box_type *b = m_cache [cell_index];
if (b) {

return b->second;
return *b;

} else {

Expand All @@ -1820,13 +1819,17 @@ class DB_PUBLIC cell_clusters_box_converter
box += inst_array.bbox (*this);
}

return m_cache.insert (std::make_pair (cell_index, box)).first->second;
m_cached_boxes.push_front (box);
b = m_cached_boxes.begin ().operator-> ();
m_cache [cell_index] = b;
return *b;

}
}

private:
mutable std::map<db::cell_index_type, box_type> m_cache;
mutable std::vector<const box_type *> m_cache;
mutable tl::slist<box_type> m_cached_boxes;
const db::Layout *mp_layout;
const hier_clusters<T> *mp_tree;
};
Expand Down Expand Up @@ -1993,10 +1996,10 @@ struct hc_receiver
}

/**
* @brief Finally join the clusters in the join set
* @brief Finally generate cluster-to-instance interactions and join the clusters in the join set
*
* This step is postponed because doing this while the iteration happens would
* invalidate the box trees.
* invalidate the box trees and disturb the propagation mechanism.
*/
void finish_cluster_to_instance_interactions ()
{
Expand Down Expand Up @@ -2081,7 +2084,7 @@ struct hc_receiver
const db::Connectivity *mp_conn;
const std::set<db::cell_index_type> *mp_breakout_cells;
typedef std::list<std::set<id_type> > join_set_list;
std::map<id_type, typename join_set_list::iterator> m_cm2join_map;
std::unordered_map<id_type, typename join_set_list::iterator> m_cm2join_map;
join_set_list m_cm2join_sets;
std::map<std::pair<size_t, size_t>, int> m_soft_connections;
std::list<ClusterInstanceInteraction> m_ci_interactions;
Expand Down Expand Up @@ -2551,8 +2554,8 @@ struct hc_receiver
return;
}

typename std::map<id_type, typename join_set_list::iterator>::const_iterator x = m_cm2join_map.find (a);
typename std::map<id_type, typename join_set_list::iterator>::const_iterator y = m_cm2join_map.find (b);
typename std::unordered_map<id_type, typename join_set_list::iterator>::const_iterator x = m_cm2join_map.find (a);
typename std::unordered_map<id_type, typename join_set_list::iterator>::const_iterator y = m_cm2join_map.find (b);

if (x == m_cm2join_map.end ()) {

Expand All @@ -2579,6 +2582,11 @@ struct hc_receiver

} else if (x->second != y->second) {

// the y set should be the smaller one for better efficiency
if (x->second->size () < y->second->size ()) {
std::swap (x, y);
}

// join two superclusters
typename join_set_list::iterator yset = y->second;
x->second->insert (yset->begin (), yset->end ());
Expand All @@ -2591,21 +2599,21 @@ struct hc_receiver

#if defined(DEBUG_HIER_NETWORK_PROCESSOR)
// concistency check for debugging
for (typename std::map<id_type, typename join_set_list::iterator>::const_iterator j = m_cm2join_map.begin (); j != m_cm2join_map.end (); ++j) {
for (auto j = m_cm2join_map.begin (); j != m_cm2join_map.end (); ++j) {
tl_assert (j->second->find (j->first) != j->second->end ());
}

for (typename std::list<std::set<id_type> >::const_iterator i = m_cm2join_sets.begin (); i != m_cm2join_sets.end (); ++i) {
for (typename std::set<id_type>::const_iterator j = i->begin(); j != i->end(); ++j) {
for (auto i = m_cm2join_sets.begin (); i != m_cm2join_sets.end (); ++i) {
for (auto j = i->begin(); j != i->end(); ++j) {
tl_assert(m_cm2join_map.find (*j) != m_cm2join_map.end ());
tl_assert(m_cm2join_map[*j] == i);
}
}

// the sets must be disjunct
std::set<id_type> all;
for (typename std::list<std::set<id_type> >::const_iterator i = m_cm2join_sets.begin (); i != m_cm2join_sets.end (); ++i) {
for (typename std::set<id_type>::const_iterator j = i->begin(); j != i->end(); ++j) {
for (auto i = m_cm2join_sets.begin (); i != m_cm2join_sets.end (); ++i) {
for (auto j = i->begin(); j != i->end(); ++j) {
tl_assert(all.find (*j) == all.end());
all.insert(*j);
}
Expand Down Expand Up @@ -2700,23 +2708,13 @@ struct hc_receiver
} else if (x1 != x2) {

int soft = ic->soft;

// for instance-to-instance interactions the number of connections is more important for the
// cost of the join operation: make the one with more connections the target
// TODO: this will be SLOW for STL's not providing a fast size()
if (mp_cell_clusters->connections_for_cluster (x1).size () < mp_cell_clusters->connections_for_cluster (x2).size ()) {
std::swap (x1, x2);
soft = -soft;
}

if (soft != 0) {

register_soft_connection (x1, x2, soft);

} else {

mp_cell_clusters->join_cluster_with (x1, x2);
mp_cell_clusters->remove_cluster (x2);
mark_to_join (x1, x2);

}

Expand Down
6 changes: 3 additions & 3 deletions src/db/unit_tests/dbLayoutToNetlistTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ TEST(1_BasicExtraction)
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:$I39");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "RINGO:$I2");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "RINGO:$I12");

// test build_all_nets

Expand Down Expand Up @@ -576,7 +576,7 @@ TEST(1_BasicExtraction)
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:$I39");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "RINGO:$I2");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "RINGO:$I12");

// use this opportunity to check joining of nets with cluster joining
db::Circuit *top = l2n.netlist ()->circuit_by_name ("RINGO");
Expand Down Expand Up @@ -616,7 +616,7 @@ TEST(1_BasicExtraction)
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (5.3, 0.0))), "RINGO:VDD,VSS");

EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (2.6, 1.0))), "RINGO:$I39");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "RINGO:$I2");
EXPECT_EQ (qnet_name (l2n.probe_net (*rmetal1, db::DPoint (6.4, 1.0))), "RINGO:$I12");

// compare the collected test data

Expand Down
4 changes: 2 additions & 2 deletions src/lvs/unit_tests/lvsTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ TEST(16_private)
TEST(17_private)
{
test_is_long_runner ();
run_test (_this, "test_17.lylvs", "test_17b.cir.gz", "test_17.gds.gz", true, "test_17b_6.lvsdb");
run_test (_this, "test_17.lylvs", "test_17b.cir.gz", "test_17.gds.gz", true, "test_17b_7.lvsdb");
}

TEST(18_private)
Expand All @@ -172,7 +172,7 @@ TEST(19_private)
TEST(20_private)
{
// test_is_long_runner ();
run_test (_this, "test_20.lylvs", "test_20.cir.gz", "test_20.gds.gz", true, "test_20_5.lvsdb");
run_test (_this, "test_20.lylvs", "test_20.cir.gz", "test_20.gds.gz", true, "test_20_6.lvsdb");
}

TEST(21_private)
Expand Down
Binary file modified testdata/algo/device_extract_au13_circuits.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au14_circuits.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au1_dup_inst_with_rec_nets.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au1_joined_nets.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au1_rebuild_nr.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au1_rebuild_pf.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au1_rebuild_pr.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au1_with_rec_nets.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au2_with_rec_nets.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au3_with_rec_nets.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au4_with_rec_nets.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au5_flattened_circuits.gds
Binary file not shown.
Binary file modified testdata/algo/device_extract_au5_with_rec_nets.gds
Binary file not shown.
Binary file modified testdata/algo/hc_test_au11.gds
Binary file not shown.
88 changes: 44 additions & 44 deletions testdata/algo/l2n_writer_au.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ circuit(INV2
rect(nsd (-1675 -925) (550 950))
)
net(5 name($5)
rect(diff_cont (-110 2490) (220 220))
rect(diff_cont (-220 180) (220 220))
rect(diff_cont (-220 -220) (220 220))
rect(diff_cont (-110 2890) (220 220))
rect(diff_cont (-220 -620) (220 220))
rect(metal1 (-290 -290) (360 760))
rect(diff_cont (-220 -220) (220 220))
rect(diff_cont (-220 180) (220 220))
rect(metal1 (-290 -690) (360 760))
rect(metal1 (-360 -760) (360 760))
rect(via1 (-305 -705) (250 250))
rect(via1 (-250 150) (250 250))
Expand Down Expand Up @@ -244,14 +244,14 @@ circuit(RINGO
net(12 name($I39))
net(13 name($I38))
net(14 name($I19))
net(15 name($I8))
net(16 name($I7))
net(17 name($I6))
net(18 name($I5))
net(19 name($I4))
net(20 name($I3))
net(21 name($I2))
net(22 name($I1))
net(15 name($I18))
net(16 name($I17))
net(17 name($I16))
net(18 name($I15))
net(19 name($I14))
net(20 name($I13))
net(21 name($I12))
net(22 name($I11))

# Outgoing pins and their connections to nets
pin(1 name(FB))
Expand All @@ -274,59 +274,59 @@ circuit(RINGO
pin(3 3)
pin(4 4)
)
circuit(3 INV2 location(2640 0)
pin(0 14)
pin(1 12)
pin(2 22)
pin(3 3)
pin(4 4)
)
circuit(4 INV2 location(5280 0)
pin(0 22)
pin(1 11)
pin(2 21)
circuit(3 INV2 location(21120 0)
pin(0 16)
pin(1 5)
pin(2 15)
pin(3 3)
pin(4 4)
)
circuit(5 INV2 location(7920 0)
pin(0 21)
pin(1 10)
pin(2 20)
circuit(4 INV2 location(18480 0)
pin(0 17)
pin(1 6)
pin(2 16)
pin(3 3)
pin(4 4)
)
circuit(6 INV2 location(10560 0)
pin(0 20)
pin(1 9)
pin(2 19)
circuit(5 INV2 location(15840 0)
pin(0 18)
pin(1 7)
pin(2 17)
pin(3 3)
pin(4 4)
)
circuit(7 INV2 location(13200 0)
circuit(6 INV2 location(13200 0)
pin(0 19)
pin(1 8)
pin(2 18)
pin(3 3)
pin(4 4)
)
circuit(8 INV2 location(15840 0)
pin(0 18)
pin(1 7)
pin(2 17)
circuit(7 INV2 location(10560 0)
pin(0 20)
pin(1 9)
pin(2 19)
pin(3 3)
pin(4 4)
)
circuit(9 INV2 location(18480 0)
pin(0 17)
pin(1 6)
pin(2 16)
circuit(8 INV2 location(7920 0)
pin(0 21)
pin(1 10)
pin(2 20)
pin(3 3)
pin(4 4)
)
circuit(10 INV2 location(21120 0)
pin(0 16)
pin(1 5)
pin(2 15)
circuit(9 INV2 location(5280 0)
pin(0 22)
pin(1 11)
pin(2 21)
pin(3 3)
pin(4 4)
)
circuit(10 INV2 location(2640 0)
pin(0 14)
pin(1 12)
pin(2 22)
pin(3 3)
pin(4 4)
)
Expand Down
Binary file modified testdata/algo/l2n_writer_au_2.gds
Binary file not shown.
30 changes: 15 additions & 15 deletions testdata/algo/l2n_writer_au_2b.txt
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ circuit(INV2
rect(nsd (-1515 -385) (550 950))
)
net(6 name(VDD)
rect(diff_cont (-110 2490) (220 220))
rect(diff_cont (-220 180) (220 220))
rect(diff_cont (-220 -220) (220 220))
rect(diff_cont (-110 2890) (220 220))
rect(diff_cont (-220 -620) (220 220))
rect(metal1 (-290 -290) (360 760))
rect(diff_cont (-220 -220) (220 220))
rect(diff_cont (-220 180) (220 220))
rect(metal1 (-290 -690) (360 760))
rect(metal1 (-360 -760) (360 760))
rect(via1 (-305 -705) (250 250))
rect(via1 (-250 150) (250 250))
Expand Down Expand Up @@ -345,9 +345,9 @@ circuit(RINGO
net(7 name($I23))
net(8 name($I22))
net(9 name($I17))
net(10 name($I11))
net(11 name($I10))
net(12 name($I9))
net(10 name($I16))
net(11 name($I15))
net(12 name($I14))

# Outgoing pins and their connections to nets
pin(1 name(FB))
Expand All @@ -374,13 +374,13 @@ circuit(RINGO
pin(5 9)
pin(6 3)
)
circuit(3 INV2PAIR location(3580 -800)
circuit(3 INV2PAIR location(14140 -800)
pin(0 4)
pin(1 7)
pin(1 5)
pin(2 3)
pin(3 4)
pin(4 9)
pin(5 12)
pin(4 11)
pin(5 10)
pin(6 3)
)
circuit(4 INV2PAIR location(8860 -800)
Expand All @@ -392,13 +392,13 @@ circuit(RINGO
pin(5 11)
pin(6 3)
)
circuit(5 INV2PAIR location(14140 -800)
circuit(5 INV2PAIR location(3580 -800)
pin(0 4)
pin(1 5)
pin(1 7)
pin(2 3)
pin(3 4)
pin(4 11)
pin(5 10)
pin(4 9)
pin(5 12)
pin(6 3)
)

Expand Down
Loading
Loading