1. An integrated circuit device having a state-saving feature comprising: a programmable logic block; at least one volatile data storage unit; a non-volatile memory block; a condition-sensing circuit for detecting at least one condition; a boundary-scan register chain selectively coupleable to said at least one volatile data storage unit; and a state machine coupled to and responsive to said condition-sensing circuit, said state machine operable to selectively couple said boundary-scan register chain to said at least one volatile data storage unit to write data into said non-volatile memory block from said at least one volatile data storage unit.