Patent ID: 8817527

Claim:
A semiconductor device comprising: a control circuit; and a processing unit, wherein the control circuit comprises: a first circuit; a second circuit; and a first memory element, wherein the processing unit comprises: a plurality of second memory elements; and a plurality of flip-flop circuits, wherein the first circuit counts the number of times of turning on and off the second circuit, wherein the second circuit generates a signal input to the plurality of second memory elements and the plurality of flip-flop circuits, wherein in the case where the counted number is higher than or equal to a threshold value, a first data including a first method for storing the signal in the second memory elements and the flip-flop circuits is stored in the first memory element, and in the case where the counted number is lower than the threshold value, a second data including a second method for storing the signal in the second memory elements and the flip-flop circuits is stored in the first memory element, and wherein the plurality of second memory elements each include a capacitor of which one electrode is electrically connected to a power supply line and a transistor of which one of a source and a drain is electrically connected to the other electrode of the capacitor.