proc SCHEMATIC_tristate_ch_pump_with_noise {} {
make input -name up -origin {140 130}
make input -name down -origin {140 290}
make output -name ch_up -origin {680 130}
make output -name ch_down -origin {680 290}
make add2 -orient RY -name xi2 -origin {620 130}
make add2 -name xi3 -origin {620 290}
make gated_charge_pump_noise -name xi4 -thermal_noise_pos thermal_noise_up -thermal_noise_neg 0 -flicker_corner_freq_pos flicker_corner_freq_up -origin {610 0}
make gated_charge_pump_noise -orient RY -name xi5 -thermal_noise_pos thermal_noise_down -thermal_noise_neg 0 -flicker_corner_freq_pos flicker_corner_freq_down -origin {610 410}
make gain -name xi1 -gain i_up/2 -origin {460 130}
make gain -name xi0 -gain i_down/2 -origin {460 290}
make add2 -orient RY -name xi6 -origin {350 130}
make constant -name xi7 -consval 1.0 -origin {260 70}
make add2 -name xi8 -origin {350 290}
make constant -name xi9 -consval 1.0 -origin {250 340}
  make_wire 680 130 650 130
  make_wire 650 290 680 290
  make_wire 590 130 510 130
  make_wire 590 290 510 290
  make_wire 620 50 620 100
  make_wire 170 20 560 20
  make_wire 620 320 620 360
  make_wire 170 290 170 390
  make_wire 170 390 560 390
  make_wire 380 130 420 130
  make_wire 170 20 170 130
  make_wire 300 70 350 70
  make_wire 380 290 420 290
  make_wire 140 130 170 130
  make_wire 170 130 320 130
  make_wire 140 290 170 290
  make_wire 170 290 320 290
  make_wire 350 70 350 100
  make_wire 290 340 350 340
  make_wire 350 340 350 320
}

proc ICON_tristate_ch_pump_with_noise args {
  icon_setup $args {{origin {0 0}} {orient R0} {name x} {i_up 1e-6} {i_down 1e-6} {thermal_noise_up 1e-12} {thermal_noise_down 1e-12} {flicker_corner_freq_up 1e3} {flicker_corner_freq_down 1e3}}
icon_term -type input -origin {-100 0} -name up
icon_term -type input -origin {-100 40} -name down
icon_term -type output -origin {100 0} -name ch_up
icon_term -type output -origin {100 40} -name ch_down
icon_property -origin {-90 0} -label up
icon_property -origin {-90 40} -label down
icon_property -origin {90 0} -anchor e -label ch_up
icon_property -origin {90 40} -anchor e -label ch_down
icon_property -origin {-90 -50} -label {$name}
icon_property -origin {-90 -30} -label tristate_ch_pump_with_noise
  icon_line -100 -60 100 -60 100 60 -100 60 -100 -60
icon_property -origin {-100 70} -label {i_up=$i_up (A)}
icon_property -origin {-100 90} -label {i_down=$i_down (A)}
icon_property -origin {-100 110} -label {thermal_noise_up=$thermal_noise_up (A/sqrt(Hz) single-sided)}
  icon_property -origin {-100 200} -type user -name name -default x
  icon_property -origin {-100 220} -type user -name i_up -default 1e-6
  icon_property -origin {-100 240} -type user -name i_down -default 1e-6
  icon_property -origin {-100 260} -type user -name thermal_noise_up -default 1e-12
icon_property -origin {-100 130} -label {thermal_noise_down=$thermal_noise_down (A/sqrt(Hz) single-sided)}
icon_property -origin {-100 150} -label {flicker_corner_freq_up=$flicker_corner_freq_up (Hz)}
icon_property -origin {-100 170} -label {flicker_corner_freq_down=$flicker_corner_freq_down (Hz)}
  icon_property -origin {-100 280} -type user -name thermal_noise_down -default 1e-12
  icon_property -origin {-100 300} -type user -name flicker_corner_freq_up -default 1e3
  icon_property -origin {-100 320} -type user -name flicker_corner_freq_down -default 1e3
}

