A semiconductor device includes an electrical circuit formed on a substrate; a level detector outputting a first level signal which has a signal level based on power supply voltage and which determines an operation of the electrical circuit; a command decoder decoding a command that is inputted from the outside, and outputting a command signal; a control circuit to which the command signal is inputted, the control circuit outputting a state signal expressing whether the electrical circuit is in an operation state; and a first latch circuit to which the first level signal and the state signal are inputted, the first latch circuit latching the first level signal at a time based on the state signal.