Persisting texts now for .l2n format

This commit is contained in:
Matthias Koefferlein 2020-05-22 00:58:46 +02:00
parent c682cc85d0
commit b84a9df2da
16 changed files with 1047 additions and 68 deletions

View File

@ -47,6 +47,7 @@ namespace l2n_std_format
DB_PUBLIC std::string LongKeys::device_key ("device");
DB_PUBLIC std::string LongKeys::polygon_key ("polygon");
DB_PUBLIC std::string LongKeys::rect_key ("rect");
DB_PUBLIC std::string LongKeys::text_key ("text");
DB_PUBLIC std::string LongKeys::terminal_key ("terminal");
DB_PUBLIC std::string LongKeys::abstract_key ("abstract");
DB_PUBLIC std::string LongKeys::param_key ("param");
@ -56,7 +57,7 @@ namespace l2n_std_format
DB_PUBLIC std::string LongKeys::scale_key ("scale");
DB_PUBLIC std::string LongKeys::pin_key ("pin");
// A, B, C, D, E, F, G, I, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y
// A, B, C, D, E, F, G, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y
DB_PUBLIC std::string ShortKeys::version_key ("V");
DB_PUBLIC std::string ShortKeys::description_key ("B");
DB_PUBLIC std::string ShortKeys::top_key ("W");
@ -72,6 +73,7 @@ namespace l2n_std_format
DB_PUBLIC std::string ShortKeys::device_key ("D");
DB_PUBLIC std::string ShortKeys::polygon_key ("Q");
DB_PUBLIC std::string ShortKeys::rect_key ("R");
DB_PUBLIC std::string ShortKeys::text_key ("J");
DB_PUBLIC std::string ShortKeys::terminal_key ("T");
DB_PUBLIC std::string ShortKeys::abstract_key ("A");
DB_PUBLIC std::string ShortKeys::param_key ("E");

View File

@ -119,6 +119,7 @@ namespace db
* "*" for <x> or <y> means take previous
* rect(<layer> [coord] [coord]) - defines a rectangle [short key: R]
* coordinates are bottom/left and top/right
* text(<layer> [text] [coord]) - defines a rectangle [short key: J]
*
* [coord]
*
@ -177,6 +178,7 @@ namespace l2n_std_format
static std::string subcircuit_key;
static std::string polygon_key;
static std::string rect_key;
static std::string text_key;
static std::string terminal_key;
static std::string abstract_key;
static std::string param_key;
@ -209,6 +211,7 @@ namespace l2n_std_format
static std::string subcircuit_key;
static std::string polygon_key;
static std::string rect_key;
static std::string text_key;
static std::string terminal_key;
static std::string abstract_key;
static std::string param_key;

View File

@ -445,8 +445,7 @@ LayoutToNetlistStandardReader::read_property (db::NetlistObject *obj)
br.done ();
}
std::pair<unsigned int, db::PolygonRef>
LayoutToNetlistStandardReader::read_geometry (db::LayoutToNetlist *l2n)
std::pair<unsigned int, NetShape> LayoutToNetlistStandardReader::read_geometry(db::LayoutToNetlist *l2n)
{
std::string lname;
@ -482,6 +481,22 @@ LayoutToNetlistStandardReader::read_geometry (db::LayoutToNetlist *l2n)
poly.assign_hull (pt.begin (), pt.end ());
return std::make_pair (lid, db::PolygonRef (poly, l2n->internal_layout ()->shape_repository ()));
} else if (test (skeys::text_key) || test (lkeys::text_key)) {
Brace br (this);
read_word_or_quoted (lname);
unsigned int lid = l2n->layer_of (layer_by_name (l2n, lname));
std::string text;
read_word_or_quoted (text);
db::Point pt = read_point ();
br.done ();
return std::make_pair (lid, db::TextRef (db::Text (text, db::Trans (pt - db::Point ())), l2n->internal_layout ()->shape_repository ()));
} else if (at_end ()) {
throw tl::Exception (tl::to_string (tr ("Unexpected end of file (polygon or rect expected)")));
} else {
@ -532,9 +547,9 @@ LayoutToNetlistStandardReader::read_geometries (db::NetlistObject *obj, Brace &b
if (test (skeys::property_key) || test (lkeys::property_key)) {
read_property (obj);
} else {
std::pair<unsigned int, db::PolygonRef> pr = read_geometry (l2n);
std::pair<unsigned int, db::NetShape> pr = read_geometry (l2n);
lc.add (pr.second, pr.first);
cell.shapes (pr.first).insert (pr.second);
pr.second.insert_into (cell.shapes (pr.first));
}
}
}

View File

@ -139,7 +139,7 @@ protected:
void read_subcircuit (Netlist *netlist, db::LayoutToNetlist *l2n, db::Circuit *circuit, ObjectMap &map, std::map<db::CellInstArray, std::list<Connections> > &connections);
bool read_trans_part (db::DCplxTrans &tr);
void read_abstract_terminal (db::LayoutToNetlist *l2n, db::DeviceAbstract *dm, db::DeviceClass *dc);
std::pair<unsigned int, db::PolygonRef> read_geometry (db::LayoutToNetlist *l2n);
std::pair<unsigned int, db::NetShape> read_geometry(db::LayoutToNetlist *l2n);
void read_property (db::NetlistObject *obj);
db::Polygon read_polygon ();
db::Box read_rect ();

View File

