mirror of https://github.com/KLayout/klayout.git
Implementing solution for issue #1701 (Feature request: strm2oas should report input unit differences)
This commit is contained in:
parent
48b32733c2
commit
8422fe8f83
|
|
@ -805,29 +805,11 @@ GenericReaderOptions::configure (db::LoadLayoutOptions &load_options)
|
|||
load_options.set_option_by_name ("lefdef_config.macro_resolution_mode", m_lefdef_macro_resolution_mode);
|
||||
load_options.set_option_by_name ("lefdef_config.paths_relative_to_cwd", true);
|
||||
|
||||
m_lef_layouts.clear ();
|
||||
tl::Variant lef_layout_ptrs = tl::Variant::empty_list ();
|
||||
tl::Variant lef_layout_files = tl::Variant::empty_list ();
|
||||
for (std::vector<std::string>::const_iterator l = m_lefdef_lef_layout_files.begin (); l != m_lefdef_lef_layout_files.end (); ++l) {
|
||||
|
||||
try {
|
||||
|
||||
std::unique_ptr<db::Layout> ly (new db::Layout ());
|
||||
|
||||
tl::InputStream stream (*l);
|
||||
db::Reader reader (stream);
|
||||
db::LoadLayoutOptions load_options;
|
||||
reader.read (*ly, load_options);
|
||||
|
||||
lef_layout_ptrs.push (tl::Variant::make_variant_ref (ly.get ()));
|
||||
m_lef_layouts.push_back (ly.release ());
|
||||
|
||||
} catch (tl::Exception &ex) {
|
||||
tl::warn << ex.msg ();
|
||||
}
|
||||
|
||||
lef_layout_files.push (*l);
|
||||
}
|
||||
|
||||
load_options.set_option_by_name ("lefdef_config.macro_layouts", lef_layout_ptrs);
|
||||
load_options.set_option_by_name ("lefdef_config.macro_layout_files", lef_layout_files);
|
||||
}
|
||||
|
||||
static std::string::size_type find_file_sep (const std::string &s, std::string::size_type from)
|
||||
|
|
|
|||
|
|
@ -189,8 +189,6 @@ private:
|
|||
std::string m_lefdef_map_file;
|
||||
int m_lefdef_macro_resolution_mode;
|
||||
std::vector<std::string> m_lefdef_lef_layout_files;
|
||||
|
||||
tl::shared_collection<db::Layout> m_lef_layouts;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1704,6 +1704,10 @@ DEFImporter::do_read (db::Layout &layout)
|
|||
double units = get_double ();
|
||||
if (fabs (units) > 1e-6) {
|
||||
scale = 1.0 / (units * layout.dbu ());
|
||||
if (fabs (scale - 1.0) > db::epsilon) {
|
||||
warn (tl::sprintf (tl::to_string (tr ("DEF UNITS not matching reader DBU (DEF UNITS is %.12g and corresponds to a DBU of %.12g, but reader unit is %.12g)")),
|
||||
units, 1.0 / units, layout.dbu ()));
|
||||
}
|
||||
}
|
||||
expect (";");
|
||||
|
||||
|
|
|
|||
|
|
@ -2068,7 +2068,9 @@ LEFDEFImporter::read (tl::InputStream &stream, db::Layout &layout, LEFDEFReaderS
|
|||
void
|
||||
LEFDEFImporter::error (const std::string &msg)
|
||||
{
|
||||
if (m_sections.empty ()) {
|
||||
if (! mp_stream) {
|
||||
throw LEFDEFReaderException (msg, -1, std::string (), m_fn);
|
||||
} else if (m_sections.empty ()) {
|
||||
throw LEFDEFReaderException (msg, int (mp_stream->line_number ()), m_cellname, m_fn);
|
||||
} else {
|
||||
throw LEFDEFReaderException (msg + tl::sprintf (tl::to_string (tr (" (inside %s)")), tl::join (m_sections, "/")), int (mp_stream->line_number ()), m_cellname, m_fn);
|
||||
|
|
@ -2082,11 +2084,17 @@ LEFDEFImporter::warn (const std::string &msg, int wl)
|
|||
return;
|
||||
}
|
||||
|
||||
tl::warn << msg
|
||||
<< tl::to_string (tr (" (line=")) << mp_stream->line_number ()
|
||||
<< tl::to_string (tr (", cell=")) << m_cellname
|
||||
<< tl::to_string (tr (", file=")) << m_fn
|
||||
<< ")";
|
||||
if (! mp_stream) {
|
||||
tl::warn << msg
|
||||
<< tl::to_string (tr (" (file=")) << m_fn
|
||||
<< ")";
|
||||
} else {
|
||||
tl::warn << msg
|
||||
<< tl::to_string (tr (" (line=")) << mp_stream->line_number ()
|
||||
<< tl::to_string (tr (", cell=")) << m_cellname
|
||||
<< tl::to_string (tr (", file=")) << m_fn
|
||||
<< ")";
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
|
|||
|
|
@ -67,7 +67,8 @@ class DB_PLUGIN_PUBLIC LEFDEFReaderException
|
|||
{
|
||||
public:
|
||||
LEFDEFReaderException (const std::string &msg, int line, const std::string &cell, const std::string &fn)
|
||||
: db::ReaderException (tl::sprintf (tl::to_string (tr ("%s (line=%d, cell=%s, file=%s)")), msg.c_str (), line, cell, fn))
|
||||
: db::ReaderException (line >= 0 ? tl::sprintf (tl::to_string (tr ("%s (line=%d, cell=%s, file=%s)")), msg.c_str (), line, cell, fn) :
|
||||
tl::sprintf (tl::to_string (tr ("%s (file=%s)")), msg.c_str (), fn))
|
||||
{ }
|
||||
};
|
||||
|
||||
|
|
@ -1517,14 +1518,6 @@ public:
|
|||
*/
|
||||
void read (tl::InputStream &stream, db::Layout &layout, LEFDEFReaderState &state);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Actually does the reading
|
||||
*
|
||||
* Reimplement that method for the LEF and DEF implementation
|
||||
*/
|
||||
virtual void do_read (db::Layout &layout) = 0;
|
||||
|
||||
/**
|
||||
* @brief Issue an error at the current location
|
||||
*/
|
||||
|
|
@ -1535,6 +1528,14 @@ protected:
|
|||
*/
|
||||
void warn (const std::string &msg, int wl = 1);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @brief Actually does the reading
|
||||
*
|
||||
* Reimplement that method for the LEF and DEF implementation
|
||||
*/
|
||||
virtual void do_read (db::Layout &layout) = 0;
|
||||
|
||||
/**
|
||||
* @brief Returns true if the reader is at the end of the file
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -228,6 +228,11 @@ LEFDEFReader::read_lefdef (db::Layout &layout, const db::LoadLayoutOptions &opti
|
|||
db::Reader reader (macro_layout_stream);
|
||||
reader.read (*new_layout, options);
|
||||
|
||||
if (fabs (new_layout->dbu () / layout.dbu () - 1.0) > db::epsilon) {
|
||||
importer.warn (tl::sprintf (tl::to_string (tr ("DBU of macro layout file '%s' is not compatible with reader DBU (layout DBU is %.12g, reader DBU is %.12g)")),
|
||||
lp, new_layout->dbu (), layout.dbu ()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (std::vector<db::Layout *>::const_iterator m = macro_layouts.begin (); m != macro_layouts.end (); ++m) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue