proc SCHEMATIC_duty_cycle_clk_source {} {
make constant -name xi0 -origin {-520 110}
make xor2 -name xi4 -origin {90 90}
make output -name out -origin {140 90}
make name_net -name clk -origin {-220 70}
make signal_source -name xi1 -freq frequency/2 -origin {-380 130}
make variable_delay -name xi2 -nom_delay 2/frequency -control_gain 1/frequency -origin {-80 160}
make input -name duty_cycle -origin {-250 300}
  make_wire -10 140 10 140
  make_wire -220 70 50 70
  make_wire 110 90 140 90
  make_wire -250 110 -220 110
  make_wire -220 140 -150 140
  make_wire 50 110 10 110
  make_wire 10 110 10 140
  make_wire -220 70 -220 110
  make_wire -220 110 -220 140
  make_wire -250 300 -180 300
  make_wire -180 170 -150 170
  make_wire -180 170 -180 300
}

proc ICON_duty_cycle_clk_source args {
  icon_setup $args {{origin {0 0}} {orient R0} {name x} {frequency 1.0e3}}
icon_term -type output -origin {90 0} -name out
icon_term -type input -origin {-90 0} -name duty_cycle
icon_property -origin {80 0} -anchor e -label out
icon_property -origin {-80 -40} -label {$name}
icon_property -origin {-80 -20} -label duty_cycle_clk_source
  icon_line -90 -30 90 -30 90 30 -90 30 -90 -30
  icon_property -origin {-90 100} -type user -name name -default x
  icon_property -origin {-90 120} -type user -name frequency -default 1.0e3
icon_property -origin {-90 40} -label {frequency=$frequency (Hz)}
  icon_line -10 20 10 20 10 0 20 0 20 20 40 20 40 0 50 0 50 20 70 20
icon_property -origin {-80 0} -label duty_cycle
}

