From d4e38721423d023dc8e5f3cae10d9379f1e85d12 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Mon, 21 Jul 2025 22:21:33 +0200 Subject: [PATCH] DRC::def_output: A simple yet useful extension to obtain the output layout and to manipulate it (within limits) --- src/doc/doc/about/drc_ref_global.xml | 29 ++++++++++++ src/doc/doc/about/drc_ref_layer.xml | 23 +++++++++- src/drc/drc/built-in-macros/_drc_engine.rb | 51 +++++++++++++++++++-- src/drc/unit_tests/drcSimpleTests.cc | 10 ++++ testdata/drc/drcSimpleTests_140.drc | 25 ++++++++++ testdata/drc/drcSimpleTests_140.gds | Bin 0 -> 634 bytes testdata/drc/drcSimpleTests_au140.gds | Bin 0 -> 890 bytes testdata/drc/drcSimpleTests_au140d.gds | Bin 0 -> 994 bytes 8 files changed, 133 insertions(+), 5 deletions(-) create mode 100644 testdata/drc/drcSimpleTests_140.drc create mode 100644 testdata/drc/drcSimpleTests_140.gds create mode 100644 testdata/drc/drcSimpleTests_au140.gds create mode 100644 testdata/drc/drcSimpleTests_au140d.gds diff --git a/src/doc/doc/about/drc_ref_global.xml b/src/doc/doc/about/drc_ref_global.xml index be5f57530..27f0d6a35 100644 --- a/src/doc/doc/about/drc_ref_global.xml +++ b/src/doc/doc/about/drc_ref_global.xml @@ -434,6 +434,28 @@ By default the interpretation of such polygons is undefined - they may even vani By setting this flag to true, the deep mode layout processor will reject such polygons with an error.

+

"def_output" - Gets an object describing the default output channel

+ +

Usage:

+
    +
  • def_output
  • +
+

+The function returns an object describing the current output channel. +This channel object can be used like the channels delivered by +new_target or new_report. +

+These readonly attributes are supported by the channel object: +

+

+

+Note, that the channel object will be modified when you use output_cell, +target or report calls that change the target. +

"device_scaling" - Specifies a dimension scale factor for the geometrical device properties

Usage:

@@ -1666,6 +1688,9 @@ The cellname specifies the top cell used for the report file. By default this is the cell name of the default source. If there is no source layout you'll need to give the cell name in the third parameter. +

+The return value of this method is a channel object of the same +type that new_report will return.

"report_netlist" - Specifies an extracted netlist report for output

@@ -2033,6 +2058,7 @@ needs to be the same - i.e. all need to render polygons or edges or edge pairs.

Usage:

    +
  • target
  • target(what [, cellname])

@@ -2055,6 +2081,9 @@ a new target will be set up. Except if the argument is a Cell object, a cellname can be specified stating the cell name under which the results are saved. If no cellname is specified, either the current cell or "TOP" is used. +

+The return value of this method is a channel object of the same +type that new_target will return.

"target_netlist" - With this statement, an extracted netlist is finally written to a file

diff --git a/src/doc/doc/about/drc_ref_layer.xml b/src/doc/doc/about/drc_ref_layer.xml index db0c26410..0a35ae1e7 100644 --- a/src/doc/doc/about/drc_ref_layer.xml +++ b/src/doc/doc/about/drc_ref_layer.xml @@ -1233,8 +1233,17 @@ Without a reference point given, the lower left corner of the fill pattern's bou as the reference point. The reference point will also defined the footprint of the fill cell - more precisely the lower left corner. When step vectors are given, the fill cell's footprint is taken to be a rectangle having the horizontal and vertical step pitch for width and height respectively. This way the fill cells -will be arrange seamlessly. However, the cell's dimensions can be changed, so that the fill cells +will be arrange seamlessly. +

+However, the cell's dimensions can be changed, so that the fill cells can overlap or there is a space between the cells. To change the dimensions use the "dim" method. +This example will use a fill cell footprint of 1x1 micrometers, regardless of the step pitch: +

+

