@@ -1932,41 +1932,53 @@ void HierRTLMP::createFixedTerminals(
19321932 parents.push (parent);
19331933
19341934 while (!parents.empty ()) {
1935- auto frontwave = parents.front ();
1935+ Cluster* frontwave = parents.front ();
19361936 parents.pop ();
19371937
19381938 Cluster* grandparent = frontwave->getParent ();
19391939 for (auto & cluster : grandparent->getChildren ()) {
19401940 if (cluster->getId () != frontwave->getId ()) {
1941- soft_macro_id_map[cluster->getName ()]
1942- = static_cast <int >(soft_macros.size ());
1943-
1944- const float center_x = cluster->getX () + cluster->getWidth () / 2.0 ;
1945- const float center_y = cluster->getY () + cluster->getHeight () / 2.0 ;
1946- Point location = {center_x - outline.xMin (), center_y - outline.yMin ()};
1947-
1948- // The information of whether or not a cluster is a group of
1949- // unplaced IO pins is needed inside the SA Core, so if a fixed
1950- // terminal corresponds to a cluster of unplaced IO pins it needs
1951- // to contain that cluster data.
1952- Cluster* fixed_terminal_cluster
1953- = cluster->isClusterOfUnplacedIOPins () ? cluster.get () : nullptr ;
1954-
1955- // Note that a fixed terminal is just a point.
1956- soft_macros.emplace_back (location,
1957- cluster->getName (),
1958- 0 .0f /* width */ ,
1959- 0 .0f /* height */ ,
1960- fixed_terminal_cluster);
1941+ const int id = static_cast <int >(soft_macros.size ());
1942+ soft_macro_id_map[cluster->getName ()] = id;
1943+ createFixedTerminal (cluster.get (), outline, soft_macros);
19611944 }
19621945 }
19631946
1964- if (frontwave->getParent ()->getParent () != nullptr ) {
1947+ if (frontwave->getParent ()->getParent ()) {
19651948 parents.push (frontwave->getParent ());
19661949 }
19671950 }
19681951}
19691952
1953+ template <typename Macro>
1954+ void HierRTLMP::createFixedTerminal (Cluster* cluster,
1955+ const Rect& outline,
1956+ std::vector<Macro>& macros)
1957+ {
1958+ // A conventional fixed terminal is just a point without
1959+ // the cluster data.
1960+ Point location = cluster->getCenter ();
1961+ float width = 0 .0f ;
1962+ float height = 0 .0f ;
1963+ Cluster* terminal_cluster = nullptr ;
1964+
1965+ if (cluster->isClusterOfUnplacedIOPins ()) {
1966+ // Clusters of unplaced IOs are not treated as conventional
1967+ // fixed terminals. As they correspond to regions, we need
1968+ // both their actual shape and their cluster data inside SA.
1969+ location = {cluster->getX (), cluster->getY ()};
1970+ width = cluster->getWidth ();
1971+ height = cluster->getHeight ();
1972+ terminal_cluster = cluster;
1973+ }
1974+
1975+ location.first -= outline.xMin ();
1976+ location.second -= outline.yMin ();
1977+
1978+ macros.emplace_back (
1979+ location, cluster->getName (), width, height, terminal_cluster);
1980+ }
1981+
19701982// Determine the shape of each cluster based on target utilization
19711983// and target dead space. In constrast to all previous works, we
19721984// use two parameters: target utilization, target_dead_space.
@@ -2416,6 +2428,7 @@ void HierRTLMP::computeFencesAndGuides(
24162428 }
24172429}
24182430
2431+ // Create terminals for macro placement (Hard) annealing.
24192432void HierRTLMP::createFixedTerminals (const Rect& outline,
24202433 const UniqueClusterVector& macro_clusters,
24212434 std::map<int , int >& cluster_to_macro,
@@ -2433,22 +2446,12 @@ void HierRTLMP::createFixedTerminals(const Rect& outline,
24332446 if (cluster_to_macro.find (cluster_id) != cluster_to_macro.end ()) {
24342447 continue ;
24352448 }
2436- auto & temp_cluster = tree_->maps .id_to_cluster [cluster_id];
2437-
2438- // model other cluster as a fixed macro with zero size
2439- cluster_to_macro[cluster_id] = sa_macros.size ();
2440- sa_macros.emplace_back (
2441- std::pair<float , float >(
2442- temp_cluster->getX () + temp_cluster->getWidth () / 2.0
2443- - outline.xMin (),
2444- temp_cluster->getY () + temp_cluster->getHeight () / 2.0
2445- - outline.yMin ()),
2446- temp_cluster->getName (),
2447- // The information of whether or not a cluster is a group of
2448- // unplaced IO pins is needed inside the SA Core, so if a fixed
2449- // terminal corresponds to a cluster of unplaced IO pins it needs
2450- // to contain that cluster data.
2451- temp_cluster->isClusterOfUnplacedIOPins () ? temp_cluster : nullptr );
2449+
2450+ Cluster* temp_cluster = tree_->maps .id_to_cluster [cluster_id];
2451+ const int terminal_id = static_cast <int >(sa_macros.size ());
2452+
2453+ cluster_to_macro[cluster_id] = terminal_id;
2454+ createFixedTerminal (temp_cluster, outline, sa_macros);
24522455 }
24532456}
24542457
0 commit comments