proc SCHEMATIC_ds_dt_ord3_1bit {} {
make name_net -name clk -origin {-40 340}
make name_net -name x1 -origin {240 300}
make sub2 -name xi2 -origin {320 300}
make sub2 -name xi5 -origin {-120 300}
make name_net -name clk -origin {410 340}
make name_net -name x2 -origin {680 300}
make sub2 -name xi14 -origin {760 300}
make name_net -name clk -origin {900 380}
make name_net -name clk -origin {1390 420}
make comparator_basic -name xi21 -origin {1430 320}
make constant -name xi23 -origin {1310 340}
make name_net -name x3 -origin {1210 300}
make output -name out -origin {1610 320}
make sense_instability_ds -name xi7 -origin {460 710}
make name_net -name assert -origin {630 680}
make name_net -name out -origin {310 680}
make name_net -name clk -origin {310 760}
make inv -name xi8 -origin {730 680}
make constant_bool -name xi9 -val 1 -origin {120 720}
make gain -orient RX -name xi1 -gain vref -origin {1430 530}
make accum_no_delay_and_sat -name xi3 -k 0.25 -psat 10*vref -msat -10*vref -origin {100 300}
make accum_no_delay_and_sat -name xi0 -k 0.25 -psat 10*vref -msat -10*vref -origin {540 300}
make accum_no_delay_and_sat_and_rst -name xi4 -k 0.5 -psat 10*vref -msat -10*vref -origin {1030 300}
make name_net -name in_sampled -origin {-330 300}
make name_net -name noise_in -origin {-330 450}
make add2 -name xi10 -origin {-240 300}
make clocked_white_noise -name xi11 -en_noise en_noise -spectral_density therm_noise -clk_freq clk_freq -origin {-470 450}
make input -name in -origin {-610 300}
make input -name clk -origin {-610 340}
make sampler_w_delay -name xi6 -origin {-470 300}
  make_wire -40 340 0 340
  make_wire 410 340 440 340
  make_wire 350 300 440 300
  make_wire 900 380 930 380
  make_wire 1430 420 1430 360
  make_wire 1430 420 1390 420
  make_wire 1570 320 1610 320
  make_wire 1350 340 1380 340
  make_wire -120 530 320 530
  make_wire -120 530 -120 330
  make_wire -90 300 0 300
  make_wire 320 530 760 530
  make_wire 790 300 930 300
  make_wire 850 340 930 340
  make_wire 790 680 850 680
  make_wire 370 680 310 680
  make_wire 370 760 310 760
  make_wire 850 340 850 680
  make_wire 630 680 700 680
  make_wire 550 680 630 680
  make_wire 370 720 170 720
  make_wire 1380 530 760 530
  make_wire 1470 530 1570 530
  make_wire 1570 320 1510 320
  make_wire 1570 320 1570 530
  make_wire 1210 300 1130 300
  make_wire 1210 300 1380 300
  make_wire 760 330 760 530
  make_wire 680 300 640 300
  make_wire 680 300 730 300
  make_wire 240 300 200 300
  make_wire 240 300 290 300
  make_wire 320 330 320 530
  make_wire -210 300 -150 300
  make_wire -610 300 -550 300
  make_wire -240 450 -240 330
  make_wire -570 450 -550 450
  make_wire -610 340 -570 340
  make_wire -570 340 -550 340
  make_wire -570 340 -570 450
  make_wire -330 300 -390 300
  make_wire -330 300 -270 300
  make_wire -330 450 -390 450
  make_wire -330 450 -240 450
}

proc ICON_ds_dt_ord3_1bit args {

  icon_setup $args {{origin {0 0}} {orient R0} {name x} {vref 1.0} {clk_freq 1e6} {en_noise 0} {therm_noise 10e-9}}
icon_term -type input -origin {-130 -30} -name in
icon_term -type input -origin {-130 50} -name clk
icon_term -type output -origin {130 -30} -name out
icon_property -origin {-120 -30} -label in
icon_property -origin {-120 50} -label clk
icon_property -origin {120 -30} -anchor e -label out
icon_property -origin {-120 -80} -label {$name}
icon_property -origin {-120 -60} -label ds_dt_ord3_1bit
  icon_line -130 -70 130 -70 130 70 -130 70 -130 -70
  icon_property -origin {-120 180} -type user -name name -default x
  icon_line -130 40 -120 50 -130 60
icon_property -origin {-120 80} -label {vref=$vref}
  icon_property -origin {-120 200} -type user -name vref -default 1.0
icon_property -origin {-70 30} -label {in:  range is -vref to vref}
icon_property -origin {-70 50} -label {out: -1 or 1}
icon_property -origin {-120 100} -label {clk_freq=$clk_freq (Hz)}
  icon_property -origin {-120 220} -type user -name clk_freq -default 1e6
  icon_property -origin {-120 240} -type user -name en_noise -default 0
icon_property -origin {-120 120} -label {en_noise=$en_noise (0 or 1)}
  icon_property -origin {-120 260} -type user -name therm_noise -default 10e-9
icon_property -origin {-120 140} -label {therm_noise=$therm_noise (V/rHz)}

}

