A device includes a current source, a first transistor connected between a first supply rail and an output terminal, and a second transistor connected between the output terminal and a first terminal of the current source, wherein a second terminal of the current source is connected to a second supply rail. A variable-gain amplifier circuit responds to a potential at the first terminal of the current source by applying a potential to the control terminal of the first transistor. A gain of the amplifier circuit is determined by a potential at the output terminal.