***** Hspice Netlist for Cell 'offset_comp_top' *****

************** Module add2 **************
.subckt add2 in1 in2 out
.ends add2

************** Module and2 **************
.subckt and2 a b y
.ends and2

************** Module constant **************
.subckt constant out consval=1
.ends constant

************** Module edgemeasure **************
.subckt edgemeasure in out
.ends edgemeasure

************** Module gain **************
.subckt gain a y gain=1
.ends gain

************** Module integrator **************
.subckt integrator in out k=1.0
.ends integrator

************** Module inv **************
.subckt inv a y
.ends inv

************** Module limitamp **************
.subckt limitamp in out
.ends limitamp

************** Module lowpassfilter **************
.subckt lowpassfilter in out gain=1.0 fp=1.0
.ends lowpassfilter

************** Module mux2 **************
.subckt mux2 in0 in1 y sel
.ends mux2

************** Module noise **************
.subckt noise out var=1
.ends noise

************** Module signal_source **************
.subckt signal_source phase out clk stype=0 freq=1
.ends signal_source

************** Module step_in **************
.subckt step_in step vend=1 vstart=1 tstep=1
.ends step_in

************** Module elem_to_vec_8 **************
.subckt elem_to_vec_8 vec_out vec_elem_0 vec_elem_1 vec_elem_2 vec_elem_3 vec_elem_4 vec_elem_5 vec_elem_6 vec_elem_7 vec_length=8
.ends elem_to_vec_8

************** Module offset_comp_amp **************
.subckt offset_comp_amp out outb in inb gain=2.0 offset=0.0 min=-0.5 max=0.5 bw=5.0e9 m=1.0e6
.ends offset_comp_amp

************** Module offset_comp_comp **************
.subckt offset_comp_comp a b y z compgain=1.0e6 hyst=50e-3
.ends offset_comp_comp

************** Module offset_comp_package **************
.subckt offset_comp_package in out outb inb ro=50.0 rl=50.0 cp=0.5e-12 cl=0.5e-12 lbw=2.0e-9
.ends offset_comp_package

************** Module offset_comp_package_alt **************
.subckt offset_comp_package_alt in out outb inb rs=0.0 ro=50.0 rl=50.0 cp=0.5e-12 cl=0.5e-12 lbw=2.0e-9
.ends offset_comp_package_alt

************** Module offset_comp_pd **************
.subckt offset_comp_pd in out inb outb fp=1.0
.ends offset_comp_pd

************** Module vec_to_elem_8 **************
.subckt vec_to_elem_8 vec_in vec_elem_0 vec_elem_1 vec_elem_2 vec_elem_3 vec_elem_4 vec_elem_5 vec_elem_6 vec_elem_7 start_elem=0
.ends vec_to_elem_8

************** Module offset_comp_comptop **************
.subckt offset_comp_comptop inb in out outb level=1.0 hyst=0.05 compgain=1.0e6
xi2 n1 constant consval=level
xi0 in n1 a out offset_comp_comp compgain=compgain hyst=hyst
xi1 inb n0 b outb offset_comp_comp compgain=compgain hyst=hyst
xi3 n0 constant consval=level
.ends offset_comp_comptop

************** Module offset_comp_interp **************
.subckt offset_comp_interp in out
xi0 in n0 limitamp
xi1 n0 out edgemeasure
.ends offset_comp_interp

************** Module offset_comp_mux **************
.subckt offset_comp_mux in inb control out outb
xi0 n0 in out control mux2
xi1 n0 inb outb control mux2
xi2 n0 constant consval=0
.ends offset_comp_mux

