In the first read operation, a read current is supplied to TMR elements connected
in parallel in one column or one block to detect initial data. Trial data is then
written in a selected memory cell. At the same time of or in parallel with writing
of the trial data, the second read operation is performed. In the second read operation,
a read current is supplied to the TMR elements connected in parallel in one column
or one block to read comparison data. Subsequently, the initial data is compared
with the comparison data to determine the data value in the selected memory cell.
Finally, rewrite operation is performed for the selected memory cell.