Circuits for modulation and demodulation