@ -399,33 +399,47 @@ void std_writer_impl<Keys>::reset_geometry_ref ()
template <class Keys>
void std_writer_impl<Keys>::write (const db::NetShape *s, const db::ICplxTrans &tr, const std::string &lname, bool relative)
{
if (s->type () != db::NetShape::Polygon) {
return;
}
if (s->type () == db::NetShape::Polygon) {
db::PolygonRef pr = s->polygon_ref ();
db::ICplxTrans t = tr * db::ICplxTrans (pr.trans ());
db::PolygonRef pr = s->polygon_ref ();
db::ICplxTrans t = tr * db::ICplxTrans (pr.trans ());
const db::Polygon &poly = pr.obj ();
if (poly.is_box ()) {
const db::Polygon &poly = pr.obj ();
if (poly.is_box ()) {
db::Box box = t * poly.box ();
*mp_stream << Keys::rect_key << "(" << lname;
*mp_stream << " ";
write_point (*mp_stream, box.p1 (), m_ref, relative);
*mp_stream << " ";
write_point (*mp_stream, box.p2 (), m_ref, relative);
*mp_stream << ")";
db::Box box = t * poly.box ();
*mp_stream << Keys::rect_key << "(" << lname;
*mp_stream << " ";
write_point (*mp_stream, box.p1 (), m_ref, relative);
*mp_stream << " ";
write_point (*mp_stream, box.p2 (), m_ref, relative);
*mp_stream << ")";
} else {
*mp_stream << Keys::polygon_key << "(" << lname;
if (poly.holes () > 0) {
db::SimplePolygon sp = db::polygon_to_simple_polygon (poly);
write_points (*mp_stream, sp, t, m_ref, relative);
} else {
write_points (*mp_stream, poly, t, m_ref, relative);
*mp_stream << Keys::polygon_key << "(" << lname;
if (poly.holes () > 0) {
db::SimplePolygon sp = db::polygon_to_simple_polygon (poly);
write_points (*mp_stream, sp, t, m_ref, relative);
} else {
write_points (*mp_stream, poly, t, m_ref, relative);
}
*mp_stream << ")";
}
} else if (s->type () == db::NetShape::Text) {
*mp_stream << Keys::text_key << "(" << lname;
db::TextRef txtr = s->text_ref ();
db::ICplxTrans t = tr * db::ICplxTrans (txtr.trans ());
*mp_stream << " " << tl::to_word_or_quoted_string (txtr.obj ().string ()) << " ";
db::Point pt = t * (db::Point () + txtr.obj ().trans ().disp ());
write_point (*mp_stream, pt, m_ref, relative);
*mp_stream << ")";
}

View File

@ -36,7 +36,7 @@ TEST(1_ReaderBasic)
{
db::LayoutToNetlist l2n;
std::string in_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_writer_au.txt");
std::string in_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_reader_in.txt");
tl::InputStream is_in (in_path);
db::LayoutToNetlistStandardReader reader (is_in);
@ -51,7 +51,7 @@ TEST(1_ReaderBasic)
writer.write (&l2n);
}
std::string au_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_writer_au.txt");
std::string au_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_reader_in.txt");
compare_text_files (path, au_path);
@ -246,7 +246,7 @@ TEST(1b_ReaderBasicShort)
{
db::LayoutToNetlist l2n;
std::string in_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_writer_au_s.txt");
std::string in_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_reader_in_s.txt");
tl::InputStream is_in (in_path);
db::LayoutToNetlistStandardReader reader (is_in);
@ -261,7 +261,7 @@ TEST(1b_ReaderBasicShort)
writer.write (&l2n);
}
std::string au_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_writer_au_s.txt");
std::string au_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_reader_in_s.txt");
compare_text_files (path, au_path);
}
@ -270,7 +270,7 @@ TEST(1c_ReaderBasicShortWithProps)
{
db::LayoutToNetlist l2n;
std::string in_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_writer_au_p.txt");
std::string in_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_reader_in_p.txt");
tl::InputStream is_in (in_path);
db::LayoutToNetlistStandardReader reader (is_in);
@ -285,7 +285,7 @@ TEST(1c_ReaderBasicShortWithProps)
writer.write (&l2n);
}
std::string au_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_writer_au_p.txt");
std::string au_path = tl::combine_path (tl::combine_path (tl::combine_path (tl::testsrc (), "testdata"), "algo"), "l2n_reader_in_p.txt");
compare_text_files (path, au_path);
@ -314,7 +314,7 @@ TEST(1c_ReaderBasicShortWithProps)
std::string au = tl::testsrc ();
au = tl::combine_path (au, "testdata");
au = tl::combine_path (au, "algo");
au = tl::combine_path (au, "l2n_writer_au_p.oas");
au = tl::combine_path (au, "l2n_reader_au_p.oas");
db::compare_layouts (_this, ly2, au, db::WriteOAS);
}

View File

@ -96,15 +96,13 @@ TEST(3)
s.transform (db::Disp (db::Vector (10, 20)));
EXPECT_EQ (s == s2, false);
EXPECT_EQ (s != s2, true);
EXPECT_EQ (s < s2, false);
EXPECT_EQ (s2 < s, true);
EXPECT_EQ ((s < s2) != (s2 < s), true);
db::Text t ("abc", db::Trans (db::Vector (100, 200)));
s = db::NetShape (t, repo);
EXPECT_EQ (s == s2, false);
EXPECT_EQ (s != s2, true);
EXPECT_EQ (s < s2, true);
EXPECT_EQ (s2 < s, false);
EXPECT_EQ ((s < s2) != (s2 < s), true);
s2 = s;
EXPECT_EQ (s == db::NetShape (), false);
@ -117,8 +115,7 @@ TEST(3)
s.transform (db::Disp (db::Vector (10, 20)));
EXPECT_EQ (s == s2, false);
EXPECT_EQ (s != s2, true);
EXPECT_EQ (s < s2, false);
EXPECT_EQ (s2 < s, true);
EXPECT_EQ ((s < s2) != (s2 < s), true);
}
TEST(4)

