proc SCHEMATIC_time_to_digital_primitive {} {
make input -name ref_in -origin {340 190}
make input -name clk_in -origin {340 130}
make output -name out_rising -origin {470 130}
make output -name out_falling -origin {470 190}
}

proc ICON_time_to_digital_primitive args {
  icon_setup $args {{origin {0 0}} {orient R0} {name x} {delay_resolution 1.0} {num_levels 1.0}}
icon_term -type input -origin {-100 20} -name ref_in
icon_term -type input -origin {-100 -10} -name clk_in
icon_term -type output -origin {100 -10} -name out_rising
icon_term -type output -origin {100 20} -name out_falling
icon_property -origin {-90 20} -label ref_in
icon_property -origin {-90 -10} -label clk_in
icon_property -origin {90 -10} -anchor e -label out_rising
icon_property -origin {-90 -50} -label {$name}
icon_property -origin {-90 -30} -label time_to_digital_primitive
  icon_line -100 -40 100 -40 100 40 -100 40 -100 -40
icon_property -origin {-90 50} -label {delay_resolution=$delay_resolution}
  icon_property -origin {-90 110} -type user -name name -default x
  icon_property -origin {-90 130} -type user -name delay_resolution -default 1.0
icon_property -origin {-90 70} -label {num_levels=$num_levels}
  icon_property -origin {-90 150} -type user -name num_levels -default 1.0
  icon_line -100 10 -90 20 -100 30 -100 30
icon_property -origin {90 20} -anchor e -label out_falling
}

