From 04caf13d8dedfa50fbca2befb848bbe65400e9b1 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Thu, 6 Jun 2024 20:47:55 +0200 Subject: [PATCH] Added tests for shapes_of_terminal --- src/drc/unit_tests/drcSimpleTests.cc | 42 ++++++++++++ testdata/drc/drcSimpleTests_121.drc | 89 ++++++++++++++++++++++++++ testdata/drc/drcSimpleTests_121.gds | Bin 0 -> 1990 bytes testdata/drc/drcSimpleTests_au121.gds | Bin 0 -> 2944 bytes 4 files changed, 131 insertions(+) create mode 100644 testdata/drc/drcSimpleTests_121.drc create mode 100644 testdata/drc/drcSimpleTests_121.gds create mode 100644 testdata/drc/drcSimpleTests_au121.gds diff --git a/src/drc/unit_tests/drcSimpleTests.cc b/src/drc/unit_tests/drcSimpleTests.cc index e8bbcef71..6cc8d2fb5 100644 --- a/src/drc/unit_tests/drcSimpleTests.cc +++ b/src/drc/unit_tests/drcSimpleTests.cc @@ -1869,3 +1869,45 @@ TEST(120_ShapesOfPin) db::compare_layouts (_this, layout, au, db::NoNormalization); } + +TEST(121_ShapesOfTerminal) +{ + std::string rs = tl::testdata (); + rs += "/drc/drcSimpleTests_121.drc"; + + // apart from that it's a variant of 14b ... + + std::string input = tl::testdata (); + input += "/drc/drcSimpleTests_121.gds"; + + std::string au = tl::testdata (); + au += "/drc/drcSimpleTests_au121.gds"; + + std::string output = this->tmp_file ("tmp.gds"); + + { + // Set some variables + lym::Macro config; + config.set_text (tl::sprintf ( + "$drc_test_source = '%s'\n" + "$drc_test_target = '%s'\n" + , input, output) + ); + config.set_interpreter (lym::Macro::Ruby); + EXPECT_EQ (config.run (), 0); + } + + lym::Macro drc; + drc.load_from (rs); + EXPECT_EQ (drc.run (), 0); + + db::Layout layout; + + { + tl::InputStream stream (output); + db::Reader reader (stream); + reader.read (layout); + } + + db::compare_layouts (_this, layout, au, db::NoNormalization); +} diff --git a/testdata/drc/drcSimpleTests_121.drc b/testdata/drc/drcSimpleTests_121.drc new file mode 100644 index 000000000..6e52ec8b0 --- /dev/null +++ b/testdata/drc/drcSimpleTests_121.drc @@ -0,0 +1,89 @@ + +source $drc_test_source +target $drc_test_target + +# only works flat: +# deep + +l1 = input(1, 0) +l2 = input(2, 0) +l3 = input(3, 0) + +active = input(10, 0) +poly = input(11, 0) +contact = input(12, 0) + +sd = active - poly +gate = active & poly + +name(l1, "l1") +name(l2, "l2") +name(l3, "l3") +name(sd, "sd") +name(poly, "poly") +name(gate, "gate") +name(contact, "contact") + +mos_ex = RBA::DeviceExtractorMOS3Transistor::new("MOS") +extract_devices(mos_ex, { "SD" => sd, "G" => gate, "P" => poly }) + +connect(contact, poly) +connect(contact, sd) +connect(l1, contact) +connect(l1, l2) +connect(l2, l3) + +netlist + +l1_out = polygons +l2_out = polygons +l3_out = polygons +contact_out = polygons +sd_out = polygons +gate_out = polygons +poly_out = polygons + +output_layers = { + "l1" => l1_out, + "l2" => l2_out, + "l3" => l3_out, + "contact" => contact_out, + "poly" => poly_out, + "gate" => gate_out, + "sd" => sd_out +} + +[ "A", "B", "C" ].each do |n| + + net = l2n_data.netlist.circuit_by_name("TOP").net_by_name(n) + if net + + net.each_terminal do |terminal| + shapes = l2n_data.shapes_of_terminal(terminal) + shapes.keys.each do |li| + output_layers[l2n_data.layer_name(li)].data.insert(shapes[li]) + end + end + + end + +end + +l1.output(1, 0) +l2.output(2, 0) +l3.output(3, 0) + +sd.output(10, 0) +poly.output(11, 0) +contact.output(12, 0) +gate.output(13, 0) + +l1_out.output(101, 0) +l2_out.output(102, 0) +l3_out.output(103, 0) + +sd_out.output(110, 0) +poly_out.output(111, 0) +contact_out.output(112, 0) +gate_out.output(113, 0) + diff --git a/testdata/drc/drcSimpleTests_121.gds b/testdata/drc/drcSimpleTests_121.gds new file mode 100644 index 0000000000000000000000000000000000000000..c70c6c2a8be656f0d2509b2aa2b3cd2c95fc1b02 GIT binary patch literal 1990 zcmdUwziSjx5XWctcHeF8Hr|<>9??T1T0}T7ohU(aA&oykixd)4SXzW2!6JpFg@T1e z3PFo21T8EqEK-Q2m4!(Dh!i4e5>_R7erIQgeH-$U+Fh2ODtOclNh@>+^!7NiMGZfO9$K!Mkq1h( z=k(~2_s=AUneA`bnvW$p$7S5-A36MksI?*-TatAs)!te;T0e=};dw585xr9FlgoZR z_c3{jTAWs@ohkYh)1!}K|4wrsHQj&`N;#+aYHpC3$os9+Geh^RMn4cu;7jJ&&)BDj zCDjhPdtK3+w~|}T{YQLOB{}zs@mxP5vDOOz<^o5Yv=D1;OX|SfLZ)5E?&B{YM43IU ztQ6{lD{akSnpeD1{Eys7o$ib%k&*G5kh|&Ld+9bzwa05dJ-XRT{!Yl<95LsAD5lzv m($^EBQ%|4)yPJ~LO0|QY_(jJj#QJkZRVdXC=6dvuD58JdPQSAN literal 0 HcmV?d00001 diff --git a/testdata/drc/drcSimpleTests_au121.gds b/testdata/drc/drcSimpleTests_au121.gds new file mode 100644 index 0000000000000000000000000000000000000000..e562add09327004ccc941b6f23677943b141fe87 GIT binary patch literal 2944 zcmdUxy=xRv6vgk(W@jhnW7l;x2`;)JRzWd^C`yn-Z2SOIqzJ*n(jvqlK~h*+Xd_}J z2*E<&cacsY;2Z9EVc$)h782aYAQIM}w|ryp@{Z5DcH3ssT!8%B%A^yr=Yd7t+y z%Zo_zTEu8^JlCuLzARFjc8;uE*L4^zUYc&LuTQCd;DhRo7OzkF^=oCUFaFbYYz!GK zPO82WkJtJiV*SIOoJ7*eUEoj0f`onHC`yp3b&%exu2&*`xRX5m9(B5z(Bhz1A3k?( z^DPpC+cVs&gcb*5eY<+iH}i-6bR3o7HNPsgxN|N$w{;HHA2y2A?qyaA_0E-+hVhsu zTq!y^?Q~zV(q`pmFKIJ^!0g9S2g4H z`HcUL^!mTOVLsumA;6h>fl}E1baT~sbaJ^m|lO%zv}pgP=BO( zDj6*fdiD8t=<8+p1uKK7Uw1-_gC4ze>!+z#RtBB>f!;A%yp?|Ij_OJ3+^2-p>vdm# z_02by{s$)2ztQ4gOaJ|W`X887|3-_q($gRBBdMc*qs9Gt^=)54#Ut96lpA$8hh|f4oMCv#hl@`a>f_MLzztOAtw`Vl3(c+C>pC0{!2?2jG<1?hu zJWD`}`~6c#|4L5us6qcqi~Id+UikYxsUqa%#3C*3_pj@=I$Pb17Wez7{-4*sD}Dab zEBBDK=U0_|UFlrYUfMDLGWz&y2=jyF{NVgDa(?Lb%>GZO^Y3B)rS$ZxH8kIU@l|*$ SoqrGO&**ov{vuklO@0B{V*Azr literal 0 HcmV?d00001