Added missing files, added tests

This commit is contained in:
Matthias Koefferlein 2026-06-14 21:33:41 +02:00
parent 80352c1d02
commit 4561eebdc0
5 changed files with 211 additions and 0 deletions

View File

@ -584,3 +584,24 @@ TEST(8_VariantDeviceParameters)
"end;\n"
);
}
TEST(9_VariantDeviceParametersShort)
{
db::LayoutToNetlist l2n;
// build from: testdata/algo/l2n_reader_4.gds
std::string in_path = tl::combine_path (tl::combine_path (tl::testdata (), "algo"), "l2n_reader_8s.l2n");
tl::InputStream is_in (in_path);
db::LayoutToNetlistStandardReader reader (is_in);
reader.read (&l2n);
tl_assert (l2n.netlist () != 0);
EXPECT_EQ (l2n.netlist ()->to_string (),
"circuit TOP ();\n"
" device DEVCLS dev (S=(null),G=(null),D=(null),B=(null)) (D=17.5,L=42,S=XYZ,B=true,N=nil);\n"
" device DEVCLS dev2 (S=(null),G=(null),D=(null),B=(null)) (D=0,L=0,S=,B=false,N=nil);\n"
"end;\n"
);
}

55
testdata/algo/l2n_reader_8.l2n vendored Normal file
View File

@ -0,0 +1,55 @@
#%l2n-klayout
top(TOP)
unit(0.001)
# Layer section
# This section lists the mask layers (drawing or derived) and their connections.
# Mask layers
# Mask layer connectivity
# Device class section
class(DEVCLS MOS4 1
param(D 1 0)
param-int(L 1 0)
param-string(S 1 '')
param-var(B 1 'false')
param-nil(N 1)
terminal(S)
terminal(G)
terminal(D)
terminal(B)
)
# Circuit section
# Circuits are the hierarchical building blocks of the netlist.
circuit(TOP
# Devices and their connections
device(1 DEVCLS
name(dev)
param(D 17.5)
param-int(L 42)
param-string(S 'XYZ')
param-var(B 'true')
param-nil(N)
terminal(S)
terminal(G)
terminal(D)
terminal(B)
)
device(2 DEVCLS
name(dev2)
param(D 0)
param-int(L 0)
param-string(S '')
param-var(B 'false')
param-nil(N)
terminal(S)
terminal(G)
terminal(D)
terminal(B)
)
)

40
testdata/algo/l2n_reader_8s.l2n vendored Normal file
View File

@ -0,0 +1,40 @@
#%l2n-klayout
W(TOP)
U(0.001)
K(DEVCLS MOS4 1
E(D 1 0)
EI(L 1 0)
ES(S 1 '')
EV(B 1 'false')
EN(N 1)
T(S)
T(G)
T(D)
T(B)
)
X(TOP
D(1 DEVCLS
I(dev)
E(D 17.5)
EI(L 42)
ES(S 'XYZ')
EV(B 'true')
EN(N)
T(S)
T(G)
T(D)
T(B)
)
D(2 DEVCLS
I(dev2)
E(D 0)
EI(L 0)
ES(S '')
EV(B 'false')
EN(N)
T(S)
T(G)
T(D)
T(B)
)
)

55
testdata/algo/l2n_writer_au_4.txt vendored Normal file
View File

@ -0,0 +1,55 @@
#%l2n-klayout
top(TOP)
unit(0.001)
# Layer section
# This section lists the mask layers (drawing or derived) and their connections.
# Mask layers
# Mask layer connectivity
# Device class section
class(DEVCLS MOS4 1
param(D 1 0)
param-int(L 1 0)
param-string(S 1 '')
param-var(B 1 'false')
param-nil(N 1)
terminal(S)
terminal(G)
terminal(D)
terminal(B)
)
# Circuit section
# Circuits are the hierarchical building blocks of the netlist.
circuit(TOP
# Devices and their connections
device(1 DEVCLS
name(dev)
param(D 17.5)
param-int(L 42)
param-string(S 'XYZ')
param-var(B 'true')
param-nil(N)
terminal(S)
terminal(G)
terminal(D)
terminal(B)
)
device(2 DEVCLS
name(dev2)
param(D 0)
param-int(L 0)
param-string(S '')
param-var(B 'false')
param-nil(N)
terminal(S)
terminal(G)
terminal(D)
terminal(B)
)
)

40
testdata/algo/l2n_writer_au_4s.txt vendored Normal file
View File

@ -0,0 +1,40 @@
#%l2n-klayout
W(TOP)
U(0.001)
K(DEVCLS MOS4 1
E(D 1 0)
EI(L 1 0)
ES(S 1 '')
EV(B 1 'false')
EN(N 1)
T(S)
T(G)
T(D)
T(B)
)
X(TOP
D(1 DEVCLS
I(dev)
E(D 17.5)
EI(L 42)
ES(S 'XYZ')
EV(B 'true')
EN(N)
T(S)
T(G)
T(D)
T(B)
)
D(2 DEVCLS
I(dev2)
E(D 0)
EI(L 0)
ES(S '')
EV(B 'false')
EN(N)
T(S)
T(G)
T(D)
T(B)
)
)