diff --git a/src/db/db/dbNetlistSpiceReader.cc b/src/db/db/dbNetlistSpiceReader.cc index ce4477c7d..928aba2aa 100644 --- a/src/db/db/dbNetlistSpiceReader.cc +++ b/src/db/db/dbNetlistSpiceReader.cc @@ -417,8 +417,10 @@ bool NetlistSpiceReader::read_card () } else if (ex.test_without_case ("global")) { - std::string n = read_name (ex); - m_global_nets.push_back (n); + while (! ex.at_end ()) { + std::string n = read_name (ex); + m_global_nets.push_back (n); + } } else if (ex.test_without_case ("subckt")) { @@ -812,10 +814,6 @@ bool NetlistSpiceReader::read_element (tl::Extractor &ex, const std::string &ele void NetlistSpiceReader::read_subcircuit (const std::string &sc_name, const std::string &nc_name, const std::vector &nets) { - if (nets.empty ()) { - error (tl::to_string (tr ("A circuit call needs at least one net"))); - } - db::Circuit *cc = mp_netlist->circuit_by_name (nc_name); if (! cc) { diff --git a/src/db/unit_tests/dbNetlistReaderTests.cc b/src/db/unit_tests/dbNetlistReaderTests.cc index 664373d22..149bc22f6 100644 --- a/src/db/unit_tests/dbNetlistReaderTests.cc +++ b/src/db/unit_tests/dbNetlistReaderTests.cc @@ -359,3 +359,24 @@ TEST(9_DeviceMultipliers) ); } +TEST(10_SubcircuitsNoPins) +{ + db::Netlist nl; + + std::string path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "nreader10.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" + ); +} + diff --git a/testdata/algo/nreader10.cir b/testdata/algo/nreader10.cir new file mode 100644 index 000000000..f7e8a574e --- /dev/null +++ b/testdata/algo/nreader10.cir @@ -0,0 +1,10 @@ + +.global vdd gnd + +X0 FILLER_CAP +R$1 vdd gnd 1k + +.subckt FILLER_CAP +M0 gnd vdd gnd gnd NMOS W=10u L=10u +.ends FILLER_CAP +