BIN
testdata/algo/l2n_reader_au_p.oas vendored Normal file

Binary file not shown.

334
testdata/algo/l2n_reader_in.txt vendored Normal file
View File

@ -0,0 +1,334 @@
#%l2n-klayout
top(RINGO)
unit(0.001)
# Layer section
# This section lists the mask layers (drawing or derived) and their connections.
# Mask layers
layer(poly '3/0')
layer(poly_lbl '3/1')
layer(diff_cont '4/0')
layer(poly_cont '5/0')
layer(metal1 '6/0')
layer(metal1_lbl '6/1')
layer(via1 '7/0')
layer(metal2 '8/0')
layer(metal2_lbl '8/1')
layer(psd)
layer(nsd)
# Mask layer connectivity
connect(poly poly poly_lbl poly_cont)
connect(poly_lbl poly)
connect(diff_cont diff_cont metal1 psd nsd)
connect(poly_cont poly poly_cont metal1)
connect(metal1 diff_cont poly_cont metal1 metal1_lbl via1)
connect(metal1_lbl metal1)
connect(via1 metal1 via1 metal2)
connect(metal2 via1 metal2 metal2_lbl)
connect(metal2_lbl metal2)
connect(psd diff_cont psd)
connect(nsd diff_cont nsd)
# Device class section
class(PMOS MOS3)
class(NMOS MOS3)
# Device abstracts section
# Device abstracts list the pin shapes of the devices.
device(D$PMOS PMOS
terminal(S
rect(psd (-650 -475) (525 950))
)
terminal(G
rect(poly (-125 -475) (250 950))
)
terminal(D
rect(psd (125 -475) (550 950))
)
)
device(D$PMOS$1 PMOS
terminal(S
rect(psd (-675 -475) (550 950))
)
terminal(G
rect(poly (-125 -475) (250 950))
)
terminal(D
rect(psd (125 -475) (525 950))
)
)
device(D$NMOS NMOS
terminal(S
rect(nsd (-650 -475) (525 950))
)
terminal(G
rect(poly (-125 -475) (250 950))
)
terminal(D
rect(nsd (125 -475) (550 950))
)
)
device(D$NMOS$1 NMOS
terminal(S
rect(nsd (-675 -475) (550 950))
)
terminal(G
rect(poly (-125 -475) (250 950))
)
terminal(D
rect(nsd (125 -475) (525 950))
)
)
# Circuit section
# Circuits are the hierarchical building blocks of the netlist.
circuit(INV2
# Circuit boundary
rect((-1700 -800) (3100 4600))
# Nets with their geometries
net(1 name(IN)
rect(poly (-525 -250) (250 2500))
rect(poly (-1425 -630) (1300 360))
rect(poly (-125 -2780) (250 1600))
rect(poly (-250 1200) (250 1600))
text(poly_lbl IN (-525 -1800))
rect(poly_cont (-830 -110) (220 220))
)
net(2
rect(poly (275 -250) (250 2500))
rect(poly (-305 -1430) (360 360))
rect(poly (-305 820) (250 1600))
rect(poly (-250 -4400) (250 1600))
rect(diff_cont (-1435 1690) (220 220))
rect(diff_cont (-220 180) (220 220))
rect(diff_cont (-220 -3420) (220 220))
rect(diff_cont (-220 180) (220 220))
rect(poly_cont (980 580) (220 220))
rect(metal1 (-1310 -290) (1380 360))
rect(metal1 (-1560 -1600) (360 2840))
rect(metal1 (-360 0) (360 760))
rect(metal1 (-360 -3560) (360 760))
rect(psd (-430 1945) (525 950))
rect(nsd (-525 -3750) (525 950))
)
net(3 name(OUT)
rect(diff_cont (690 2890) (220 220))
rect(diff_cont (-220 -620) (220 220))
rect(diff_cont (-220 -2620) (220 220))
rect(diff_cont (-220 -620) (220 220))
polygon(metal1 (-110 110) (0 360) (140 0) (0 1240) (-320 0) (0 800) (360 0) (0 -440) (320 0) (0 -1960))
rect(metal1 (-680 2400) (360 760))
rect(metal1 (-360 -3560) (360 760))
text(metal1_lbl OUT (-180 1420))
rect(psd (-275 525) (525 950))
rect(nsd (-525 -3750) (525 950))
)
net(4
rect(diff_cont (-110 -310) (220 220))
rect(diff_cont (-220 180) (220 220))
rect(diff_cont (-220 -220) (220 220))
rect(diff_cont (-220 -620) (220 220))
rect(metal1 (-290 -290) (360 760))
rect(metal1 (-360 -760) (360 760))
rect(via1 (-305 -705) (250 250))
rect(via1 (-250 150) (250 250))
rect(metal2 (-1525 -775) (2800 900))
rect(nsd (-1675 -925) (550 950))
)
net(5
rect(diff_cont (-110 2490) (220 220))
rect(diff_cont (-220 180) (220 220))
rect(diff_cont (-220 -220) (220 220))
rect(diff_cont (-220 -620) (220 220))
rect(metal1 (-290 -290) (360 760))
rect(metal1 (-360 -760) (360 760))
rect(via1 (-305 -705) (250 250))
rect(via1 (-250 150) (250 250))
rect(metal2 (-1525 -775) (2800 900))
rect(psd (-1675 -925) (550 950))
)
# Outgoing pins and their connections to nets
pin(1 name(IN))
pin(2)
pin(3 name(OUT))
pin(4)
pin(5)
# Devices and their connections
device(1 D$PMOS
location(-400 2800)
param(L 0.25)
param(W 0.95)
param(AS 0.49875)
param(AD 0.26125)
param(PS 2.95)
param(PD 1.5)
terminal(S 2)
terminal(G 1)
terminal(D 5)
)
device(2 D$PMOS$1
location(400 2800)
param(L 0.25)
param(W 0.95)
param(AS 0.26125)
param(AD 0.49875)
param(PS 1.5)
param(PD 2.95)
terminal(S 5)
terminal(G 2)
terminal(D 3)
)
device(3 D$NMOS
location(-400 0)
param(L 0.25)
param(W 0.95)
param(AS 0.49875)
param(AD 0.26125)
param(PS 2.95)
param(PD 1.5)
terminal(S 2)
terminal(G 1)
terminal(D 4)
)
device(4 D$NMOS$1
location(400 0)
param(L 0.25)
param(W 0.95)
param(AS 0.26125)
param(AD 0.49875)
param(PS 1.5)
param(PD 2.95)
terminal(S 4)
terminal(G 2)
terminal(D 3)
)
)
circuit(RINGO
# Circuit boundary
rect((-1720 -800) (26880 4600))
# Nets with their geometries
net(1 name(FB)
rect(metal1 (-1700 1620) (360 360))
rect(via1 (-305 -305) (250 250))
rect(via1 (24230 -250) (250 250))
rect(metal2 (-24805 -325) (24880 400))
text(metal2_lbl FB (-23160 -200))
)
net(2 name(OSC)
rect(via1 (24435 1675) (250 250))
rect(metal2 (-325 -325) (400 400))
text(metal2_lbl OSC (-200 -200))
)
net(3 name(VSS)
text(metal2_lbl VSS (0 0))
)
net(4 name(VDD)
text(metal2_lbl VDD (0 2800))
)
net(5)
net(6)
net(7)
net(8)
net(9)
net(10)
net(11)
net(12)
net(13)
net(14)
net(15)
net(16)
net(17)
net(18)
net(19)
net(20)
net(21)
net(22)
# Outgoing pins and their connections to nets
pin(1 name(FB))
pin(2 name(OSC))
pin(3 name(VSS))
pin(4 name(VDD))
# Subcircuits and their connections
circuit(1 INV2 location(23760 0)
pin(0 15)
pin(1 1)
pin(2 2)
pin(3 3)
pin(4 4)
)
circuit(2 INV2 location(0 0)
pin(0 1)
pin(1 13)
pin(2 14)
pin(3 3)
pin(4 4)
)
circuit(3 INV2 location(2640 0)
pin(0 14)
pin(1 12)
pin(2 22)
pin(3 3)
pin(4 4)
)
circuit(4 INV2 location(5280 0)
pin(0 22)
pin(1 11)
pin(2 21)
pin(3 3)
pin(4 4)
)
circuit(5 INV2 location(7920 0)
pin(0 21)
pin(1 10)
pin(2 20)
pin(3 3)
pin(4 4)
)
circuit(6 INV2 location(10560 0)
pin(0 20)
pin(1 9)
pin(2 19)
pin(3 3)
pin(4 4)
)
circuit(7 INV2 location(13200 0)
pin(0 19)
pin(1 8)
pin(2 18)
pin(3 3)
pin(4 4)
)
circuit(8 INV2 location(15840 0)
pin(0 18)
pin(1 7)
pin(2 17)
pin(3 3)
pin(4 4)
)
circuit(9 INV2 location(18480 0)
pin(0 17)
pin(1 6)
pin(2 16)
pin(3 3)
pin(4 4)
)
circuit(10 INV2 location(21120 0)
pin(0 16)
pin(1 5)
pin(2 15)
pin(3 3)
pin(4 4)
)
)

