// Miller OTA, IHP SG13G2 PDK, VACASK
// Based on VACASK demo mc/miller_ihp.sim

// PDK common definitions (OSDI files, default models)
include "sg13g2_vacask_common.lib"

// Generic devices for compensation network and load
load "resistor.osdi"
load "capacitor.osdi"
model resistor resistor
model capacitor capacitor
model vsource vsource
model isource isource
model vcvs vcvs

// Multipliers (m) are fixed, widths and lengths are design parameters.
// mm_ok=1 enables mismatch when a *_mismatch corner section is used.
subckt miller(inp inn out vdd vss)
  i0 (vdd net002) isource dc=ibias
  xmn3 (net002 net002 vss vss) sg13_lv_nmos w=mirr_w  l=mirr_l  m=mirr_m  mm_ok=1
  xmn4 (net003 net002 vss vss) sg13_lv_nmos w=mirr_wd l=mirr_ld m=mirr_md mm_ok=1
  xmn5 (out net002 vss vss)    sg13_lv_nmos w=mirr_wo l=mirr_l  m=mirr_mo mm_ok=1
  xmp1 (net005 net005 vdd vdd) sg13_lv_pmos w=load_w  l=load_l  m=load_m  mm_ok=1
  xmp2 (net004 net005 vdd vdd) sg13_lv_pmos w=load_w  l=load_l  m=load_m  mm_ok=1
  xmp3 (out net004 vdd vdd)    sg13_lv_pmos w=out_w   l=out_l   m=out_m   mm_ok=1
  r1 (out net001) resistor r=r_out
  c1 (net001 net004) capacitor c=c_out
  xmn1 (net005 inn net003 vss) sg13_lv_nmos w=diff_w  l=diff_l  m=diff_m  mm_ok=1
  xmn2 (net004 inp net003 vss) sg13_lv_nmos w=diff_w  l=diff_l  m=diff_m  mm_ok=1
ends
