A semiconductor device includes a plurality of memory cells, a temperature budget sensor, and a circuit. The circuit periodically compares a signal from the temperature budget sensor to a reference signal and refreshes the memory cells based on the comparison.