FIG. 38 is a configuration example of the first circuit 660. The first circuit 660 illustrated in FIG. 38 includes a signal processing circuit 661, a column driver circuit 662, and an output circuit 663. The signal processing circuit 661 includes a circuit 664 provided in each column. The circuit 664 includes a circuit 664a that can remove noise by a correlated double sampling (CDS) method (also referred to as a “CDS circuit”), a counter circuit 664b, and a latch circuit 664c. The circuit 664 has a function of analog-digital conversion. The signal processing circuit 661 can function as a column-parallel (column type) analog-digital conversion device.
The circuit 664a includes a comparator, a switch, and a capacitor. Two input terminals of the comparator are connected to each other via the switch. As the switch, a transistor, a microelectromechanical systems (MEMS) element, or the like may be used. One terminal of the comparator is connected to a wiring 667 via the capacitor. The other terminal of the comparator is connected to a wiring 623 that is provided in each column. Note that the other terminal of the comparator and the wiring 623 may be connected to each other via a capacitor.