A digitally programmable gain amplifier for ultra-low-power applications