mirror of https://github.com/KLayout/klayout.git
parent
2cb1df74f7
commit
c08d2f0684
|
|
@ -419,7 +419,10 @@ bool NetlistSpiceReader::read_card ()
|
|||
|
||||
while (! ex.at_end ()) {
|
||||
std::string n = read_name (ex);
|
||||
m_global_nets.push_back (n);
|
||||
if (m_global_net_names.find (n) == m_global_net_names.end ()) {
|
||||
m_global_nets.push_back (n);
|
||||
m_global_net_names.insert (n);
|
||||
}
|
||||
}
|
||||
|
||||
} else if (ex.test_without_case ("subckt")) {
|
||||
|
|
|
|||
|
|
@ -131,6 +131,7 @@ private:
|
|||
std::string m_stored_line;
|
||||
std::map<std::string, bool> m_captured;
|
||||
std::vector<std::string> m_global_nets;
|
||||
std::set<std::string> m_global_net_names;
|
||||
std::set<const db::Circuit *> m_circuits_read;
|
||||
|
||||
void push_stream (const std::string &path);
|
||||
|
|
|
|||
|
|
@ -422,3 +422,24 @@ TEST(11_ErrorOnCircuitRedefinition)
|
|||
EXPECT_EQ (tl::replaced (msg, path, "?"), "Redefinition of circuit SUBCKT in ?, line 20");
|
||||
}
|
||||
|
||||
TEST(12_IgnoreDuplicateGlobals)
|
||||
{
|
||||
db::Netlist nl;
|
||||
|
||||
std::string path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "nreader12.cir");
|
||||
|
||||
db::NetlistSpiceReader reader;
|
||||
tl::InputStream is (path);
|
||||
reader.read (is, nl);
|
||||
|
||||
EXPECT_EQ (nl.to_string (),
|
||||
"circuit .TOP ();\n"
|
||||
" device RES $1 (A=VDD,B=GND) (R=1000,L=0,W=0,A=0,P=0);\n"
|
||||
" subcircuit FILLER_CAP '0' (VDD=VDD,GND=GND);\n"
|
||||
"end;\n"
|
||||
"circuit FILLER_CAP (VDD=VDD,GND=GND);\n"
|
||||
" device NMOS '0' (S=GND,G=VDD,D=GND,B=GND) (L=10,W=10,AS=0,AD=0,PS=0,PD=0);\n"
|
||||
"end;\n"
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
|
||||
.global vdd gnd
|
||||
|
||||
X0 FILLER_CAP
|
||||
R$1 vdd gnd 1k
|
||||
|
||||
* should be ignored:
|
||||
.global vdd
|
||||
.global gnd
|
||||
|
||||
.subckt FILLER_CAP
|
||||
M0 gnd vdd gnd gnd NMOS W=10u L=10u
|
||||
.ends FILLER_CAP
|
||||
|
||||
Loading…
Reference in New Issue