Voltage detector and phase comparator