File: double_height.lvs

package info (click to toggle)
klayout 0.30.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 292,204 kB
  • sloc: cpp: 2,068,428; ruby: 47,823; xml: 26,924; python: 14,404; sh: 1,812; tcl: 212; perl: 170; makefile: 112; ansic: 42
file content (130 lines) | stat: -rw-r--r-- 3,013 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

source($lvs_test_source)

report_lvs($lvs_test_target_lvsdb)

writer = write_spice(true, false)
target_netlist($lvs_test_target_cir, writer, "Extracted by KLayout")

# needs this delegate because we use MOS3 which is not available in Spice
class SpiceReaderDelegate < RBA::NetlistSpiceReaderDelegate

  # says we want to catch these subcircuits as devices
  def wants_subcircuit(name)
    name == "HVNMOS" || name == "HVPMOS"
  end

  # translate the element
  def element(circuit, el, name, model, value, nets, params)

    if el != "M"
      # all other elements are left to the standard implementation
      return super
    end

    if nets.size != 4
      error("Device #{model} needs four nodes")
    end

    # provide a device class
    cls = circuit.netlist.device_class_by_name(model)
    if ! cls
      cls = RBA::DeviceClassMOS3Transistor::new
      cls.name = model
      circuit.netlist.add(cls)
    end

    # create a device
    device = circuit.create_device(cls, name)

    # and configure the device
    [ "S", "G", "D" ].each_with_index do |t,index|
      device.connect_terminal(t, nets[index])
    end
    device.set_parameter("W", params["W"] * 1e6)
    device.set_parameter("L", params["L"] * 1e6)

    device

  end

end

reader = RBA::NetlistSpiceReader::new(SpiceReaderDelegate::new)
schematic("double_height_inv.cir", reader)

deep

# Drawing layers

nwell       = input(1, 0)
active      = input(2, 0)
poly        = input(3, 0)
poly_lbl    = input(3, 1)
diff_cont   = input(4, 0)
poly_cont   = input(5, 0)
metal1      = input(6, 0)
metal1_lbl  = input(6, 1)
via1        = input(7, 0)
metal2      = input(8, 0)
metal2_lbl  = input(8, 1)

# Bulk layer for terminal provisioning

bulk        = polygon_layer

psd = nil
nsd = nil

# Computed layers

active_in_nwell       = active & nwell
pactive               = active_in_nwell 
pgate                 = pactive & poly
psd                   = pactive - pgate

active_outside_nwell  = active - nwell
nactive               = active_outside_nwell 
ngate                 = nactive & poly
nsd                   = nactive - ngate

# Device extraction

# PMOS transistor device extraction
extract_devices(mos3("PMOS"), { "SD" => psd, "G" => pgate, 
                                "tS" => psd, "tD" => psd, "tG" => poly })

# NMOS transistor device extraction
extract_devices(mos3("NMOS"), { "SD" => nsd, "G" => ngate, 
                                "tS" => nsd, "tD" => nsd, "tG" => poly })

# Define connectivity for netlist extraction

# Inter-layer
connect(psd,        diff_cont)
connect(nsd,        diff_cont)
connect(poly,       poly_cont)
connect(diff_cont,  metal1)
connect(poly_cont,  metal1)
connect(metal1,     via1)
connect(via1,       metal2)

# attach labels
connect(poly,       poly_lbl)
connect(metal1,     metal1_lbl)
connect(metal2,     metal2_lbl)

# Global
connect_global(bulk, "SUBSTRATE")

# Implicit connection of the INV2
# VSS nets
connect_implicit("INV2", "VSS")

# Compare section

netlist.simplify
align

compare