Skip to content
Open

Wip #2280

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
6 changes: 6 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ HAVE_CURL=0
HAVE_EXPAT=0
HAVE_GIT2=1
HAVE_LSTREAM=1
HAVE_CPP20=0

RUBYINCLUDE=""
RUBYINCLUDE2=""
Expand Down Expand Up @@ -217,6 +218,9 @@ while [ "$*" != "" ]; do
-nolstream)
HAVE_LSTREAM=0
;;
-cpp20)
HAVE_CPP20=1
;;
-qt5)
echo "*** WARNING: -qt5 option is ignored - Qt version is auto-detected now."
;;
Expand Down Expand Up @@ -275,6 +279,7 @@ while [ "$*" != "" ]; do
echo " -libpng Use libpng instead of Qt for PNG generation"
echo " -nolibgit2 Do not include libgit2 for Git package support"
echo " -nolstream Do not include the LStream plugin"
echo " -cpp20 Uses some C++20 features (e.g. atomics)"
echo ""
echo "Environment Variables:"
echo ""
Expand Down Expand Up @@ -670,6 +675,7 @@ qmake_options=(
HAVE_PNG="$HAVE_PNG"
HAVE_GIT2="$HAVE_GIT2"
HAVE_LSTREAM="$HAVE_LSTREAM"
HAVE_CPP20="$HAVE_CPP20"
PREFIX="$BIN"
RPATH="$RPATH"
KLAYOUT_VERSION="$KLAYOUT_VERSION"
Expand Down
39 changes: 39 additions & 0 deletions src/buddies/src/bd/bdWriterOptions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ const std::string GenericWriterOptions::dxf_format_name = "DXF";
const std::string GenericWriterOptions::cif_format_name = "CIF";
const std::string GenericWriterOptions::mag_format_name = "MAG";

std::vector<std::string>
GenericWriterOptions::all_format_names ()
{
std::vector<std::string> names;
names.push_back (gds2_format_name);
names.push_back (gds2text_format_name);
names.push_back (oasis_format_name);
names.push_back (lstream_format_name);
names.push_back (dxf_format_name);
names.push_back (cif_format_name);
names.push_back (mag_format_name);
return names;
}

void
GenericWriterOptions::add_options (tl::CommandLineOptions &cmd, const std::string &format)
{
Expand All @@ -109,6 +123,15 @@ GenericWriterOptions::add_options (tl::CommandLineOptions &cmd, const std::strin
"given factor."
);

if (format.empty ()) {
cmd << tl::arg (group +
"-of|--format=format", &m_format, "Specifies the output format",
"By default, the output format is derived from the file name suffix. "
"You can also specify the format directly using this option. Allowed format names are: "
+ tl::join (all_format_names (), ", ")
);
}

if (format.empty () || format == gds2_format_name || format == gds2text_format_name || format == oasis_format_name) {
cmd << tl::arg (group +
"-od|--dbu-out=dbu", &m_dbu, "Uses the specified database unit",
Expand Down Expand Up @@ -426,6 +449,22 @@ GenericWriterOptions::configure (db::SaveLayoutOptions &save_options, const db::
save_options.set_keep_instances (m_keep_instances);
save_options.set_write_context_info (m_write_context_info);

if (! m_format.empty ()) {

// check, if the format name is a valid one
std::vector<std::string> af = all_format_names ();
auto i = af.begin ();
while (i != af.end () && *i != m_format) {
++i;
}
if (i == af.end ()) {
throw tl::Exception (tl::sprintf (tl::to_string (tr ("Invalid fornat name %s. Allowed names are: %s")), m_format, tl::join (af, ", ")));
}

save_options.set_format (m_format);

}

save_options.set_option_by_name ("gds2_max_vertex_count", m_gds2_max_vertex_count);
save_options.set_option_by_name ("gds2_no_zero_length_paths", m_gds2_no_zero_length_paths);
save_options.set_option_by_name ("gds2_multi_xy_records", m_gds2_multi_xy_records);
Expand Down
7 changes: 7 additions & 0 deletions src/buddies/src/bd/bdWriterOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "bdCommon.h"

#include <string>
#include <vector>

namespace tl
{
Expand Down Expand Up @@ -60,6 +61,11 @@ class BD_PUBLIC GenericWriterOptions
*/
GenericWriterOptions (const db::SaveLayoutOptions &options);

/**
* @brief Gets a list with all format names available
*/
static std::vector<std::string> all_format_names ();

/**
* @brief Adds the generic options to the command line parser object
* The format string gives a hint about the target format. Certain options will be
Expand Down Expand Up @@ -114,6 +120,7 @@ class BD_PUBLIC GenericWriterOptions
static const std::string mag_format_name;

private:
std::string m_format;
double m_scale_factor;
double m_dbu;
bool m_dont_write_empty_cells;
Expand Down
16 changes: 15 additions & 1 deletion src/db/db/dbCell.cc
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,7 @@ std::string
Cell::get_display_name () const
{
tl_assert (layout () != 0);
if (is_ghost_cell () && empty ()) {
if (is_real_ghost_cell ()) {
return std::string ("(") + layout ()->cell_name (cell_index ()) + std::string (")");
} else {
return layout ()->cell_name (cell_index ());
Expand All @@ -959,6 +959,20 @@ Cell::set_name (const std::string &name)
layout ()->rename_cell (cell_index (), name.c_str ());
}

void
Cell::set_ghost_cell (bool g)
{
// NOTE: this change is not undo managed
if (m_ghost_cell != g) {

m_ghost_cell = g;
tl_assert (layout () != 0);
// To trigger a redraw and cell tree rebuild
layout ()->cell_name_changed ();

}
}

void
Cell::check_locked () const
{
Expand Down
19 changes: 15 additions & 4 deletions src/db/db/dbCell.h
Original file line number Diff line number Diff line change
Expand Up @@ -926,15 +926,26 @@ class DB_PUBLIC Cell
}

/**
* @brief Sets the "ghost cell" flag
* @brief Gets a value indicating whether the cell is a "real" ghost cell
*
* See "is_ghost_cell" for a description of this property.
* A ghost cell is a real ghost cell only if the ghost cell flag is set
* and the cell is empty. Only in that case for example the cell is written
* to GDS files as a ghost cell.
*
* Otherwise, the ghost cell flag is mostly ignored.
*/
void set_ghost_cell (bool g)
bool is_real_ghost_cell () const
{
m_ghost_cell = g;
return m_ghost_cell && empty ();
}

/**
* @brief Sets the "ghost cell" flag
*
* See "is_ghost_cell" for a description of this property.
*/
void set_ghost_cell (bool g);

/**
* @brief Gets a value indicating whether the cell is locked
*
Expand Down
2 changes: 1 addition & 1 deletion src/db/db/dbCompoundOperation.cc
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ namespace
struct generic_result_adaptor
{
public:
generic_result_adaptor<T> (std::vector<std::unordered_set<T> > *results)
generic_result_adaptor (std::vector<std::unordered_set<T> > *results)
: mp_results (results)
{
m_intermediate.reserve (results->size ());
Expand Down
4 changes: 2 additions & 2 deletions src/db/db/dbCompoundOperation.h
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ class DB_PUBLIC compound_local_operation
* Creates a local operation which utilizes the operation tree. "node" is the root of the operation tree.
* Ownership of the node is *not* transferred to the local operation.
*/
compound_local_operation<TS, TI, TR> (CompoundRegionOperationNode *node)
compound_local_operation (CompoundRegionOperationNode *node)
: mp_node (node)
{ }

Expand Down Expand Up @@ -1802,7 +1802,7 @@ class DB_PUBLIC compound_local_operation_with_properties
* Creates a local operation which utilizes the operation tree. "node" is the root of the operation tree.
* Ownership of the node is *not* transferred to the local operation.
*/
compound_local_operation_with_properties<TS, TI, TR> (CompoundRegionOperationNode *node, db::PropertyConstraint prop_constraint)
compound_local_operation_with_properties (CompoundRegionOperationNode *node, db::PropertyConstraint prop_constraint)
: mp_node (node), m_prop_constraint (prop_constraint)
{
// .. nothing yet ..
Expand Down
68 changes: 66 additions & 2 deletions src/db/db/dbHierNetworkProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,69 @@ connected_clusters<T>::join_cluster_with (typename local_cluster<T>::id_type id,
}
}

template <class T>
void
connected_clusters<T>::join_clusters_with (typename local_cluster<T>::id_type id, typename std::set<typename local_cluster<T>::id_type>::const_iterator with_from, typename std::set<typename local_cluster<T>::id_type>::const_iterator with_to)
{
if (with_from != with_to && *with_from == id) {
++with_from;
}
if (with_from == with_to) {
return;
}

connections_type &target = m_connections [id];
std::set<connections_type::value_type> target_set;
bool target_set_valid = false;

for (auto w = with_from; w != with_to; ++w) {

local_clusters<T>::join_cluster_with (id, *w);

// handle the connections by translating

typename std::map<typename local_cluster<T>::id_type, connections_type>::iterator tc = m_connections.find (*w);
if (tc != m_connections.end ()) {

connections_type &to_join = tc->second;

for (connections_type::const_iterator c = to_join.begin (); c != to_join.end (); ++c) {
m_rev_connections [*c] = id;
}

if (target.empty ()) {

target.swap (to_join);

} else if (! to_join.empty ()) {

// Join while removing duplicates
if (! target_set_valid) {
target_set.insert (target.begin (), target.end ());
target_set_valid = true;
}

for (auto j = to_join.begin (); j != to_join.end (); ++j) {
if (target_set.find (*j) == target_set.end ()) {
target.push_back (*j);
target_set.insert (*j);
}
}

}

m_connections.erase (tc);

}

if (m_connected_clusters.find (*w) != m_connected_clusters.end ()) {
m_connected_clusters.insert (id);
m_connected_clusters.erase (*w);
}

}
}

template <class T>
typename local_cluster<T>::id_type
connected_clusters<T>::find_cluster_with_connection (const ClusterInstance &inst) const
Expand Down Expand Up @@ -1995,8 +2058,9 @@ struct hc_receiver

typename std::set<id_type>::const_iterator c = sc->begin ();
typename std::set<id_type>::const_iterator cc = c;
for (++cc; cc != sc->end (); ++cc) {
mp_cell_clusters->join_cluster_with (*c, *cc);
++cc;
if (cc != sc->end ()) {
mp_cell_clusters->join_clusters_with (*c, cc, sc->end ());
}

}
Expand Down
7 changes: 7 additions & 0 deletions src/db/db/dbHierNetworkProcessor.h
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,13 @@ class DB_PUBLIC_TEMPLATE connected_clusters
*/
void join_cluster_with (typename local_cluster<T>::id_type id, typename local_cluster<T>::id_type with_id);

/**
* @brief Joins a cluster id with the a set of clusters given by an iterator interval with_to .. with_from
*
* This function is equivalent to calling "join_cluster_with" multiple times, but more efficient.
*/
void join_clusters_with (typename local_cluster<T>::id_type id, typename std::set<typename local_cluster<T>::id_type>::const_iterator with_from, typename std::set<typename local_cluster<T>::id_type>::const_iterator with_to);

/**
* @brief An iterator delivering all clusters (even the connectors)
*
Expand Down
35 changes: 23 additions & 12 deletions src/db/db/dbHierProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,6 @@ local_processor_result_computation_task<TS, TI, TR>::perform ()
{
mp_cell_contexts->compute_results (*mp_contexts, mp_cell, mp_op, m_output_layers, mp_proc);

// erase the contexts we don't need any longer
{
tl::MutexLocker locker (& mp_contexts->lock ());

Expand All @@ -734,7 +733,10 @@ local_processor_result_computation_task<TS, TI, TR>::perform ()
}
#endif

mp_contexts->context_map ().erase (mp_cell);
// release some memory
auto ctx = mp_contexts->context_map ().find (mp_cell);
tl_assert (ctx != mp_contexts->context_map ().end ());
ctx->second.cleanup ();
}
}

Expand Down Expand Up @@ -881,15 +883,6 @@ void local_processor<TS, TI, TR>::run (local_operation<TS, TI, TR> *op, unsigned
compute_results (contexts, op, output_layers);
}

template <class TS, class TI, class TR>
void local_processor<TS, TI, TR>::push_results (db::Cell *cell, unsigned int output_layer, const std::unordered_set<TR> &result) const
{
if (! result.empty ()) {
tl::MutexLocker locker (&cell->layout ()->lock ());
cell->shapes (output_layer).insert (result.begin (), result.end ());
}
}

template <class TS, class TI, class TR>
void local_processor<TS, TI, TR>::compute_contexts (local_processor_contexts<TS, TI, TR> &contexts, const local_operation<TS, TI, TR> *op, unsigned int subject_layer, const std::vector<unsigned int> &intruder_layers) const
{
Expand Down Expand Up @@ -1248,7 +1241,7 @@ local_processor<TS, TI, TR>::compute_results (local_processor_contexts<TS, TI, T
typename local_processor_contexts<TS, TI, TR>::iterator cpc = contexts.context_map ().find (&mp_subject_layout->cell (*bu));
if (cpc != contexts.context_map ().end ()) {
cpc->second.compute_results (contexts, cpc->first, op, output_layers, this);
contexts.context_map ().erase (cpc);
cpc->second.cleanup (); // release some memory
}

}
Expand All @@ -1261,6 +1254,24 @@ local_processor<TS, TI, TR>::compute_results (local_processor_contexts<TS, TI, T
}

}

// deliver the results
{
tl::MutexLocker locker (& mp_subject_layout->lock ());
for (auto c = contexts.begin (); c != contexts.end (); ++c) {

db::Cell *cell = c->first;
auto r = c->second.result ().begin ();
auto rend = c->second.result ().end ();

for (auto o = output_layers.begin (); r != rend && o != output_layers.end (); ++o, ++r) {
if (! r->empty ()) {
cell->shapes (*o).insert (r->begin (), r->end ());
}
}

}
}
}

namespace {
Expand Down
Loading
Loading