+p = fill_pattern("FILL_CELL")
+p.shape(1, 0, box(0.0, 0.0, 1.0, 1.0))
+p.dim(1.0, 1.0)
+

The following example specifies a fill cell with an active area of -0.5 .. 1.5 in both directions (2 micron width and height). With these dimensions the fill cell's footprint is independent of the @@ -1247,6 +1256,18 @@ p.origin(-0.5, -0.5) p.dim(2.0, 2.0)

+Finally, the fill cell can be given a margin: this is a space around the fill cell which needs +to be inside the fill region. Hence, the margin can be used to implement a distance, the fill +cells (more precisely: their footprints) will maintain to the outside border of the fill region. +The following example implements a margin of 200 nm in horizontal and 250 nm in vertical direction: +

+

+p = fill_pattern("FILL_CELL")
+p.shape(1, 0, box(0.0, 0.0, 1.0, 1.0))
+p.dim(1.0, 1.0)
+p.margin(0.2, 0.25)
+
+

With these ingredients will can use the fill function. The first example fills the polygons of "to_fill" with an orthogonal pattern of 1x1 micron rectangles with a pitch of 2 microns:

diff --git a/src/drc/drc/built-in-macros/_drc_engine.rb b/src/drc/drc/built-in-macros/_drc_engine.rb index 15c6356a4..72b48de29 100644 --- a/src/drc/drc/built-in-macros/_drc_engine.rb +++ b/src/drc/drc/built-in-macros/_drc_engine.rb @@ -1579,6 +1579,9 @@ module DRC # By default this is the cell name of the default source. If there # is no source layout you'll need to give the cell name in the # third parameter. + # + # The return value of this method is a channel object of the same + # type that \global#new_report will return. def report(description, filename = nil, cellname = nil) @@ -1592,7 +1595,9 @@ module DRC @def_output = _make_report(description, filename, cellname) end - + + @def_output + end # %DRC% @@ -1713,6 +1718,7 @@ module DRC # %DRC% # @name target # @brief Specify the target layout + # @synopsis target # @synopsis target(what [, cellname]) # This function can be used to specify a target layout for output. # Subsequent calls of "output" will send their results to that target @@ -1733,12 +1739,14 @@ module DRC # Except if the argument is a RBA::Cell object, a cellname can be specified # stating the cell name under which the results are saved. If no cellname is # specified, either the current cell or "TOP" is used. - # + # + # The return value of this method is a channel object of the same + # type that \global#new_target will return. - def target(arg, cellname = nil) + def target(arg = nil, cellname = nil) self._context("target") do - + # finish what we got so far _finish(false) @@ -1747,6 +1755,41 @@ module DRC end + @def_output + + end + + # %DRC% + # @name def_output + # @brief Gets an object describing the default output channel + # @synopsis def_output + # + # The function returns an object describing the current output channel. + # This channel object can be used like the channels delivered by + # \global#new_target or \global#new_report. + # + # These readonly attributes are supported by the channel object: + # + # @ul + # @li "layout": the RBA::Layout object if the output is a layout @/li + # @li "rdb": the RBA::ReportDatabase object if the output is a report @/li + # @li "cell": a RBA::Cell object or RBA::RdbCell object, depending on the type of channel @/li + # @/ul + # + # Note, that the channel object will be modified when you use \global#output_cell, + # \global#target or \global#report calls that change the target. + + def def_output + + self._context("def_output") do + # establish an output channel if none was established so far + if ! @def_output + @def_output = LayoutOutputChannel::new(self, self._output_layout, self._output_cell, nil) + end + end + + @def_output + end # %DRC% diff --git a/src/drc/unit_tests/drcSimpleTests.cc b/src/drc/unit_tests/drcSimpleTests.cc index c618af869..c0850edb1 100644 --- a/src/drc/unit_tests/drcSimpleTests.cc +++ b/src/drc/unit_tests/drcSimpleTests.cc @@ -1993,3 +1993,13 @@ TEST(132d_sensitive_breaking) { run_test (_this, "132", true); } + +TEST(140_target_modification) +{ + run_test (_this, "140", false); +} + +TEST(140d_target_modification) +{ + run_test (_this, "140", true); +} diff --git a/testdata/drc/drcSimpleTests_140.drc b/testdata/drc/drcSimpleTests_140.drc new file mode 100644 index 000000000..488e43151 --- /dev/null +++ b/testdata/drc/drcSimpleTests_140.drc @@ -0,0 +1,25 @@ + +source $drc_test_source +target $drc_test_target + +if $drc_test_deep + deep +end + +l1 = input(1, 0) +l2 = input(2, 0) + +top_cell = def_output.cell + +# Separat 1/0 and 2/0 to two cells L1, L2 + +output_cell("L1") +top_cell.insert(RBA::DCellInstArray::new(def_output.cell, RBA::DTrans::new)) + +l1.output(1, 0) + +output_cell("L2") +top_cell.insert(RBA::DCellInstArray::new(def_output.cell, RBA::DTrans::new)) + +l2.output(2, 0) + diff --git a/testdata/drc/drcSimpleTests_140.gds b/testdata/drc/drcSimpleTests_140.gds new file mode 100644 index 0000000000000000000000000000000000000000..7bb1f39473a189eba108f8de1184acba968850d7 GIT binary patch literal 634 zcmaixF;2rk5JmsauE&-LC=j4PE^+`Q8YF~-P!iFgAVHA=MI3;Ff+NtTOBsnK1risa z-~@=0YtZEYA?BO)8Yd92WIub?|If@{C`2xi8j0T#V+-4`(CRx9(X-PIuxX>?_TZrV z@;Es>dEOh}_j^dAh1nlZ&4rPmC-Z@)$E1YX1pD=0U(;1|7n`Iww>~6A1-&v{99mBtB zY1HYH`Bm`%>^>)UKlnA>FCI_cV%|gU*j|e%&a;|OI1wh4WwTq>8+q!rcMJ^ccC;*E X>YCI~J)>9Z8Bt(Zw^OfY!p`9nmbX#+ literal 0 HcmV?d00001 diff --git a/testdata/drc/drcSimpleTests_au140.gds b/testdata/drc/drcSimpleTests_au140.gds new file mode 100644 index 0000000000000000000000000000000000000000..d6e76ce3da181db1871603195271099ba40e9200 GIT binary patch literal 890 zcmaiyJx;?w5QU$2*J}#}6cEsmf&)YX(f|!IC=DVK6e$o&K}nfw&{3p_1O){WSKtJQ z18@Ke8oCq|6cOgxyJKv~&q~&}JENJm`^K

