proc SCHEMATIC_quant_mbit {} {
make input -name in -origin {20 10}
make input -name clk -origin {20 80}
make output -name out -origin {190 10}
make output -name out_int -origin {190 80}
}

proc ICON_quant_mbit args {
  icon_setup $args {{origin {0 0}} {orient R0} {name x} {vref 1.0} {num_bits 4}}
icon_term -type input -origin {-70 -20} -name in
icon_term -type input -origin {-70 50} -name clk
icon_term -type output -origin {130 -20} -name out
icon_term -type output -origin {130 50} -name out_int
icon_property -origin {-60 -20} -label in
icon_property -origin {-60 50} -label clk
icon_property -origin {120 -20} -anchor e -label out
icon_property -origin {-60 -70} -label {$name}
icon_property -origin {-60 -50} -label quant_mbit
  icon_line -70 -60 130 -60 130 70 -70 70 -70 -60
  icon_property -origin {-60 150} -type user -name name -default x
  icon_line -70 40 -60 50 -70 60
icon_property -origin {-60 80} -label {vref=$vref (V)}
  icon_property -origin {-60 170} -type user -name vref -default 1.0
  icon_line -20 40 0 40 0 -30 20 -30
icon_property -origin {120 50} -anchor e -label out_int
icon_property -origin {-60 100} -label {(in range is -vref to +vref)}
icon_property -origin {120 0} -anchor e -label {range: -1 to 1}
icon_property -origin {-60 120} -label {num_bits=$num_bits}
  icon_property -origin {-60 190} -type user -name num_bits -default 4
}

