ahkab.mosq

The Square Law Mos Model

This module defines two classes:

Implementation details

Assuming \(V_{ds} > 0\) and a transistor type N in the following, we have the following regions implemented:

  1. No subthreshold conduction.
    • \(V_{gs} < V_T\)
    • \(I_D = 0\)
  2. Ohmic region
    • \(V_{GS} > V_T\) and \(V_{GD} > V_T\)
    • \(I_D = k_n W/L ((V_{GS}-V_{T})V_{DS} - V_{DS}^2/2)\)
  3. Saturation region
    • \(V_{GS} > V_T\) and \(V_{DS} > V_{GS} - V_{T}\)
    • \(V_{GS} < V_{T}\)
    • \(I_D = 1/2 k_n W/L (V_{GS}-V_T)^2 * [1 + \lambda*(V_{DS}-V_{GS}+V_T)]\)

Module reference

class mosq_device(part_id, nd, ng, ns, nb, W, L, model, M=1, N=1)[source]

Quadratic Law MOSFET device

Parameters:

part_id : string
The part ID of the model. Eg. 'M1' or 'Mlow', the first letter should always be 'M'.
nd : int
drain node
ng : int
gate node
ns : int
source node
nb : int
bulk node
L : float
element width [m]
W : float
element length [m]
model : mosq_mos_model instance
the model for the device
M : int, optional
shunt multiplier (n. of shunt devices)
N : int, optional
series multiplier (n. of series devices)
get_drive_ports(op)[source]

Get the circuit ports that drive the device.

Returns:

tp : a tuple of tuples of nodes, each node being a drive port of the device.

Eg. tp might be defined as:

tp = (port0, port1, port2...)

Where each port in the tuple is of the form:

port0 = (nplus, nminus)

In the case of a MOSQ device, the method returns:

((nd, nb), (ng, nb), (ns, nb))

Where:

  • nd is the internal identifier of the drain node,
  • ng is the internal identifier of the gate node,
  • ns is the internal identifier of the source node.
  • nb is the internal identifier of the bulk node,
get_mc_requirements()[source]
get_netlist_elem_line(nodes_dict)[source]

Get the element netlist entry

get_op_info(ports_v)[source]

Information regarding the Operating Point (OP)

Parameters:

ports_v : list of lists
The voltages applied to all the driving ports, grouped by output port.

i.e.

[<list of voltages for the drive ports of output port 0>,
 <list of voltages for the drive ports of output port 1>,
 ...,
 <list of voltages for the drive ports of output port N>]

Usually, this method returns op_keys and the corresponding op_info, two lists, one holding the labels, the other the corresponding values.

In the case of MOSFETs, the values are way too many to be shown in a linear table. For this reason, we return None as op_keys, and we return for op_info a list which holds both labels and values in a table-like manner, spanning the vertical and horizontal dimension.

For this reason, each MOSFET has to have its OP info printed alone, not grouped as it happens with most other elements.

Returns:

op_keys : None
See above for why this value is always None.
op_info : list of floats
The OP information ready to be passed to printing.table() for arranging it in a pretty table to display.
get_output_ports()[source]

Get the circuit ports where the device injects current.

Returns:

ports : a tuple of tuples of nodes, such as as:

(port0, port1, port2...)

Where each port in the tuple is itself a tuple, made of two nodes, eg.

port0 = (nplus, nminus)

In the case of a MOS device, the method returns:

((nd, ns),)

Where:

  • nd is the internal identifier of the drain node,
  • ns is the internal identifier of the source node.
get_value_function(identifier)[source]
gstamp(ports_v, time=0, reduced=True)[source]

Get the transconductance stamp matrix

Parameters:

ports_v : sequence
a sequence of the form: [voltage_across_port0, voltage_across_port1, ...]
time : float, optional
the simulation time at which the evaluation is performed. Set it to None during DC analysis. Defaults to 0.
reduced : bool, optional
Whether the returned matrix should be in reduced form or not. Defaults to True, corresponding to reduced form.

Returns:

indices : sequence of sequences
The indices corresponding to the stamp matrix.
stamp : ndarray
The stamp matrix.
istamp(ports_v, time=0, reduced=True)[source]

Get the current stamp matrix

A stamp matrix corresponding to the current flowing in the element with the voltages applied as specified in the ports_v vector.

Parameters:

ports_v : list
A list in the form: [voltage_across_port0, voltage_across_port1, ...]
time: float
the simulation time at which the evaluation is performed. It has no effect here. Set it to None during DC analysis.
setup_mc(status, mckey)[source]
update_status_dictionary(ports_v)[source]

Update the status dictionary

The status dictionary may be accessed at elem.opdict and contains several pieces of information that may be of interest regarding the biasing of the MOS device.

class mosq_mos_model(name=None, TYPE=u'n', TNOM=None, COX=None, GAMMA=None, NSUB=None, PHI=None, VTO=None, KP=None, LAMBDA=None, AKP=None, AVT=None, TOX=None, VFB=None, U0=None, TCV=None, BEX=None)[source]
device_check(adev)[source]

Performs sanity check on the device parameters.

get_VT(voltages, device)[source]

Get the threshold voltage

get_device_temperature()[source]

Returns the temperature of the device - in K.

get_gm(*key)[source]

Get the gate-source transconductance

Mathematically:

\[g_{ms} = \frac{dI_{DS}}{d(VG-VS)}\]

Often this is referred to as just \(g_m\).

Parameters:

device : object
The device object holding the device parameters as attributes.
voltages : tuple
A tuple containing the voltages applied to the driving ports. In this case, the tuple is (vds, vgs, vbs).

Returns:

gmb : float
The gate-source transconductace.
get_gmb(*key)[source]

Get the bulk-source transconductance

Mathematically:

\[g_{mb} = \frac{dI_{DS}}{d(VS-VB)}\]

Parameters:

device : object
The device object holding the device parameters as attributes.
voltages : tuple
A tuple containing the voltages applied to the driving ports. In this case, the tuple is (vds, vgs, vbs).

Returns:

gmb : float
The source-bulk transconductace.
get_gmd(*key)[source]

Get the drain-source transconductance

Mathematically:

\[g_{md} = \frac{dI_{DS}}{d(VD-VS)}\]

Parameters:

device : object
The device object holding the device parameters as attributes.
voltages : tuple
A tuple containing the voltages applied to the driving ports. In this case, the tuple is (vds, vgs, vbs).

Returns:

gmb : float
The drain-source transconductace.
get_ids(*key)[source]

Get the drain-source current

Parameters:

device : object
The device object holding the device parameters as attributes.
voltages : tuple
A tuple containing the voltages applied to the driving ports. In this case, the tuple is (vds, vgs, vbs).

Returns:

ids : float
The drain-source current
get_svt_skp(device, debug=False)[source]
get_voltages(vds, vgs, vbs)[source]

Performs the D <-> S swap if needed.

Returns:

voltages : tuple
A tuple containing (VDS, VGS, VBS) after the swap
CS : int
CS is an integer which equals to: * +1 if no swap was necessary, * -1 if VD and VS have been swapped.
print_model()[source]

Print out the model

All the internal parameters of the model get printed out, for visual inspection. Notice some can be set to None (ie not available) if they were not provided and some of those not provided are calculated from the others.

set_device_temperature(T)[source]

Change the temperature of the device.

Correspondingly, VTO, KP and PHI get updated.