Ku(gMIVT;hIJThl=q00?HnHgt2#V5 zyxu)|ejM$$pSJFAFS=-i)9b9YogJ7Mu!{--?2-b|tLrrVt^q;fsC#LeUIIe(#dsem zIBmd3N?Z?JeT2DFYZWdkKQ*Va zNtH2G$dHcW?3WVPiwBwHkE8z`E-&ZUv{ZlPe;W~aaSmDae0nQ gv9;Y(KHn_R=#}h0uhlhg;8uPEpK1Niu(vVz0asI;KmY&$ literal 0 HcmV?d00001 diff --git a/testdata/drc/drcSimpleTests_au140d.gds b/testdata/drc/drcSimpleTests_au140d.gds new file mode 100644 index 0000000000000000000000000000000000000000..4f9288030d84128af5fd9a9f975fa778f99fb480 GIT binary patch literal 994 zcmbu8J5Iwu5QhJKcx^#I;aPwS3Q8oD2nit}lteU$NKm9e5eJ~4;0UyIl#yssAaMZ- zPJk%623-yiFu!-b#&LKAuw?(<9nb8{H)9w`d4gET@C6~3undjW;yWT~+6OIQQ3ZR= ztL?+byTQ)>!)E`c+d&+B?PrW>0y+ZBjD&!hl>knwiqBo%$4=!rAg+O2>3}}hnTlIy z&$Z#~B2yoSs^@rKh;OrsnALjiBQKfdweeG4zdVQ4w`Xz+ j_tkJBN}Sft5#9Baog+?E#m=ciZ~K&4>f;vv30mVFLCbXZ literal 0 HcmV?d00001