************** Module offset_comp_limitamp **************
.subckt offset_comp_limitamp in inb out outb vec_out vec_outb gain=-2.0 offset=0.0 min=-0.5 max=0.5 ampbw=5.0e9 m=1e6
xi9 n4 constant consval=0
xi0 n8 n9 in inb offset_comp_amp gain=gain offset=offset min=min max=max bw=ampbw m=m
xi8 vec_outb n9 n0 n7 n2 n12 n5 outb n4 elem_to_vec_8 vec_length=7
xi7 vec_out n8 n1 n10 n3 n11 n6 out n4 elem_to_vec_8 vec_length=7
xi1 n1 n0 n8 n9 offset_comp_amp gain=gain offset=offset min=min max=max bw=ampbw m=m
xi2 n10 n7 n1 n0 offset_comp_amp gain=gain offset=offset min=min max=max bw=ampbw m=m
xi3 n3 n2 n10 n7 offset_comp_amp gain=gain offset=offset min=min max=max bw=ampbw m=m
xi4 n11 n12 n3 n2 offset_comp_amp gain=gain offset=offset min=min max=max bw=ampbw m=m
xi5 n6 n5 n11 n12 offset_comp_amp gain=gain offset=offset min=min max=max bw=ampbw m=m
xi6 out outb n6 n5 offset_comp_amp gain=gain offset=offset min=min max=max bw=ampbw m=m
.ends offset_comp_limitamp

************** Module offset_comp_integrator **************
.subckt offset_comp_integrator in out vec_control gain=1.0 loopgain=1.0
xi0 n0 n1 n3 add2
xi1 n3 n2 n4 add2
xi2 n4 n5 n6 add2
xi3 n6 n8 n7 add2
xi4 n7 n16 n17 add2
xi5 n9 in n10 c1 mux2
xi6 n9 in n11 c2 mux2
xi7 n9 in n12 c3 mux2
xi9 n9 in n13 c4 mux2
xi10 n9 in n14 c5 mux2
xi11 n9 in n15 c6 mux2
xi12 n9 constant consval=0
xi13 n17 n18 out add2
xi15 in n18 integrator k=1*loopgain/(gain*gain*gain*gain*gain*gain*gain)
xi17 vec_control c1 c2 c3 c4 c5 c6 n19 n20 vec_to_elem_8
xi48 n15 n16 integrator k=1*loopgain/(gain*gain*gain*gain*gain*gain*gain)
xi40 n14 n8 integrator k=2*loopgain/(gain*gain*gain*gain*gain*gain*gain)
xi32 n13 n5 integrator k=4*loopgain/(gain*gain*gain*gain*gain*gain*gain)
xi24 n12 n2 integrator k=8*loopgain/(gain*gain*gain*gain*gain*gain*gain)
xi16 n11 n1 integrator k=16*loopgain/(gain*gain*gain*gain*gain*gain*gain)
xi8 n10 n0 integrator k=32*loopgain/(gain*gain*gain*gain*gain*gain*gain)
.ends offset_comp_integrator

************** Module offset_comp_integratortop **************
.subckt offset_comp_integratortop in inb out outb vec_control loopgain=1.0 gain=1.0
xi0 in out vec_control offset_comp_integrator gain=gain loopgain=loopgain
xi1 inb outb vec_control offset_comp_integrator gain=gain loopgain=loopgain
.ends offset_comp_integratortop

************** Module offset_comp_muxtop **************
.subckt offset_comp_muxtop out outb vec_peak vec_peakb vec_control fp=10.0e6
xi7 n0 n10 n1 add2
xi8 n1 n11 n2 add2
xi9 n2 n9 n3 add2
xi10 n3 n8 n4 add2
xi11 n5 n6 n24 add2
xi12 n4 n7 n5 add2
xi13 n23 n22 n12 add2
xi14 n12 n21 n13 add2
xi15 n13 n20 n14 add2
xi16 n14 n19 n15 add2
xi17 n16 n17 n25 add2
xi18 n15 n18 n16 add2
xi0 peak1 peak1b c1 n0 n17 offset_comp_mux
xi1 peak2 peak2b c2 n10 n18 offset_comp_mux
xi2 peak3 peak3b c3 n11 n19 offset_comp_mux
xi3 peak4 peak4b c4 n9 n20 offset_comp_mux
xi4 peak5 peak5b c5 n8 n21 offset_comp_mux
xi5 peak6 peak6b c6 n7 n22 offset_comp_mux
xi6 peak7 peak7b c7 n6 n23 offset_comp_mux
xi19 vec_peak peak1 peak2 peak3 peak4 peak5 peak6 peak7 n26 vec_to_elem_8
xi20 vec_peakb peak1b peak2b peak3b peak4b peak5b peak6b peak7b n27 vec_to_elem_8
xi21 vec_control c1 c2 c3 c4 c5 c6 c7 n28 vec_to_elem_8
xi22 n24 out lowpassfilter fp=10*fp gain=1
xi23 n25 outb lowpassfilter fp=10*fp gain=1
.ends offset_comp_muxtop

