mirror of
https://github.com/KLayout/klayout.git
synced 2026-08-29 01:14:35 +02:00
Added LVS tests, updated doc.
This commit is contained in:
Vendored
BIN
Binary file not shown.
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
* Extracted by KLayout
|
||||
|
||||
* cell Res2
|
||||
.SUBCKT Res2
|
||||
* device instance $1 r0 *1 110.14,51.795 RPP1
|
||||
R$1 1 2 95 RPP1 L=420U W=2.21052631579U
|
||||
.ENDS Res2
|
||||
Vendored
+96
@@ -0,0 +1,96 @@
|
||||
source($lvs_test_source)
|
||||
report_lvs($lvs_test_target_lvsdb, true)
|
||||
target_netlist($lvs_test_target_cir, write_spice, "Extracted by KLayout")
|
||||
|
||||
schematic("res_combine_schematic.cir")
|
||||
deep
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Layers
|
||||
|
||||
pimp = input(7, 0)
|
||||
poly_dg = input(13, 0)
|
||||
cont = input(15, 0)
|
||||
met1_dg = input(16, 0)
|
||||
sblk = input(34, 0)
|
||||
rp_1 = sblk & poly_dg
|
||||
rpp1 = rp_1 & pimp
|
||||
p1trm = poly_dg - rpp1
|
||||
|
||||
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(resistor)
|
||||
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, RBA::DeviceClassResistor::TERMINAL_A, 0, terminals[0]);
|
||||
define_terminal(device, RBA::DeviceClassResistor::TERMINAL_B, 0, terminals[1]);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# enable/disable
|
||||
enable_parameter("RPP1", "L")
|
||||
enable_parameter("RPP1", "W")
|
||||
disable_parameter("RPP1", "R")
|
||||
|
||||
extract_devices(ResistorExtractor::new("RPP1", 0.5), # intentionally wrong: 1565.15/5
|
||||
{ "C" => p1trm, "R" => rpp1 })
|
||||
|
||||
connect(met1_dg, cont)
|
||||
connect(p1trm, cont)
|
||||
|
||||
netlist.flatten_circuit("Res1")
|
||||
schematic.flatten_circuit("RES1")
|
||||
|
||||
schematic.simplify
|
||||
|
||||
# Netlist vs. netlist
|
||||
align
|
||||
netlist.simplify
|
||||
compare
|
||||
Vendored
+197
@@ -0,0 +1,197 @@
|
||||
#%lvsdb-klayout
|
||||
|
||||
# Layout
|
||||
layout(
|
||||
top(Res2)
|
||||
unit(0.001)
|
||||
|
||||
# Layer section
|
||||
# This section lists the mask layers (drawing or derived) and their connections.
|
||||
|
||||
# Mask layers
|
||||
layer(l4 '15/0')
|
||||
layer(l3 '16/0')
|
||||
layer(l1)
|
||||
|
||||
# Mask layer connectivity
|
||||
connect(l4 l4 l3 l1)
|
||||
connect(l3 l4 l3)
|
||||
connect(l1 l4 l1)
|
||||
|
||||
# Device class section
|
||||
class(RPP1 RES
|
||||
param(R 0 0)
|
||||
param(L 1 0)
|
||||
param(W 1 0)
|
||||
)
|
||||
|
||||
# Device abstracts section
|
||||
# Device abstracts list the pin shapes of the devices.
|
||||
device(D$RPP1 RPP1
|
||||
terminal(A
|
||||
rect(l1 (0 0) (540 2000))
|
||||
)
|
||||
terminal(B
|
||||
rect(l1 (10540 0) (540 2000))
|
||||
)
|
||||
)
|
||||
|
||||
# Circuit section
|
||||
# Circuits are the hierarchical building blocks of the netlist.
|
||||
circuit(Res2
|
||||
|
||||
# Circuit boundary
|
||||
rect((8285 720) (117975 57350))
|
||||
|
||||
# Nets with their geometries
|
||||
net(1
|
||||
rect(l4 (120580 32490) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l4 (-22355 1390) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l4 (-21520 1755) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l3 (0 -4795) (1065 5850))
|
||||
rect(l3 (-5155 -6930) (52985 1475))
|
||||
rect(l3 (-27585 -395) (1065 5850))
|
||||
rect(l3 (20990 -5850) (1065 5850))
|
||||
rect(l3 (-1275 -1760) (340 1920))
|
||||
rect(l3 (-22475 -1890) (340 1920))
|
||||
rect(l3 (-21640 -1525) (340 1920))
|
||||
rect(l1 (42935 -2385) (540 2000))
|
||||
rect(l1 (-22675 -1970) (540 2000))
|
||||
rect(l1 (-21840 -1605) (540 2000))
|
||||
)
|
||||
net(2
|
||||
rect(l4 (19795 5575) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l3 (-195 -995) (2395 2500))
|
||||
rect(l3 (-2480 -1785) (340 1920))
|
||||
rect(l1 (-500 -1960) (540 2000))
|
||||
)
|
||||
|
||||
# Devices and their connections
|
||||
device(1 D$RPP1
|
||||
device(D$RPP1 location(30 -3970))
|
||||
device(D$RPP1 location(-65 -8175))
|
||||
device(D$RPP1 location(-205 -12595))
|
||||
device(D$RPP1 location(-225 -16825))
|
||||
device(D$RPP1 location(-320 -20985))
|
||||
device(D$RPP1 location(-22135 30))
|
||||
device(D$RPP1 location(-22105 -3940))
|
||||
device(D$RPP1 location(-22200 -8145))
|
||||
device(D$RPP1 location(-22340 -12565))
|
||||
device(D$RPP1 location(-22360 -16795))
|
||||
device(D$RPP1 location(-22455 -20955))
|
||||
device(D$RPP1 location(-43435 425))
|
||||
device(D$RPP1 location(-43405 -3545))
|
||||
device(D$RPP1 location(-43500 -7750))
|
||||
device(D$RPP1 location(-43640 -12170))
|
||||
device(D$RPP1 location(-43660 -16400))
|
||||
device(D$RPP1 location(-43755 -20560))
|
||||
device(D$RPP1 location(-100755 -30885))
|
||||
device(D$RPP1 location(-100850 -35090))
|
||||
device(D$RPP1 location(-100990 -39510))
|
||||
device(D$RPP1 location(-101010 -43740))
|
||||
device(D$RPP1 location(-101105 -47900))
|
||||
device(D$RPP1 location(-81920 -3545))
|
||||
device(D$RPP1 location(-82015 -7750))
|
||||
device(D$RPP1 location(-82155 -12170))
|
||||
device(D$RPP1 location(-82175 -16400))
|
||||
device(D$RPP1 location(-63835 -30780))
|
||||
device(D$RPP1 location(-63930 -34985))
|
||||
device(D$RPP1 location(-64070 -39405))
|
||||
device(D$RPP1 location(-64090 -43635))
|
||||
device(D$RPP1 location(-82380 -26810))
|
||||
device(D$RPP1 location(-82270 -20560))
|
||||
device(D$RPP1 location(-82350 -30780))
|
||||
device(D$RPP1 location(-82445 -34985))
|
||||
device(D$RPP1 location(-82585 -39405))
|
||||
device(D$RPP1 location(-82605 -43635))
|
||||
device(D$RPP1 location(-82700 -47795))
|
||||
device(D$RPP1 location(-64185 -47795))
|
||||
device(D$RPP1 location(-63435 640))
|
||||
device(D$RPP1 location(-63405 -3330))
|
||||
device(D$RPP1 location(-63500 -7535))
|
||||
device(D$RPP1 location(-63640 -11955))
|
||||
device(D$RPP1 location(-63660 -16185))
|
||||
device(D$RPP1 location(-63755 -20345))
|
||||
device(D$RPP1 location(-63865 -26810))
|
||||
device(D$RPP1 location(-100465 855))
|
||||
device(D$RPP1 location(-81950 425))
|
||||
device(D$RPP1 location(-100435 -3115))
|
||||
device(D$RPP1 location(-100530 -7320))
|
||||
device(D$RPP1 location(-100670 -11740))
|
||||
device(D$RPP1 location(-100690 -15970))
|
||||
device(D$RPP1 location(-100785 -20130))
|
||||
device(D$RPP1 location(-100785 -26915))
|
||||
connect(5 A B)
|
||||
connect(11 A B)
|
||||
connect(17 A B)
|
||||
connect(22 B B)
|
||||
location(110140 51795)
|
||||
param(R 95)
|
||||
param(L 420)
|
||||
param(W 2.21052631579)
|
||||
param(A 1080)
|
||||
param(P 1296)
|
||||
terminal(A 1)
|
||||
terminal(B 2)
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
# Reference netlist
|
||||
reference(
|
||||
|
||||
# Device class section
|
||||
class(RPP1 RES)
|
||||
|
||||
# Circuit section
|
||||
# Circuits are the hierarchical building blocks of the netlist.
|
||||
circuit(RES2
|
||||
|
||||
# Nets
|
||||
net(1 name(GND))
|
||||
net(2 name(VDD))
|
||||
|
||||
# Outgoing pins and their connections to nets
|
||||
pin(1 name(GND))
|
||||
pin(2 name(VDD))
|
||||
|
||||
# Devices and their connections
|
||||
device(1 RPP1
|
||||
name(I0.I106.R0)
|
||||
param(R 59475.7)
|
||||
param(L 420)
|
||||
param(W 2.21052631579)
|
||||
param(A 0)
|
||||
param(P 0)
|
||||
terminal(A 2)
|
||||
terminal(B 1)
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
# Cross reference
|
||||
xref(
|
||||
circuit(Res2 RES2 match
|
||||
xref(
|
||||
net(1 1 warning)
|
||||
net(2 2 warning)
|
||||
pin(() 0 match)
|
||||
pin(() 1 match)
|
||||
device(1 1 match)
|
||||
)
|
||||
)
|
||||
)
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
* Extracted by KLayout
|
||||
|
||||
* cell Res2
|
||||
.SUBCKT Res2
|
||||
* device instance $1 r0 *1 110.14,51.795 RPP1
|
||||
R$1 1 2 95 RPP1
|
||||
.ENDS Res2
|
||||
Vendored
+96
@@ -0,0 +1,96 @@
|
||||
source($lvs_test_source)
|
||||
report_lvs($lvs_test_target_lvsdb, true)
|
||||
target_netlist($lvs_test_target_cir, write_spice, "Extracted by KLayout")
|
||||
|
||||
schematic("res_combine_schematic.cir")
|
||||
deep
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Layers
|
||||
|
||||
pimp = input(7, 0)
|
||||
poly_dg = input(13, 0)
|
||||
cont = input(15, 0)
|
||||
met1_dg = input(16, 0)
|
||||
sblk = input(34, 0)
|
||||
rp_1 = sblk & poly_dg
|
||||
rpp1 = rp_1 & pimp
|
||||
p1trm = poly_dg - rpp1
|
||||
|
||||
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(resistor)
|
||||
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, RBA::DeviceClassResistor::TERMINAL_A, 0, terminals[0]);
|
||||
define_terminal(device, RBA::DeviceClassResistor::TERMINAL_B, 0, terminals[1]);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# tolerance/ignore
|
||||
tolerance("RPP1", "W", 1e-5)
|
||||
tolerance("RPP1", "L", 1e-5)
|
||||
ignore_parameter("RPP1", "R")
|
||||
|
||||
extract_devices(ResistorExtractor::new("RPP1", 0.5), # intentionally wrong: 1565.15/5
|
||||
{ "C" => p1trm, "R" => rpp1 })
|
||||
|
||||
connect(met1_dg, cont)
|
||||
connect(p1trm, cont)
|
||||
|
||||
netlist.flatten_circuit("Res1")
|
||||
schematic.flatten_circuit("RES1")
|
||||
|
||||
schematic.simplify
|
||||
|
||||
# Netlist vs. netlist
|
||||
align
|
||||
netlist.simplify
|
||||
compare
|
||||
Vendored
+193
@@ -0,0 +1,193 @@
|
||||
#%lvsdb-klayout
|
||||
|
||||
# Layout
|
||||
layout(
|
||||
top(Res2)
|
||||
unit(0.001)
|
||||
|
||||
# Layer section
|
||||
# This section lists the mask layers (drawing or derived) and their connections.
|
||||
|
||||
# Mask layers
|
||||
layer(l4 '15/0')
|
||||
layer(l3 '16/0')
|
||||
layer(l1)
|
||||
|
||||
# Mask layer connectivity
|
||||
connect(l4 l4 l3 l1)
|
||||
connect(l3 l4 l3)
|
||||
connect(l1 l4 l1)
|
||||
|
||||
# Device class section
|
||||
class(RPP1 RES)
|
||||
|
||||
# Device abstracts section
|
||||
# Device abstracts list the pin shapes of the devices.
|
||||
device(D$RPP1 RPP1
|
||||
terminal(A
|
||||
rect(l1 (0 0) (540 2000))
|
||||
)
|
||||
terminal(B
|
||||
rect(l1 (10540 0) (540 2000))
|
||||
)
|
||||
)
|
||||
|
||||
# Circuit section
|
||||
# Circuits are the hierarchical building blocks of the netlist.
|
||||
circuit(Res2
|
||||
|
||||
# Circuit boundary
|
||||
rect((8285 720) (117975 57350))
|
||||
|
||||
# Nets with their geometries
|
||||
net(1
|
||||
rect(l4 (120580 32490) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l4 (-22355 1390) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l4 (-21520 1755) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l3 (0 -4795) (1065 5850))
|
||||
rect(l3 (-5155 -6930) (52985 1475))
|
||||
rect(l3 (-27585 -395) (1065 5850))
|
||||
rect(l3 (20990 -5850) (1065 5850))
|
||||
rect(l3 (-1275 -1760) (340 1920))
|
||||
rect(l3 (-22475 -1890) (340 1920))
|
||||
rect(l3 (-21640 -1525) (340 1920))
|
||||
rect(l1 (42935 -2385) (540 2000))
|
||||
rect(l1 (-22675 -1970) (540 2000))
|
||||
rect(l1 (-21840 -1605) (540 2000))
|
||||
)
|
||||
net(2
|
||||
rect(l4 (19795 5575) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l3 (-195 -995) (2395 2500))
|
||||
rect(l3 (-2480 -1785) (340 1920))
|
||||
rect(l1 (-500 -1960) (540 2000))
|
||||
)
|
||||
|
||||
# Devices and their connections
|
||||
device(1 D$RPP1
|
||||
device(D$RPP1 location(30 -3970))
|
||||
device(D$RPP1 location(-65 -8175))
|
||||
device(D$RPP1 location(-205 -12595))
|
||||
device(D$RPP1 location(-225 -16825))
|
||||
device(D$RPP1 location(-320 -20985))
|
||||
device(D$RPP1 location(-22135 30))
|
||||
device(D$RPP1 location(-22105 -3940))
|
||||
device(D$RPP1 location(-22200 -8145))
|
||||
device(D$RPP1 location(-22340 -12565))
|
||||
device(D$RPP1 location(-22360 -16795))
|
||||
device(D$RPP1 location(-22455 -20955))
|
||||
device(D$RPP1 location(-43435 425))
|
||||
device(D$RPP1 location(-43405 -3545))
|
||||
device(D$RPP1 location(-43500 -7750))
|
||||
device(D$RPP1 location(-43640 -12170))
|
||||
device(D$RPP1 location(-43660 -16400))
|
||||
device(D$RPP1 location(-43755 -20560))
|
||||
device(D$RPP1 location(-100755 -30885))
|
||||
device(D$RPP1 location(-100850 -35090))
|
||||
device(D$RPP1 location(-100990 -39510))
|
||||
device(D$RPP1 location(-101010 -43740))
|
||||
device(D$RPP1 location(-101105 -47900))
|
||||
device(D$RPP1 location(-81920 -3545))
|
||||
device(D$RPP1 location(-82015 -7750))
|
||||
device(D$RPP1 location(-82155 -12170))
|
||||
device(D$RPP1 location(-82175 -16400))
|
||||
device(D$RPP1 location(-63835 -30780))
|
||||
device(D$RPP1 location(-63930 -34985))
|
||||
device(D$RPP1 location(-64070 -39405))
|
||||
device(D$RPP1 location(-64090 -43635))
|
||||
device(D$RPP1 location(-82380 -26810))
|
||||
device(D$RPP1 location(-82270 -20560))
|
||||
device(D$RPP1 location(-82350 -30780))
|
||||
device(D$RPP1 location(-82445 -34985))
|
||||
device(D$RPP1 location(-82585 -39405))
|
||||
device(D$RPP1 location(-82605 -43635))
|
||||
device(D$RPP1 location(-82700 -47795))
|
||||
device(D$RPP1 location(-64185 -47795))
|
||||
device(D$RPP1 location(-63435 640))
|
||||
device(D$RPP1 location(-63405 -3330))
|
||||
device(D$RPP1 location(-63500 -7535))
|
||||
device(D$RPP1 location(-63640 -11955))
|
||||
device(D$RPP1 location(-63660 -16185))
|
||||
device(D$RPP1 location(-63755 -20345))
|
||||
device(D$RPP1 location(-63865 -26810))
|
||||
device(D$RPP1 location(-100465 855))
|
||||
device(D$RPP1 location(-81950 425))
|
||||
device(D$RPP1 location(-100435 -3115))
|
||||
device(D$RPP1 location(-100530 -7320))
|
||||
device(D$RPP1 location(-100670 -11740))
|
||||
device(D$RPP1 location(-100690 -15970))
|
||||
device(D$RPP1 location(-100785 -20130))
|
||||
device(D$RPP1 location(-100785 -26915))
|
||||
connect(5 A B)
|
||||
connect(11 A B)
|
||||
connect(17 A B)
|
||||
connect(22 B B)
|
||||
location(110140 51795)
|
||||
param(R 95)
|
||||
param(L 420)
|
||||
param(W 2.21052631579)
|
||||
param(A 1080)
|
||||
param(P 1296)
|
||||
terminal(A 1)
|
||||
terminal(B 2)
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
# Reference netlist
|
||||
reference(
|
||||
|
||||
# Device class section
|
||||
class(RPP1 RES)
|
||||
|
||||
# Circuit section
|
||||
# Circuits are the hierarchical building blocks of the netlist.
|
||||
circuit(RES2
|
||||
|
||||
# Nets
|
||||
net(1 name(GND))
|
||||
net(2 name(VDD))
|
||||
|
||||
# Outgoing pins and their connections to nets
|
||||
pin(1 name(GND))
|
||||
pin(2 name(VDD))
|
||||
|
||||
# Devices and their connections
|
||||
device(1 RPP1
|
||||
name(I0.I106.R0)
|
||||
param(R 59475.7)
|
||||
param(L 420)
|
||||
param(W 2.21052631579)
|
||||
param(A 0)
|
||||
param(P 0)
|
||||
terminal(A 2)
|
||||
terminal(B 1)
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
# Cross reference
|
||||
xref(
|
||||
circuit(Res2 RES2 match
|
||||
xref(
|
||||
net(1 1 warning)
|
||||
net(2 2 warning)
|
||||
pin(() 0 match)
|
||||
pin(() 1 match)
|
||||
device(1 1 match)
|
||||
)
|
||||
)
|
||||
)
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
* Extracted by KLayout
|
||||
|
||||
* cell Res2
|
||||
.SUBCKT Res2
|
||||
* device instance $1 r0 *1 110.14,51.795 RPP1
|
||||
R$1 1 2 95 RPP1
|
||||
.ENDS Res2
|
||||
Vendored
+91
@@ -0,0 +1,91 @@
|
||||
source($lvs_test_source)
|
||||
report_lvs($lvs_test_target_lvsdb, true)
|
||||
target_netlist($lvs_test_target_cir, write_spice, "Extracted by KLayout")
|
||||
|
||||
schematic("res_combine_schematic.cir")
|
||||
deep
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Layers
|
||||
|
||||
pimp = input(7, 0)
|
||||
poly_dg = input(13, 0)
|
||||
cont = input(15, 0)
|
||||
met1_dg = input(16, 0)
|
||||
sblk = input(34, 0)
|
||||
rp_1 = sblk & poly_dg
|
||||
rpp1 = rp_1 & pimp
|
||||
p1trm = poly_dg - rpp1
|
||||
|
||||
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(resistor)
|
||||
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, RBA::DeviceClassResistor::TERMINAL_A, 0, terminals[0]);
|
||||
define_terminal(device, RBA::DeviceClassResistor::TERMINAL_B, 0, terminals[1]);
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
extract_devices(ResistorExtractor::new("RPP1", 0.5), # intentionally wrong: 1565.15/5
|
||||
{ "C" => p1trm, "R" => rpp1 })
|
||||
|
||||
connect(met1_dg, cont)
|
||||
connect(p1trm, cont)
|
||||
|
||||
netlist.flatten_circuit("Res1")
|
||||
schematic.flatten_circuit("RES1")
|
||||
|
||||
schematic.simplify
|
||||
|
||||
# Netlist vs. netlist
|
||||
align
|
||||
netlist.simplify
|
||||
compare
|
||||
Vendored
+196
@@ -0,0 +1,196 @@
|
||||
#%lvsdb-klayout
|
||||
|
||||
# Layout
|
||||
layout(
|
||||
top(Res2)
|
||||
unit(0.001)
|
||||
|
||||
# Layer section
|
||||
# This section lists the mask layers (drawing or derived) and their connections.
|
||||
|
||||
# Mask layers
|
||||
layer(l4 '15/0')
|
||||
layer(l3 '16/0')
|
||||
layer(l1)
|
||||
|
||||
# Mask layer connectivity
|
||||
connect(l4 l4 l3 l1)
|
||||
connect(l3 l4 l3)
|
||||
connect(l1 l4 l1)
|
||||
|
||||
# Device class section
|
||||
class(RPP1 RES)
|
||||
|
||||
# Device abstracts section
|
||||
# Device abstracts list the pin shapes of the devices.
|
||||
device(D$RPP1 RPP1
|
||||
terminal(A
|
||||
rect(l1 (0 0) (540 2000))
|
||||
)
|
||||
terminal(B
|
||||
rect(l1 (10540 0) (540 2000))
|
||||
)
|
||||
)
|
||||
|
||||
# Circuit section
|
||||
# Circuits are the hierarchical building blocks of the netlist.
|
||||
circuit(Res2
|
||||
|
||||
# Circuit boundary
|
||||
rect((8285 720) (117975 57350))
|
||||
|
||||
# Nets with their geometries
|
||||
net(1
|
||||
rect(l4 (120580 32490) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l4 (-22355 1390) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l4 (-21520 1755) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l3 (0 -4795) (1065 5850))
|
||||
rect(l3 (-5155 -6930) (52985 1475))
|
||||
rect(l3 (-27585 -395) (1065 5850))
|
||||
rect(l3 (20990 -5850) (1065 5850))
|
||||
rect(l3 (-1275 -1760) (340 1920))
|
||||
rect(l3 (-22475 -1890) (340 1920))
|
||||
rect(l3 (-21640 -1525) (340 1920))
|
||||
rect(l1 (42935 -2385) (540 2000))
|
||||
rect(l1 (-22675 -1970) (540 2000))
|
||||
rect(l1 (-21840 -1605) (540 2000))
|
||||
)
|
||||
net(2
|
||||
rect(l4 (19795 5575) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -745) (220 220))
|
||||
rect(l4 (-220 -750) (220 220))
|
||||
rect(l3 (-195 -995) (2395 2500))
|
||||
rect(l3 (-2480 -1785) (340 1920))
|
||||
rect(l1 (-500 -1960) (540 2000))
|
||||
)
|
||||
|
||||
# Devices and their connections
|
||||
device(1 D$RPP1
|
||||
device(D$RPP1 location(30 -3970))
|
||||
device(D$RPP1 location(-65 -8175))
|
||||
device(D$RPP1 location(-205 -12595))
|
||||
device(D$RPP1 location(-225 -16825))
|
||||
device(D$RPP1 location(-320 -20985))
|
||||
device(D$RPP1 location(-22135 30))
|
||||
device(D$RPP1 location(-22105 -3940))
|
||||
device(D$RPP1 location(-22200 -8145))
|
||||
device(D$RPP1 location(-22340 -12565))
|
||||
device(D$RPP1 location(-22360 -16795))
|
||||
device(D$RPP1 location(-22455 -20955))
|
||||
device(D$RPP1 location(-43435 425))
|
||||
device(D$RPP1 location(-43405 -3545))
|
||||
device(D$RPP1 location(-43500 -7750))
|
||||
device(D$RPP1 location(-43640 -12170))
|
||||
device(D$RPP1 location(-43660 -16400))
|
||||
device(D$RPP1 location(-43755 -20560))
|
||||
device(D$RPP1 location(-100755 -30885))
|
||||
device(D$RPP1 location(-100850 -35090))
|
||||
device(D$RPP1 location(-100990 -39510))
|
||||
device(D$RPP1 location(-101010 -43740))
|
||||
device(D$RPP1 location(-101105 -47900))
|
||||
device(D$RPP1 location(-81920 -3545))
|
||||
device(D$RPP1 location(-82015 -7750))
|
||||
device(D$RPP1 location(-82155 -12170))
|
||||
device(D$RPP1 location(-82175 -16400))
|
||||
device(D$RPP1 location(-63835 -30780))
|
||||
device(D$RPP1 location(-63930 -34985))
|
||||
device(D$RPP1 location(-64070 -39405))
|
||||
device(D$RPP1 location(-64090 -43635))
|
||||
device(D$RPP1 location(-82380 -26810))
|
||||
device(D$RPP1 location(-82270 -20560))
|
||||
device(D$RPP1 location(-82350 -30780))
|
||||
device(D$RPP1 location(-82445 -34985))
|
||||
device(D$RPP1 location(-82585 -39405))
|
||||
device(D$RPP1 location(-82605 -43635))
|
||||
device(D$RPP1 location(-82700 -47795))
|
||||
device(D$RPP1 location(-64185 -47795))
|
||||
device(D$RPP1 location(-63435 640))
|
||||
device(D$RPP1 location(-63405 -3330))
|
||||
device(D$RPP1 location(-63500 -7535))
|
||||
device(D$RPP1 location(-63640 -11955))
|
||||
device(D$RPP1 location(-63660 -16185))
|
||||
device(D$RPP1 location(-63755 -20345))
|
||||
device(D$RPP1 location(-63865 -26810))
|
||||
device(D$RPP1 location(-100465 855))
|
||||
device(D$RPP1 location(-81950 425))
|
||||
device(D$RPP1 location(-100435 -3115))
|
||||
device(D$RPP1 location(-100530 -7320))
|
||||
device(D$RPP1 location(-100670 -11740))
|
||||
device(D$RPP1 location(-100690 -15970))
|
||||
device(D$RPP1 location(-100785 -20130))
|
||||
device(D$RPP1 location(-100785 -26915))
|
||||
connect(5 A B)
|
||||
connect(11 A B)
|
||||
connect(17 A B)
|
||||
connect(22 B B)
|
||||
location(110140 51795)
|
||||
param(R 95)
|
||||
param(L 420)
|
||||
param(W 2.21052631579)
|
||||
param(A 1080)
|
||||
param(P 1296)
|
||||
terminal(A 1)
|
||||
terminal(B 2)
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
# Reference netlist
|
||||
reference(
|
||||
|
||||
# Device class section
|
||||
class(RPP1 RES)
|
||||
|
||||
# Circuit section
|
||||
# Circuits are the hierarchical building blocks of the netlist.
|
||||
circuit(RES2
|
||||
|
||||
# Nets
|
||||
net(1 name(GND))
|
||||
net(2 name(VDD))
|
||||
|
||||
# Outgoing pins and their connections to nets
|
||||
pin(1 name(GND))
|
||||
pin(2 name(VDD))
|
||||
|
||||
# Devices and their connections
|
||||
device(1 RPP1
|
||||
name(I0.I106.R0)
|
||||
param(R 59475.7)
|
||||
param(L 420)
|
||||
param(W 2.21052631579)
|
||||
param(A 0)
|
||||
param(P 0)
|
||||
terminal(A 2)
|
||||
terminal(B 1)
|
||||
)
|
||||
|
||||
)
|
||||
)
|
||||
|
||||
# Cross reference
|
||||
xref(
|
||||
circuit(Res2 RES2 nomatch
|
||||
xref(
|
||||
net(() 1 mismatch)
|
||||
net(() 2 mismatch)
|
||||
net(1 () mismatch)
|
||||
net(2 () mismatch)
|
||||
pin(() 0 match)
|
||||
pin(() 1 match)
|
||||
device(() 1 mismatch)
|
||||
device(1 () mismatch)
|
||||
)
|
||||
)
|
||||
)
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
|
||||
.SUBCKT res1 MINUS PLUS
|
||||
*.PININFO MINUS:B PLUS:B
|
||||
RR7 net5 net3 1565.15 RPP1 W=2u L=10u M=1
|
||||
RR8 net3 net6 1565.15 RPP1 W=2u L=10u M=1
|
||||
RR9 net6 net7 1565.15 RPP1 W=2u L=10u M=1
|
||||
RR10 net7 MINUS 1565.15 RPP1 W=2u L=10u M=1
|
||||
RR6 net4 net5 1565.15 RPP1 W=2u L=10u M=1
|
||||
RR0 PLUS net4 1565.15 RPP1 W=2u L=10u M=1
|
||||
.ENDS
|
||||
|
||||
|
||||
.SUBCKT res2_ MINUS PLUS
|
||||
*.PININFO MINUS:B PLUS:B
|
||||
XI106 net3 PLUS res1
|
||||
XI104 net7 net8 res1
|
||||
XI100 net6 MINUS res1
|
||||
XI105 net3 net7 res1
|
||||
XI107 net3 PLUS res1
|
||||
XI108 net3 PLUS res1
|
||||
XI101 net9 net6 res1
|
||||
XI102 net10 net9 res1
|
||||
XI103 net8 net10 res1
|
||||
.ENDS
|
||||
|
||||
|
||||
.SUBCKT Res2 gnd vdd
|
||||
*.PININFO gnd:B vdd:B
|
||||
XI0 gnd vdd res2_
|
||||
.ENDS
|
||||
|
||||
Reference in New Issue
Block a user