A
semiconductor device capable of performing arithmetic operation with low
power consumption is provided. The
semiconductor device includes first and second circuits, a first
amplifier circuit, first to fourth switches, and a
capacitor, the first circuit is electrically connected to a first wiring, and the second circuit is electrically connected to a second wiring. The first wiring is electrically connected to a first terminal of the
capacitor through the first switch, and the second wiring is electrically connected to the first terminal of the
capacitor through the third switch. The first terminal of the capacitor is electrically connected to a first terminal of the second switch, and a second terminal of the capacitor is electrically connected to the first
amplifier circuit through the fourth switch. Current corresponding to the result of product-sum operation flows through each of the first and second wirings, and the current is converted into potentials by the first and second circuits. A difference between the converted potentials is held in the capacitor, and the difference is input to the first
amplifier circuit and is output as a potential corresponding to the arithmetic operation result.