Although the parity check circuit and the output selection circuit are provided in the semiconductor device in the embodiment, these circuits may be incorporated in a control circuit such as a CPU or the like without providing them as part of the memory, or may be incorporated in a circuit that combines the memory and the control circuit like a one-chip microcomputer or the like.