
* ========================== Generic Transmitter Test Bench ========================== *
*.option method=gear2
*.option accurate nomod brief
*.option ingold=2
*.option reltol=1e-4 vabstol=1e-7 iabstol=1e-12 pivrel=1e-4

* ========================== Source and Model Parameters ========================== *

* Source Parameters

* Delay
.PARAM delay=5e-9

* Bit Unit Interval
.PARAM ui=125p

* Edge Rise and Fall Time
.PARAM trise=35p
.PARAM tfall=35p

* Single Ended Output Swing
.PARAM vid=400e-3

* Transmitter Bandwidth
.PARAM bw=12G

* Preshoot in dB
.PARAM pre=0.0

* De-Emphasis in dB
.PARAM de=6.0

* MAX14950 Parameters
.PARAM ineq0=0
.PARAM ineq1=0
.PARAM oeq0=0
.PARAM oeq1=0
.PARAM oeq2=0


* ========================== Model and Library Inclusions ========================== *

*Source Generators
.include 'lib/Source_D10_2.sp'
.include 'lib/Source_K28_5.sp'
.include 'lib/Source_PRBS7.sp'
.include 'lib/Source_PRBS23.sp'
.include 'lib/Source_LF_HF.sp'
.include 'lib/DE_and_BW.sp'

*Model Inlcusions
.lib 'lib/backend.sp' nom
.lib 'lib/misc.sp' nom
.lib 'lib/pmos.sp' nom
.lib 'lib/crsi.sp'   nom 
.lib 'lib/nicr.sp' nom
.lib 'lib/pnp.sp' nom
.lib 'lib/desd.sp' nom
.lib 'lib/nmos.sp' nom
.lib 'lib/dv.sp' nom
.lib 'lib/npn.sp' nom
.lib 'lib/thermal.sp' nom
.lib 'lib/mimcap.sp' nom
.include 'lib/nrand_set.sp'
.include 'lib/global_set.sp'
.include 'lib/match_set.sp'
.include 'lib/skew_set.sp'
.include 'lib/func_set.sp'
.include 'lib/mc_set.sp'
.include 'lib/package_max14950.sp'
.include 'lib/max14950.sp'


* ========================== Other subcircuits ========================== *
* Single ended to differential converter
.subckt at_se2diff vin von vop vss gain=1.0
ee1  von vss vss vin  '(gain/1.0)'
ee0  vop vss vin vss  '(gain/1.0)'
.ends at_se2diff


* ========================== Subcircuit Callouts ========================== *

* Source Generator
* Options for Sources are: Source_D10_2, Source_K28_5, Source_PRBS7, Source_LF_HF,
xsource  net_source gnd Source_PRBS23

* DE and PS
xDEPS net_source de_ps DE_and_BW 

* Single to Diff
xse2diff  de_ps netLpf_out_p netLpf_out_m gnd at_se2diff gain=1.0

* MAX14950 
xmax max_txp max_txm max_rxp max_rxm 0ineq0 0ineq1 0oeq0 0oeq1 0oeq2 eqoutp eqoutn en vcc gnd 
+ max14950_single_ch




* ========================== Connections ========================== *

* Coupling Caps from System TX to System RX
cc0  sys_txp max_rxp  2.2e-07
cc1  sys_txm max_rxm  2.2e-07

cc2  max_txp sys_rxp  2.2e-07
cc3  max_txm sys_rxm  2.2e-07



* ========================== Parasitic Capacitors ========================== *

*Parasitic Caps for Termination
cp3  sys_rxp 0  5.7e-13
cp4  sys_rxm 0  5.7e-13



* ========================== POWER ========================== *

*Vcc and GND*
vv0  vccx gnd  dc=3.3 
vgnd  gnd 0  dc=0

*Vtxp and Vtxm*
ee8  vtxp vccx netLpf_out_p gnd  1
ee7  vccx vtxm gnd netLpf_out_m  1

*Max14950 Control Settings
ee100  0ineq0 gnd vccx gnd 'ineq0'
ee101  0ineq1 gnd vccx gnd 'ineq1'
ee102  0oeq0  gnd vccx gnd 'oeq0'
ee103  0oeq1  gnd vccx gnd 'oeq1'
ee104  0oeq2  gnd vccx gnd 'oeq2'
ee105  en     gnd vccx gnd 1



* ========================== Resistors ========================== *

*TX Source Resistors*
rr7  vtxp sys_txp  50
rr8  vtxm sys_txm  50

*RX Termination Resistors*
rr21  sys_rxp 0  50
rr22  sys_rxm 0  50




* ========================== Analysis Options and Nodes ========================== *

.tran 0.05p 30n
.option post probe 
.probe tran 

+ v(gnd) v(vccx)
+ v(net_source)

+ v(sys_txp) v(sys_txm) 
+ v(sys_txp,sys_txm)

+ v(sys_rxp) v(sys_rxm)
+ v(sys_rxp,sys_rxm)

+ v(max_rxp) v(max_rxm)
+ v(max_rxp,max_rxm)

+ v(max_txp) v(max_txm)
+ v(max_txp,max_txm)

+ v(eqoutp) v(eqoutn)
+ v(eqoutp,eqoutn)

.end

