diff --git a/src/doc/doc/about/drc_ref_global.xml b/src/doc/doc/about/drc_ref_global.xml index c10de75cf..e44fc040a 100644 --- a/src/doc/doc/about/drc_ref_global.xml +++ b/src/doc/doc/about/drc_ref_global.xml @@ -107,29 +107,59 @@ See Layer#drc, Usage:
Use this class with extract_devices to specify extraction of a
-bipolar junction transistor
+bipolar junction transistor without a substrate terminal.
+If used with a name, the extractor will produce devices with device
+class
See
Usage:
+
+See
Usage:
Use this class with extract_devices to specify extraction of a
bipolar junction transistor with a substrate terminal
+If used with a name, the extractor will produce devices with device
+class
See
Usage:
+
+See
Usage:
@@ -145,30 +175,60 @@ This function creates a box object. The arguments are the same than for theUsage:
Use this class with extract_devices to specify extraction of a capacitor.
The area_cap argument is the capacitance in Farad per square micrometer.
+If used with a name, the extractor will produce devices with device
+class
See
Usage:
+
+See
Usage:
Use this class with extract_devices to specify extraction of a capacitor
with a bulk terminal.
The area_cap argument is the capacitance in Farad per square micrometer.
+If used with a name, the extractor will produce devices with device
+class
See
Usage:
+
+See
Usage:
@@ -470,47 +530,92 @@ See Netter#device_scalingUsage:
Use this class with extract_devices to specify extraction of a
planar diode
+If used with a name, the extractor will produce devices with device
+class
See
Usage:
+
+See
Usage:
Use this class with extract_devices to specify extraction of a
three-terminal DMOS transistor. A DMOS transistor is essentially
the same than a MOS transistor, but source and drain are
separated.
+If used with a name, the extractor will produce devices with device
+class
See
Usage:
+
+See
Usage:
Use this class with extract_devices to specify extraction of a
four-terminal DMOS transistor. A DMOS transistor is essentially
the same than a MOS transistor, but source and drain are
separated.
+If used with a name, the extractor will produce devices with device
+class
See
Usage:
+
+See
Usage:
@@ -1201,29 +1306,59 @@ argument, "middle" represents the bounding box center marker generator on primarUsage:
Use this class with extract_devices to specify extraction of a
three-terminal MOS transistor.
+If used with a name, the extractor will produce devices with device
+class
See
Usage:
+
+See
Usage:
Use this class with extract_devices to specify extraction of a
four-terminal MOS transistor.
+If used with a name, the extractor will produce devices with device
+class
See
Usage:
+
+See
Usage:
@@ -1666,6 +1801,26 @@ l1 = input(1, 0)To remove this condition, call "region_touch" without any arguments.
+Usage:
+
+Registers the device class for extraction and netlist input and output.
+"dc" is an object of type
+Registers a device class for extraction and netlist output. +Registering a device class is optional. However, using registered +device classed simplify SPICE netlist writing, as device classes +can be configured with SPICE profiles to customize SPICE output. +In the LVS context, register_device_class also controls the way +schematic netlists are read from SPICE. +See Netter#register_device_class for a description of this function. +Also see Netter#extract_devices for how to use it with registered +device classes. +
Usage:
@@ -1718,37 +1873,65 @@ will also be written to the given file. If a file name is given and "long" is true, a verbose version of the L2N DB format will be used. -Usage:
Use this class with extract_devices to specify extraction of a resistor. -
-The sheet_rho value is the sheet resistance in ohms/square. It is used
-to compute the resistance from the geometry.
+"rho" is the sheet resistance in ohms/square.
+If used with a name, the extractor will produce devices with device
+class
See
Usage:
+
+See
Usage:
Use this class with extract_devices to specify extraction of a resistor
with a bulk terminal.
-The sheet_rho value is the sheet resistance in ohms/square.
+"rho" is the sheet resistance in ohms/square.
+If used with a name, the extractor will produce devices with device
+class
See
Usage:
+
+See
Usage:
@@ -2318,6 +2501,7 @@ shape.Use this option in target_netlist for the format parameter to @@ -2328,5 +2512,12 @@ information comments such as instance coordinates or pin names.
"writer_delegate" allows using a
+To provide the name of a SPICE profile to use, include it the following way: +
+
+# write SPICE files using profile "my_profile"
+write_spice(spice_profile("my-profile"))
+
diff --git a/src/doc/doc/about/drc_ref_netter.xml b/src/doc/doc/about/drc_ref_netter.xml
index aca1a28e7..72ccafa48 100644
--- a/src/doc/doc/about/drc_ref_netter.xml
+++ b/src/doc/doc/about/drc_ref_netter.xml
@@ -468,7 +468,6 @@ either save to OASIS, or use integer numbers for the property names.
Usage:
Runs the device extraction for given device extractor class. In the first @@ -608,6 +607,28 @@ layout analysis. Hence, all connect, connect statements will clear the netlist and re-extract it again.
+Usage:
+
+Registers the given device class object ("dc" is of type
+Registering device classes simplifies implementation of custom SPICE +representations for devices. Usually it is not required then to provide +SPICE reader or write delegates, as the SPICE format can be configured +inside the device class through SPICE profiles. +
+When creating custom device extractors, it is no longer required to +register a device class inside the device extractor. Instead, pre-registered device +classes are identified with a device extractor class by name. +
Usage:
diff --git a/src/doc/doc/about/lvs_ref_global.xml b/src/doc/doc/about/lvs_ref_global.xml index 494ef2f6e..9ed495891 100644 --- a/src/doc/doc/about/lvs_ref_global.xml +++ b/src/doc/doc/about/lvs_ref_global.xml @@ -172,6 +172,23 @@ See Netter for more detailsSee Netter#no_lvs_hints for a description of that feature.
+Usage:
+
+Registers the device class for extraction and netlist input and output.
+"dc" is an object of type
+Registering a device class is optional. However, using registered +device classed simplify SPICE netlist reading and writing, as device classes +can be configured with SPICE profiles to customize SPICE input and output. +See Netter#register_device_class for a description of this function. +Also see Netter#extract_devices for how to use it with registered +device classes. +
Usage:
diff --git a/src/doc/doc/about/lvs_ref_netter.xml b/src/doc/doc/about/lvs_ref_netter.xml index 2e1dbd89e..0bebc6e95 100644 --- a/src/doc/doc/about/lvs_ref_netter.xml +++ b/src/doc/doc/about/lvs_ref_netter.xml @@ -473,6 +473,8 @@ same_nets!("ND2", "A", "B")-If a filename is given (first two forms), the netlist is read from the given file. +If a filename is given, the netlist is read from the given file. +
If no reader is provided, Spice format will be assumed. The reader object is a
+Instead of a reader or delegate, a SPICE profile can be specified. In that case, the device +classes need to be registered with register_device_class before the schematic +method is called. To use a SPICE profile with name "my-profile" use this code: +
+
+# for a specific netter object
+netter.schematic("netlist.cir", spice_profile("my-profile"))
+
+# or globally
+schematic("netlist.cir", spice_profile("my-profile"))
+
Alternatively, a
target_netlist("output.cir", write_spice, "Created by KLayout")
@@ -55,19 +57,33 @@
- The "write_spice" configuration function has two options: + The "write_spice" configuration function has these options:
-write_spice(use_net_names, with_comments)+
write_spice(use_net_names, with_comments) +write_spice(spice_profile(profile_name), use_net_names, with_comments)
- Both options are boolean values. If true and present, the first option will make + "use_net_names" and "with_comments" are optional, boolean values. If true and present, the first option will make the writer use the real net's names instead of numerical IDs. If true and present, "with_comments" will embed debug comments into the netlist showing instance locations, pin names etc.
++ For customizing SPICE output there are two possible + implementation paths: SPICE profiles and SPICE writer delegates. + While SPICE writer delegates are the most flexible way, SPICE + profiles are easier to use, but require a certain structure + in the LVS scripts. +
+ ++ For documentation on SPICE profiles see the corresponding section below. +
+Further customization can be achieved by providing an explicit SPICE writer @@ -145,30 +161,6 @@ X$2 VSS IN OUT SUBSTRATE NMOS PARAMS: L=0.25 W=0.9 AS=0.405 AD=0.405 PS=2.7 this way, a single netlist can be written to multiple files in different flavours.
-
- An easier way to customize SPICE output is through "SPICE profiles". SPICE profiles are
- pieces of data attached to "device class". Every device inside a netlist is associated with a
- device class. The device class is a named entity inside the netlist. In a SPICE netlist, the
- model name is the name of that device class. Device classes are objects of type
- In most cases, the SPICE profiles will be enough to configure how devices are written - and read from SPICE files, so it is not required to implement a reader or writer delegate. - On the back side, it is required to declare and configure the device classes in the LVS - scripts. -
- -@@ -187,6 +179,21 @@ X$2 VSS IN OUT SUBSTRATE NMOS PARAMS: L=0.25 W=0.9 AS=0.405 AD=0.405 PS=2.7 Capacitor device classes) and "D" (gives diode device classes).
++ For customizing SPICE input there are two possible + implementation paths: SPICE profiles and SPICE reader delegates. + While SPICE reader delegates are the most flexible way, SPICE + profiles are easier to use, but require a certain structure + in the LVS scripts. +
+ ++ For documentation on SPICE profiles see the corresponding section below. +
+ +
As for the SPICE reader, a delegate can be provided to customize the reader.
For doing so, subclass the
+ An easier way to customize SPICE output is through "SPICE profiles". SPICE profiles are
+ pieces of data attached to a "device class". Every device inside a netlist is associated with a
+ device class. The device class is a named entity inside the netlist. In a SPICE netlist, the
+ model name is the name of that device class. Device classes are objects of type
+ In most cases, the SPICE profiles will be enough to configure how devices are written + and read from SPICE files, so it is not required to implement a reader or writer delegate. + On the back side, it is required to declare and configure the device classes in the LVS + scripts. +
+ ++ To declare devices, you have to include their definitions before you use "schematic" to + read the schematic netlist and before you extract devices. + Definitions are made by creating a device class, either from the standard device classes + or using a custom one, and then configuring them. After you have configured them, they + need to be registered, so the SPICE reader and writer code knows they exist. +
+ ++ Convenience helpers are provided to create an instance of the standard classes: + mos4_class, + dmos4_class, + mos3_class, + dmos3_class, + diode_class, + bjt3_class, + bjt4_class, + resistor_class, + resistor_with_bulk_class, + capacitor_class and + capacitor_with_bulk_class. + The helpers create device class objects which are pre-filled with the corresponding + parameters and terminals. Also, the device combination rules are configured already. +
+ +
+ Here is an example how to register custom device classes derived from the MOS4 class
+ (
...
+
+# Creates a PMOS device derived from the MOS4 built-in type
+# and configure the default SPICE profile to use element type "X"
+pmos = mos4_class("PMOS")
+pmos.spice_profile().element = "X"
+
+# Same for NMOS
+nmos = mos4_class("NMOS")
+nmos.spice_profile().element = "X"
+
+# Registers the two new device classes
+# NOTE: this needs to come before the schematic netlist is read
+# or devices are extracted
+register_device_class(pmos)
+register_device_class(nmos)
+
+# Reads the schematic
+schematic("schematic.cir")
+
+...
+
+# PMOS transistor device extraction
+# NOTE: "mos4(pmos)" creates a device extractor for MOS4 devices which
+# produces devices of "pmos" type.
+extract_devices(mos4(pmos), { "SD" => psd, "G" => pgate, "W" => nwell,
+ "tS" => psd, "tD" => psd, "tG" => poly, "tW" => nwell })
+
+# NMOS transistor device extraction
+extract_devices(mos4(nmos), { "SD" => nsd, "G" => ngate, "W" => bulk,
+ "tS" => nsd, "tD" => nsd, "tG" => poly, "tW" => bulk })
+
+...
+
+
+ For complete freedom of device configuration, you can also create
+ your own classes using the
+ For more information about how SPICE reading and writing can be configured
+ with SPICE profiles, see here:
+ There can be multiple SPICE profiles for different purposes (e.g. + SPICE reading and writing. SPICE profiles are named. For example, you + can declare two profiles - one for reading (called "READ") and one + for writing (called "WRITE") and use them separately: +
+ +...
+
+# Configures the target netlist to be written with SPICE profile "WRITE"
+target_netlist("extracted.cir", write_spice(spice_profile("WRITE")), "Extracted by KLayout")
+
+...
+
+# Creates a device class for "PMOS" with two SPICE
+# profiles. The one for reading uses the "X" element,
+# the one for writing uses the "M" element:
+pmos = mos4_class("PMOS")
+pmos.spice_profile("READ").element = "X"
+pmos.spice_profile("WRITE").element = "M"
+
+...
+
+# Reads the schematic using SPICE profile "READ"
+schematic("schematic.cir", spice_profile("READ"))
+
+...
+