diode function generator