************** Module offset_comp_pdtop **************
.subckt offset_comp_pdtop vec_in vec_inb vec_peak_out vec_peak_outb fp=1.0 offset_fb=0.0 var_fb=0.0
xi7 vec_in out1 out2 out3 out4 out5 out6 out7 n18 vec_to_elem_8
xi8 vec_inb out1b out2b out3b out4b out5b out6b out7b n19 vec_to_elem_8
xi9 vec_peak_out peak1 peak2 peak3 peak4 peak5 peak6 peak7 gnd elem_to_vec_8 vec_length=7
xi10 vec_peak_outb peak1b peak2b peak3b peak4b peak5b peak6b peak7b gnd elem_to_vec_8 vec_length=7
xi12 out1 n6 n7 add2
xi13 n6 constant consval=offset_fb/2
xi16 n7 n8 out1x add2
xi17 n8 noise var=var_fb
xi18 n17 noise var=var_fb
xi19 out2 n6 n0 add2
xi20 n0 n8 out2x add2
xi21 out3 n6 n1 add2
xi22 n1 n8 out3x add2
xi23 out4 n6 n2 add2
xi24 n2 n8 out4x add2
xi25 out5 n6 n3 add2
xi26 n3 n8 out5x add2
xi27 out6 n6 n4 add2
xi28 n4 n8 out6x add2
xi29 out7 n6 n5 add2
xi30 n5 n8 out7x add2
xi31 out1b n16 n15 add2
xi32 n15 n17 out1bx add2
xi33 out2b n16 n9 add2
xi34 n9 n17 out2bx add2
xi35 out3b n16 n10 add2
xi36 n10 n17 out3bx add2
xi37 out4b n16 n11 add2
xi38 n11 n17 out4bx add2
xi39 out5b n16 n12 add2
xi40 n12 n17 out5bx add2
xi41 out6b n16 n13 add2
xi42 n13 n17 out6bx add2
xi43 out7b n16 n14 add2
xi44 n14 n17 out7bx add2
xi14 n16 constant consval=-offset_fb/2
xi0 out7x peak7 out7bx peak7b offset_comp_pd fp=fp
xi1 out6x peak6 out6bx peak6b offset_comp_pd fp=fp
xi2 out5x peak5 out5bx peak5b offset_comp_pd fp=fp
xi3 out4x peak4 out4bx peak4b offset_comp_pd fp=fp
xi4 out3x peak3 out3bx peak3b offset_comp_pd fp=fp
xi5 out2x peak2 out2bx peak2b offset_comp_pd fp=fp
xi6 out1x peak1 out1bx peak1b offset_comp_pd fp=fp
.ends offset_comp_pdtop

