-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed issue #1608 (Device extractor error shape)
- Loading branch information
Matthias Koefferlein
committed
Feb 5, 2024
1 parent
1e51cf6
commit f768be6
Showing
6 changed files
with
243 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
|
||
* cell TOP | ||
.SUBCKT TOP | ||
* cell instance $1 r180 *1 2,2.6 | ||
X$1 6 1 A | ||
* cell instance $2 r0 *1 2.2,1 | ||
X$2 6 5 A | ||
* device instance $1 r0 *1 0.8,0.75 RPP1 | ||
R$1 2 1 0.555555555556 RPP1 | ||
.ENDS TOP | ||
|
||
* cell A | ||
* pin | ||
* pin | ||
.SUBCKT A 1 2 | ||
* device instance $1 r0 *1 -0.2,0.4 RPP1 | ||
R$1 1 2 1.25 RPP1 | ||
.ENDS A |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
#%l2n-klayout | ||
W(TOP) | ||
U(0.001) | ||
L(l4 '15/0') | ||
L(l3 '16/0') | ||
L(l1) | ||
C(l4 l4 l3 l1) | ||
C(l3 l4 l3) | ||
C(l1 l4 l1) | ||
H(E B('Resistor shape does not touch marker border in exactly two places') C(TOP) X('device-extract') Q('(0.8,0.75;0.8,1.15;1,1.15;1,0.75)')) | ||
H(E B('Resistor shape does not touch marker border in exactly two places') C(TOP) X('device-extract') Q('(0,0.75;0,1.15;0.2,1.15;0.2,0.75)')) | ||
H(E B('Resistor shape does not touch marker border in exactly two places') C(A) X('device-extract') Q('(0.85,-0.4;0.85,-0.2;1.25,-0.2;1.25,-0.4)')) | ||
K(RPP1 RES) | ||
D(D$RPP1 RPP1 | ||
T(A | ||
R(l1 (0 400) (200 300)) | ||
) | ||
T(B | ||
R(l1 (0 1200) (200 250)) | ||
) | ||
) | ||
D(D$RPP1$1 RPP1 | ||
T(A | ||
R(l1 (0 0) (250 200)) | ||
) | ||
T(B | ||
R(l1 (750 0) (250 200)) | ||
) | ||
) | ||
X(A | ||
R((-200 -450) (1750 1350)) | ||
N(1 | ||
R(l4 (-150 450) (100 100)) | ||
R(l3 (-150 -150) (200 500)) | ||
R(l1 (-200 -500) (250 200)) | ||
) | ||
N(2 | ||
R(l4 (650 450) (100 100)) | ||
R(l4 (-100 -900) (100 100)) | ||
R(l3 (-150 200) (200 650)) | ||
R(l3 (-200 -1000) (200 500)) | ||
R(l1 (-250 300) (250 200)) | ||
R(l1 (-200 -1000) (250 200)) | ||
) | ||
N(3 | ||
R(l4 (1450 -350) (100 100)) | ||
) | ||
P(1) | ||
P(2) | ||
D(1 D$RPP1$1 | ||
Y(-200 400) | ||
E(R 1.25) | ||
E(L 0.5) | ||
E(W 0.2) | ||
E(A 0.1) | ||
E(P 1.4) | ||
T(A 1) | ||
T(B 2) | ||
) | ||
) | ||
X(TOP | ||
R((-50 450) (3800 2600)) | ||
N(1 | ||
R(l4 (850 2050) (100 100)) | ||
R(l3 (-150 -150) (500 200)) | ||
R(l1 (-500 -250) (200 250)) | ||
) | ||
N(2 | ||
R(l4 (850 1250) (100 100)) | ||
R(l4 (-100 -100) (100 100)) | ||
R(l4 (-900 -100) (100 100)) | ||
R(l3 (200 -150) (650 200)) | ||
R(l3 (-1000 -200) (500 200)) | ||
R(l1 (300 -250) (200 300)) | ||
R(l1 (-1000 -300) (200 250)) | ||
) | ||
N(3 | ||
R(l4 (50 450) (100 100)) | ||
) | ||
N(4 | ||
R(l4 (850 450) (100 100)) | ||
) | ||
N(5) | ||
N(6) | ||
D(1 D$RPP1 | ||
Y(800 750) | ||
E(R 0.555555555556) | ||
E(L 0.333333333333) | ||
E(W 0.3) | ||
E(A 0.1) | ||
E(P 1.26666666667) | ||
T(A 2) | ||
T(B 1) | ||
) | ||
X(1 A O(180) Y(2000 2600) | ||
P(0 6) | ||
P(1 1) | ||
) | ||
X(2 A Y(2200 1000) | ||
P(0 6) | ||
P(1 5) | ||
) | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
|
||
source($lvs_test_source, "TOP") | ||
|
||
report_netlist($lvs_test_target_l2n) | ||
target_netlist($lvs_test_target_cir) | ||
|
||
deep | ||
|
||
# ------------------------------------------------------------------- | ||
# Layers | ||
|
||
poly_dg = input(13, 0) | ||
cont = input(15, 0) | ||
met1_dg = input(16, 0) | ||
sblk = input(34, 0) | ||
rp_1 = sblk & poly_dg | ||
p1trm = poly_dg - rp_1 | ||
|
||
class ResistorExtractor < RBA::GenericDeviceExtractor | ||
|
||
def initialize(name, sheet_rho) | ||
self.name = name | ||
@sheet_rho = sheet_rho | ||
end | ||
|
||
def setup | ||
define_layer("C", "Conductor") | ||
define_layer("R", "Resistor") | ||
register_device_class(RBA::DeviceClassResistor::new) | ||
end | ||
|
||
def get_connectivity(layout, layers) | ||
# this "connectivity" forms the shape clusters that make up the device | ||
conn = RBA::Connectivity::new | ||
conn.connect(layers[0], layers[1]) # collect touching contacts | ||
conn.connect(layers[1], layers[1]) # combine resistor shapes into one area | ||
conn | ||
end | ||
|
||
def extract_devices(layer_geometry) | ||
# layer_geometry provides the input layers in the order they are defined with "define_layer" | ||
conductor = layer_geometry[0] | ||
resistor = layer_geometry[1] | ||
|
||
resistor_regions = resistor.merged | ||
|
||
resistor_regions.each do |r| | ||
terminals = conductor.interacting(RBA::Region::new(r)) | ||
if terminals.size != 2 | ||
error("Resistor shape does not touch marker border in exactly two places", r) | ||
else | ||
double_width = 0 | ||
(terminals.edges & resistor.edges).merged.each do |e| | ||
double_width += e.length | ||
end | ||
# A = L*W | ||
# -> L = A/W | ||
a = r.area*dbu*dbu | ||
w = (double_width / 2.0)*dbu | ||
l = a / w | ||
|
||
device = create_device | ||
device.set_parameter(RBA::DeviceClassResistor::PARAM_R, @sheet_rho * l / w); | ||
|
||
device.set_parameter(RBA::DeviceClassResistor::PARAM_A, a) | ||
device.set_parameter(RBA::DeviceClassResistor::PARAM_L, l) | ||
device.set_parameter(RBA::DeviceClassResistor::PARAM_P, 2*l+2*w) | ||
device.set_parameter(RBA::DeviceClassResistor::PARAM_W, w) | ||
define_terminal(device, "A", "C", terminals[0]); | ||
define_terminal(device, "B", "C", terminals[1]); | ||
end | ||
end | ||
end | ||
end | ||
|
||
extract_devices(ResistorExtractor::new("RPP1", 0.5), # intentionally wrong: 1565.15/5 | ||
{ "C" => p1trm, "R" => rp_1 }) | ||
|
||
connect(met1_dg, cont) | ||
connect(p1trm, cont) | ||
|
||
begin | ||
netlist | ||
rescue => ex | ||
end | ||
|