-
Notifications
You must be signed in to change notification settings - Fork 255
Description
It seem that the LVS schematic function used to parse a spice file does not handle errors properly.
More specificaly, it seems the netlist.read call cannot fail:
| netlist.read(netlist_file, reader) |
Interestingly enough, exceptions are raised in the read function:
klayout/src/db/db/dbNetlistSpiceReader.cc
Lines 485 to 511 in ec5de0f
| SpiceCircuitDict::read (tl::InputStream &stream) | |
| { | |
| try { | |
| m_stream.set_stream (stream); | |
| mp_circuit = 0; | |
| mp_anonymous_top_level_circuit = 0; | |
| m_called_circuits.clear (); | |
| m_variables.clear (); | |
| m_global_net_names.clear (); | |
| m_global_nets.clear (); | |
| m_file_id = file_id (stream.absolute_file_path ()); | |
| while (! at_end ()) { | |
| read_card (); | |
| } | |
| } catch (tl::Exception &ex) { | |
| // Add a location to the exception | |
| std::string fmt_msg = ex.msg () + tl::sprintf (tl::to_string (tr (" in %s, line %d")), m_stream.source (), m_stream.line_number ()); | |
| throw tl::Exception (fmt_msg); | |
| } | |
| } |
The problems seems to come from the c++/ruby interface, where exceptions generated in c++ are not caught in ruby. Unfortunately, I do not have the skills to debug this much further.
A simple way to reproduce the error is to load the following SPICE file for an LVS comparison. You will see that only the first resistor is parsed, whereas the second is not present (due to the spice parser throwing on the "&%ç%&*+£à° line
.subckt top A B sub
R1 A B
"&%ç%&*+£à°
R2 A B
.ends