************** Module offset_comp_controltop **************
.subckt offset_comp_controltop vec_peak_in vec_peak_inb vec_control compgain=1.0e6 hyst=0.05 level=1.0
xi14 n2 n3 inv
xi15 n1 n4 inv
xi16 n0 n5 inv
xi17 c7 n9 inv
xi0 comp_out7 comp_out7b c7 and2
xi1 comp_out6 comp_out6b n0 and2
xi9 comp_out5 comp_out5b n1 and2
xi10 comp_out4 comp_out4b n2 and2
xi11 comp_out3 comp_out3b n6 and2
xi12 comp_out2 comp_out2b n8 and2
xi18 n0 n9 c6 and2
xi19 n1 n5 c5 and2
xi20 n2 n4 c4 and2
xi21 n6 n3 c3 and2
xi22 n8 n7 c2 and2
xi23 n6 n7 inv
xi2 n8 c1 inv
xi3 peak2b peak2 comp_out2 comp_out2b offset_comp_comptop level=level hyst=hyst compgain=compgain
xi4 peak3b peak3 comp_out3 comp_out3b offset_comp_comptop level=level hyst=hyst compgain=compgain
xi5 peak4b peak4 comp_out4 comp_out4b offset_comp_comptop level=level hyst=hyst compgain=compgain
xi6 peak5b peak5 comp_out5 comp_out5b offset_comp_comptop level=level hyst=hyst compgain=compgain
xi7 peak6b peak6 comp_out6 comp_out6b offset_comp_comptop level=level hyst=hyst compgain=compgain
xi8 peak7b peak7 comp_out7 comp_out7b offset_comp_comptop level=level hyst=hyst compgain=compgain
xi13 vec_peak_in peak1 peak2 peak3 peak4 peak5 peak6 peak7 n10 vec_to_elem_8
xi24 vec_peak_inb peak1b peak2b peak3b peak4b peak5b peak6b peak7b n11 vec_to_elem_8
xi25 vec_control c1 c2 c3 c4 c5 c6 c7 gnd elem_to_vec_8 vec_length=7
.ends offset_comp_controltop

************** Module offset_comp_input **************
.subckt offset_comp_input out outb clk datarate=1.0e9 inputamp=0.01 inputoffset=0.01 delay=0.0
xi10 n0 constant consval=0
xi0 n2 n4 outb add2
xi1 n3 n5 out add2
xi9 n0 n1 clk_ref signal_source stype=3 freq=datarate
xi4 n6 clk edgemeasure
xi12 n1 n2 gain gain=-inputamp/2
xi11 n1 n3 gain gain=inputamp/2
xi5 n1 n6 limitamp
xi2 n5 step_in vend=inputoffset/2 vstart=0 tstep=delay
xi3 n4 step_in vend=-inputoffset/2 vstart=0 tstep=delay
.ends offset_comp_input

************** Module offset_comp_fb **************
.subckt offset_comp_fb cont contb vec_out vec_outb ampgain=1.0 loopgain=1.0 compgain=1.0 hyst=1.0 level=1.0 fp=1.0 offset_fb=0.0 var_fb=0.0
xi2 vec_peak vec_peakb vec_control offset_comp_controltop compgain=compgain hyst=hyst level=level
xi3 pdout pdoutb cont contb vec_control offset_comp_integratortop loopgain=loopgain gain=ampgain
xi4 pdout pdoutb vec_peak vec_peakb vec_control offset_comp_muxtop fp=fp
xi1 vec_out vec_outb vec_peak vec_peakb offset_comp_pdtop fp=fp offset_fb=offset_fb var_fb=var_fb
.ends offset_comp_fb

************** Module offset_comp_top **************
.subckt offset_comp_top package packageb package_alt packageb_alt edge_ref edge_clk edge_package_alt edge_package
xi5 in n1 in_comp add2
xi6 inb n0 inb_comp add2
xi25 vec_out out_0 out_1 out_2 out_3 out_4 out_5 out_6 n2 vec_to_elem_8
xi11 out_6 edge_clk offset_comp_interp
xi12 package edge_package offset_comp_interp
xi13 package_alt edge_package_alt offset_comp_interp
xi3 refb contb inb add2
xi4 ref cont in add2
xi18 n0 noise var=0
xi7 n1 noise var=0
xi0 in_comp inb_comp out outb vec_out vec_outb offset_comp_limitamp ampbw=9.30e9
xi1 cont contb vec_out vec_outb offset_comp_fb ampgain=-2.0 loopgain=3.625e6 compgain=1.0e4 hyst=30.0e-3 level=0.25 fp=1.733e6
xi2 ref refb edge_ref offset_comp_input datarate=2.5e9 inputamp=0.0025
xi10 out package_alt packageb_alt outb offset_comp_package_alt rs=39.0 ro=11.0 cp=0.4e-12 cl=1.2e-12 lbw=3.5e-9
xi9 out package packageb outb offset_comp_package ro=11.0 cp=0.4e-12 cl=1.2e-12 lbw=3.5e-9
.ends offset_comp_top


.end