313
testdata/algo/l2n_reader_in_p.txt vendored Normal file
View File

@ -0,0 +1,313 @@
#%l2n-klayout
W(RINGO)
U(0.001)
L(poly '3/0')
L(poly_lbl '3/1')
L(diff_cont '4/0')
L(poly_cont '5/0')
L(metal1 '6/0')
L(metal1_lbl '6/1')
L(via1 '7/0')
L(metal2 '8/0')
L(metal2_lbl '8/1')
L(psd)
L(nsd)
C(poly poly poly_lbl poly_cont)
C(poly_lbl poly)
C(diff_cont diff_cont metal1 psd nsd)
C(poly_cont poly poly_cont metal1)
C(metal1 diff_cont poly_cont metal1 metal1_lbl via1)
C(metal1_lbl metal1)
C(via1 metal1 via1 metal2)
C(metal2 via1 metal2 metal2_lbl)
C(metal2_lbl metal2)
C(psd diff_cont psd)
C(nsd diff_cont nsd)
K(PMOS MOS3)
K(NMOS MOS3)
D(D$PMOS PMOS
T(S
R(psd (-650 -475) (525 950))
)
T(G
R(poly (-125 -475) (250 950))
)
T(D
R(psd (125 -475) (550 950))
)
)
D(D$PMOS$1 PMOS
T(S
R(psd (-675 -475) (550 950))
)
T(G
R(poly (-125 -475) (250 950))
)
T(D
R(psd (125 -475) (525 950))
)
)
D(D$NMOS NMOS
T(S
R(nsd (-650 -475) (525 950))
)
T(G
R(poly (-125 -475) (250 950))
)
T(D
R(nsd (125 -475) (550 950))
)
)
D(D$NMOS$1 NMOS
T(S
R(nsd (-675 -475) (550 950))
)
T(G
R(poly (-125 -475) (250 950))
)
T(D
R(nsd (125 -475) (525 950))
)
)
X(INV2
R((-1700 -800) (3100 4600))
N(1 I(IN)
R(poly (-525 -250) (250 2500))
R(poly (-1425 -630) (1300 360))
R(poly (-125 -2780) (250 1600))
R(poly (-250 1200) (250 1600))
J(poly_lbl IN (-525 -1800))
R(poly_cont (-830 -110) (220 220))
)
N(2
R(poly (275 -250) (250 2500))
R(poly (-305 -1430) (360 360))
R(poly (-305 820) (250 1600))
R(poly (-250 -4400) (250 1600))
R(diff_cont (-1435 1690) (220 220))
R(diff_cont (-220 180) (220 220))
R(diff_cont (-220 -3420) (220 220))
R(diff_cont (-220 180) (220 220))
R(poly_cont (980 580) (220 220))
R(metal1 (-1310 -290) (1380 360))
R(metal1 (-1560 -1600) (360 2840))
R(metal1 (-360 0) (360 760))
R(metal1 (-360 -3560) (360 760))
R(psd (-430 1945) (525 950))
R(nsd (-525 -3750) (525 950))
)
N(3 I(OUT)
R(diff_cont (690 2890) (220 220))
R(diff_cont (-220 -620) (220 220))
R(diff_cont (-220 -2620) (220 220))
R(diff_cont (-220 -620) (220 220))
Q(metal1 (-110 110) (0 360) (140 0) (0 1240) (-320 0) (0 800) (360 0) (0 -440) (320 0) (0 -1960))
R(metal1 (-680 2400) (360 760))
R(metal1 (-360 -3560) (360 760))
J(metal1_lbl OUT (-180 1420))
R(psd (-275 525) (525 950))
R(nsd (-525 -3750) (525 950))
)
N(4
R(diff_cont (-110 -310) (220 220))
R(diff_cont (-220 180) (220 220))
R(diff_cont (-220 -220) (220 220))
R(diff_cont (-220 -620) (220 220))
R(metal1 (-290 -290) (360 760))
R(metal1 (-360 -760) (360 760))
R(via1 (-305 -705) (250 250))
R(via1 (-250 150) (250 250))
R(metal2 (-1525 -775) (2800 900))
R(nsd (-1675 -925) (550 950))
)
N(5
R(diff_cont (-110 2490) (220 220))
R(diff_cont (-220 180) (220 220))
R(diff_cont (-220 -220) (220 220))
R(diff_cont (-220 -620) (220 220))
R(metal1 (-290 -290) (360 760))
R(metal1 (-360 -760) (360 760))
R(via1 (-305 -705) (250 250))
R(via1 (-250 150) (250 250))
R(metal2 (-1525 -775) (2800 900))
R(psd (-1675 -925) (550 950))
)
P(1 I(IN))
P(2)
P(3 I(OUT))
P(4)
P(5)
D(1 D$PMOS
Y(-400 2800)
F(#17 #242)
F('a_"non_quoted"_string' '2s')
F('a_float' ##20.5)
E(L 0.25)
E(W 0.95)
E(AS 0.49875)
E(AD 0.26125)
E(PS 2.95)
E(PD 1.5)
T(S 2)
T(G 1)
T(D 5)
)
D(2 D$PMOS$1
Y(400 2800)
E(L 0.25)
E(W 0.95)
E(AS 0.26125)
E(AD 0.49875)
E(PS 1.5)
E(PD 2.95)
T(S 5)
T(G 2)
T(D 3)
)
D(3 D$NMOS
Y(-400 0)
E(L 0.25)
E(W 0.95)
E(AS 0.49875)
E(AD 0.26125)
E(PS 2.95)
E(PD 1.5)
T(S 2)
T(G 1)
T(D 4)
)
D(4 D$NMOS$1
Y(400 0)
E(L 0.25)
E(W 0.95)
E(AS 0.26125)
E(AD 0.49875)
E(PS 1.5)
E(PD 2.95)
T(S 4)
T(G 2)
T(D 3)
)
)
X(RINGO
R((-1720 -800) (26880 4600))
F(#17 #42)
F('a_"non_quoted"_string' 's')
F('a_float' ##0.5)
N(1 I(FB)
F(#17 #142)
F('a_"non_quoted"_string' '1s')
F('a_float' ##10.5)
R(metal1 (-1700 1620) (360 360))
R(via1 (-305 -305) (250 250))
R(via1 (24230 -250) (250 250))
R(metal2 (-24805 -325) (24880 400))
J(metal2_lbl FB (-23160 -200))
)
N(2 I(OSC)
R(via1 (24435 1675) (250 250))
R(metal2 (-325 -325) (400 400))
J(metal2_lbl OSC (-200 -200))
)
N(3 I(VSS)
J(metal2_lbl VSS (0 0))
)
N(4 I(VDD)
J(metal2_lbl VDD (0 2800))
)
N(5)
N(6)
N(7)
N(8)
N(9)
N(10)
N(11)
N(12)
N(13)
N(14)
N(15)
N(16)
N(17)
N(18)
N(19)
N(20)
N(21)
N(22)
P(1 I(FB))
P(2 I(OSC))
P(3 I(VSS))
P(4 I(VDD))
X(1 INV2 Y(23760 0)
F(#17 #342)
F('a_"non_quoted"_string' '3s')
F('a_float' ##30.5)
P(0 15)
P(1 1)
P(2 2)
P(3 3)
P(4 4)
)
X(2 INV2 Y(0 0)
P(0 1)
P(1 13)
P(2 14)
P(3 3)
P(4 4)
)
X(3 INV2 Y(2640 0)
P(0 14)
P(1 12)
P(2 22)
P(3 3)
P(4 4)
)
X(4 INV2 Y(5280 0)
P(0 22)
P(1 11)
P(2 21)
P(3 3)
P(4 4)
)
X(5 INV2 Y(7920 0)
P(0 21)
P(1 10)
P(2 20)
P(3 3)
P(4 4)
)
X(6 INV2 Y(10560 0)
P(0 20)
P(1 9)
P(2 19)
P(3 3)
P(4 4)
)
X(7 INV2 Y(13200 0)
P(0 19)
P(1 8)
P(2 18)
P(3 3)
P(4 4)
)
X(8 INV2 Y(15840 0)
P(0 18)
P(1 7)
P(2 17)
P(3 3)
P(4 4)
)
X(9 INV2 Y(18480 0)
P(0 17)
P(1 6)
P(2 16)
P(3 3)
P(4 4)
)
X(10 INV2 Y(21120 0)
P(0 16)
P(1 5)
P(2 15)
P(3 3)
P(4 4)
)
)

301
testdata/algo/l2n_reader_in_s.txt vendored Normal file
View File

@ -0,0 +1,301 @@
#%l2n-klayout
W(RINGO)
U(0.001)
L(poly '3/0')
L(poly_lbl '3/1')
L(diff_cont '4/0')
L(poly_cont '5/0')
L(metal1 '6/0')
L(metal1_lbl '6/1')
L(via1 '7/0')
L(metal2 '8/0')
L(metal2_lbl '8/1')
L(psd)
L(nsd)
C(poly poly poly_lbl poly_cont)
C(poly_lbl poly)
C(diff_cont diff_cont metal1 psd nsd)
C(poly_cont poly poly_cont metal1)
C(metal1 diff_cont poly_cont metal1 metal1_lbl via1)
C(metal1_lbl metal1)
C(via1 metal1 via1 metal2)
C(metal2 via1 metal2 metal2_lbl)
C(metal2_lbl metal2)
C(psd diff_cont psd)
C(nsd diff_cont nsd)
K(PMOS MOS3)
K(NMOS MOS3)
D(D$PMOS PMOS
T(S
R(psd (-650 -475) (525 950))
)
T(G
R(poly (-125 -475) (250 950))
)
T(D
R(psd (125 -475) (550 950))
)
)
D(D$PMOS$1 PMOS
T(S
R(psd (-675 -475) (550 950))
)
T(G
R(poly (-125 -475) (250 950))
)
T(D
R(psd (125 -475) (525 950))
)
)
D(D$NMOS NMOS
T(S
R(nsd (-650 -475) (525 950))
)
T(G
R(poly (-125 -475) (250 950))
)
T(D
R(nsd (125 -475) (550 950))
)
)
D(D$NMOS$1 NMOS
T(S
R(nsd (-675 -475) (550 950))
)
T(G
R(poly (-125 -475) (250 950))
)
T(D
R(nsd (125 -475) (525 950))
)
)
X(INV2
R((-1700 -800) (3100 4600))
N(1 I(IN)
R(poly (-525 -250) (250 2500))
R(poly (-1425 -630) (1300 360))
R(poly (-125 -2780) (250 1600))
R(poly (-250 1200) (250 1600))
J(poly_lbl IN (-525 -1800))
R(poly_cont (-830 -110) (220 220))
)
N(2
R(poly (275 -250) (250 2500))
R(poly (-305 -1430) (360 360))
R(poly (-305 820) (250 1600))
R(poly (-250 -4400) (250 1600))
R(diff_cont (-1435 1690) (220 220))
R(diff_cont (-220 180) (220 220))
R(diff_cont (-220 -3420) (220 220))
R(diff_cont (-220 180) (220 220))
R(poly_cont (980 580) (220 220))
R(metal1 (-1310 -290) (1380 360))
R(metal1 (-1560 -1600) (360 2840))
R(metal1 (-360 0) (360 760))
R(metal1 (-360 -3560) (360 760))
R(psd (-430 1945) (525 950))
R(nsd (-525 -3750) (525 950))
)
N(3 I(OUT)
R(diff_cont (690 2890) (220 220))
R(diff_cont (-220 -620) (220 220))
R(diff_cont (-220 -2620) (220 220))
R(diff_cont (-220 -620) (220 220))
Q(metal1 (-110 110) (0 360) (140 0) (0 1240) (-320 0) (0 800) (360 0) (0 -440) (320 0) (0 -1960))
R(metal1 (-680 2400) (360 760))
R(metal1 (-360 -3560) (360 760))
J(metal1_lbl OUT (-180 1420))
R(psd (-275 525) (525 950))
R(nsd (-525 -3750) (525 950))
)
N(4
R(diff_cont (-110 -310) (220 220))
R(diff_cont (-220 180) (220 220))
R(diff_cont (-220 -220) (220 220))
R(diff_cont (-220 -620) (220 220))
R(metal1 (-290 -290) (360 760))
R(metal1 (-360 -760) (360 760))
R(via1 (-305 -705) (250 250))
R(via1 (-250 150) (250 250))
R(metal2 (-1525 -775) (2800 900))
R(nsd (-1675 -925) (550 950))
)
N(5
R(diff_cont (-110 2490) (220 220))
R(diff_cont (-220 180) (220 220))
R(diff_cont (-220 -220) (220 220))
R(diff_cont (-220 -620) (220 220))
R(metal1 (-290 -290) (360 760))
R(metal1 (-360 -760) (360 760))
R(via1 (-305 -705) (250 250))
R(via1 (-250 150) (250 250))
R(metal2 (-1525 -775) (2800 900))
R(psd (-1675 -925) (550 950))
)
P(1 I(IN))
P(2)
P(3 I(OUT))
P(4)
P(5)
D(1 D$PMOS
Y(-400 2800)
E(L 0.25)
E(W 0.95)
E(AS 0.49875)
E(AD 0.26125)
E(PS 2.95)
E(PD 1.5)
T(S 2)
T(G 1)
T(D 5)
)
D(2 D$PMOS$1
Y(400 2800)
E(L 0.25)
E(W 0.95)
E(AS 0.26125)
E(AD 0.49875)
E(PS 1.5)
E(PD 2.95)
T(S 5)
T(G 2)
T(D 3)
)
D(3 D$NMOS
Y(-400 0)
E(L 0.25)
E(W 0.95)
E(AS 0.49875)
E(AD 0.26125)
E(PS 2.95)
E(PD 1.5)
T(S 2)
T(G 1)
T(D 4)
)
D(4 D$NMOS$1
Y(400 0)
E(L 0.25)
E(W 0.95)
E(AS 0.26125)
E(AD 0.49875)
E(PS 1.5)
E(PD 2.95)
T(S 4)
T(G 2)
T(D 3)
)
)
X(RINGO
R((-1720 -800) (26880 4600))
N(1 I(FB)
R(metal1 (-1700 1620) (360 360))
R(via1 (-305 -305) (250 250))
R(via1 (24230 -250) (250 250))
R(metal2 (-24805 -325) (24880 400))
J(metal2_lbl FB (-23160 -200))
)
N(2 I(OSC)
R(via1 (24435 1675) (250 250))
R(metal2 (-325 -325) (400 400))
J(metal2_lbl OSC (-200 -200))
)
N(3 I(VSS)
J(metal2_lbl VSS (0 0))
)
N(4 I(VDD)
J(metal2_lbl VDD (0 2800))
)
N(5)
N(6)
N(7)
N(8)
N(9)
N(10)
N(11)
N(12)
N(13)
N(14)
N(15)
N(16)
N(17)
N(18)
N(19)
N(20)
N(21)
N(22)
P(1 I(FB))
P(2 I(OSC))
P(3 I(VSS))
P(4 I(VDD))
X(1 INV2 Y(23760 0)
P(0 15)
P(1 1)
P(2 2)
P(3 3)
P(4 4)
)
X(2 INV2 Y(0 0)
P(0 1)
P(1 13)
P(2 14)
P(3 3)
P(4 4)
)
X(3 INV2 Y(2640 0)
P(0 14)
P(1 12)
P(2 22)
P(3 3)
P(4 4)
)
X(4 INV2 Y(5280 0)
P(0 22)
P(1 11)
P(2 21)
P(3 3)
P(4 4)
)
X(5 INV2 Y(7920 0)
P(0 21)
P(1 10)
P(2 20)
P(3 3)
P(4 4)
)
X(6 INV2 Y(10560 0)
P(0 20)
P(1 9)
P(2 19)
P(3 3)
P(4 4)
)
X(7 INV2 Y(13200 0)
P(0 19)
P(1 8)
P(2 18)
P(3 3)
P(4 4)
)
X(8 INV2 Y(15840 0)
P(0 18)
P(1 7)
P(2 17)
P(3 3)
P(4 4)
)
X(9 INV2 Y(18480 0)
P(0 17)
P(1 6)
P(2 16)
P(3 3)
P(4 4)
)
X(10 INV2 Y(21120 0)
P(0 16)
P(1 5)
P(2 15)
P(3 3)
P(4 4)
)
)

View File

@ -95,8 +95,8 @@ circuit(INV2
rect(poly (-1425 -630) (1300 360))
rect(poly (-125 -2780) (250 1600))
rect(poly (-250 1200) (250 1600))
rect(poly_cont (-1355 -1910) (220 220))
text(poly_lbl IN (-525 -1800))
rect(poly_cont (-830 -110) (220 220))
)
net(2
rect(poly (275 -250) (250 2500))
@ -123,8 +123,8 @@ circuit(INV2
polygon(metal1 (-110 110) (0 360) (140 0) (0 1240) (-320 0) (0 800) (360 0) (0 -440) (320 0) (0 -1960))
rect(metal1 (-680 2400) (360 760))
rect(metal1 (-360 -3560) (360 760))
rect(psd (-455 1945) (525 950))
text(metal1_lbl OUT (-180 1420))
rect(psd (-275 525) (525 950))
rect(nsd (-525 -3750) (525 950))
)
net(4
@ -221,18 +221,18 @@ circuit(RINGO
rect(via1 (-305 -305) (250 250))
rect(via1 (24230 -250) (250 250))
rect(metal2 (-24805 -325) (24880 400))
text(metal2_lbl FB (-23160 -200))
)
net(2 name(OSC)
rect(via1 (24435 1675) (250 250))
rect(metal2 (-325 -325) (400 400))
text(metal2_lbl OSC (-200 -200))
)
net(3 name(VSS)
text(metal2_lbl VSS (0 0))
)
net(4 name(VDD)
text(metal2_lbl VDD (0 2800))
)
net(5)
net(6)

View File

@ -76,8 +76,8 @@ X(INV2
R(poly (-1425 -630) (1300 360))
R(poly (-125 -2780) (250 1600))
R(poly (-250 1200) (250 1600))
R(poly_cont (-1355 -1910) (220 220))
J(poly_lbl IN (-525 -1800))
R(poly_cont (-830 -110) (220 220))
)
N(2
R(poly (275 -250) (250 2500))
@ -104,8 +104,8 @@ X(INV2
Q(metal1 (-110 110) (0 360) (140 0) (0 1240) (-320 0) (0 800) (360 0) (0 -440) (320 0) (0 -1960))
R(metal1 (-680 2400) (360 760))
R(metal1 (-360 -3560) (360 760))
R(psd (-455 1945) (525 950))
J(metal1_lbl OUT (-180 1420))
R(psd (-275 525) (525 950))
R(nsd (-525 -3750) (525 950))
)
N(4
@ -202,18 +202,18 @@ X(RINGO
R(via1 (-305 -305) (250 250))
R(via1 (24230 -250) (250 250))
R(metal2 (-24805 -325) (24880 400))
J(metal2_lbl FB (-23160 -200))
)
N(2 I(OSC)
R(via1 (24435 1675) (250 250))
R(metal2 (-325 -325) (400 400))
J(metal2_lbl OSC (-200 -200))
)
N(3 I(VSS)
J(metal2_lbl VSS (0 0))
)
N(4 I(VDD)
J(metal2_lbl VDD (0 2800))
)
N(5)
N(6)

View File

@ -76,8 +76,8 @@ X(INV2
R(poly (-1425 -630) (1300 360))
R(poly (-125 -2780) (250 1600))
R(poly (-250 1200) (250 1600))
R(poly_cont (-1355 -1910) (220 220))
J(poly_lbl IN (-525 -1800))
R(poly_cont (-830 -110) (220 220))
)
N(2
R(poly (275 -250) (250 2500))
@ -104,8 +104,8 @@ X(INV2
Q(metal1 (-110 110) (0 360) (140 0) (0 1240) (-320 0) (0 800) (360 0) (0 -440) (320 0) (0 -1960))
R(metal1 (-680 2400) (360 760))
R(metal1 (-360 -3560) (360 760))
R(psd (-455 1945) (525 950))
J(metal1_lbl OUT (-180 1420))
R(psd (-275 525) (525 950))
R(nsd (-525 -3750) (525 950))
)
N(4
@ -193,18 +193,18 @@ X(RINGO
R(via1 (-305 -305) (250 250))
R(via1 (24230 -250) (250 250))
R(metal2 (-24805 -325) (24880 400))
J(metal2_lbl FB (-23160 -200))
)
N(2 I(OSC)
R(via1 (24435 1675) (250 250))
R(metal2 (-325 -325) (400 400))
J(metal2_lbl OSC (-200 -200))
)
N(3 I(VSS)
J(metal2_lbl VSS (0 0))
)
N(4 I(VDD)
J(metal2_lbl VDD (0 2800))
)
N(5)
N(6)

View File

@ -443,7 +443,7 @@ end;
l2n = pya.LayoutToNetlist()
infile = os.path.join(ut_testsrc, "testdata", "algo", "l2n_writer_au.txt")
infile = os.path.join(ut_testsrc, "testdata", "algo", "l2n_reader_in.txt")
l2n.read(infile)
tmp = os.path.join(ut_testtmp, "tmp.txt")

View File

@ -68,7 +68,7 @@ class DBLayoutToNetlist_TestClass < TestBase
# cell mapping with nets
l2n = RBA::LayoutToNetlist::new
l2n.read(File.join($ut_testsrc, "testdata", "algo", "l2n_writer_au.txt"))
l2n.read(File.join($ut_testsrc, "testdata", "algo", "l2n_reader_in.txt"))
nets = [
l2n.netlist.circuit_by_name("RINGO").net_by_name("VSS"),
@ -481,7 +481,7 @@ END
l2n = RBA::LayoutToNetlist::new
input = File.join($ut_testsrc, "testdata", "algo", "l2n_writer_au.txt")
input = File.join($ut_testsrc, "testdata", "algo", "l2n_reader_in.txt")
l2n.read(input)
tmp = File::join($ut_testtmp, "tmp.txt")
@ -499,7 +499,7 @@ END
l2n = RBA::LayoutToNetlist::new
input = File.join($ut_testsrc, "testdata", "algo", "l2n_writer_au.txt")
input = File.join($ut_testsrc, "testdata", "algo", "l2n_reader_in.txt")
l2n.read(input)
# build_all_nets