text: referring to fig2 , according to a first embodiment of the invention , an automatic register backup / restore system 20 comprises : a general register file 201 , a backup register file 202 , a backup mode signal 203 , seven selectors 204 to 210 , a multiplexer 211 , a logic unit 212 and an external memory 213 . the general register file 201 comprises sixteen general registers r 0 to r 15 for storing data . in normal operation , the general register file 201 is used for storing data from the external memory 213 and by the selection of the multiplexer 211 , and the data in the general register file 201 are transmitted to the logic unit 212 . the multiplexer 211 , the logic unit 212 and the external memory 213 are called an external device . the multiplexer 211 selects data from the logic unit 212 or the external memory 213 as inputs of the general registers in the general register file 201 . the backup register file 202 comprises fifteen backup registers ( br 0 _bm 5 , br 1 _bm 5 , br 2 _bm 5 , br 3 _bm 5 , br 4 _bm 5 , br 5 _bm 1 , br 6 _bm 2 , br 7 _bm 3 , br 8 _bm 4 , br 9 _bm 5 , br 10 _bm 1 , br 11 _bm 2 , br 12 _bm 3 , br 13 _bm 4 and br 14 _bm 5 ) for storing data from the general registers when an exception occurs . the backup register file 202 has five backup modes ( bm 1 to bm 5 ), where each backup mode has at least one backup register , for example , a first backup mode ( bm 1 ) has two backup registers ( br 5 _bm 1 and br 10 _bm 1 ), a second backup mode ( bm 2 ) has two backup registers ( br 6 _bm 2 and br 11 _bm 2 ), a third backup mode ( bm 3 ) has two backup registers ( br 7 _bm 3 and br 12 _bm 3 ), a fourth backup mode ( bm 4 ) has two backup registers ( br 8 _bm 4 and br 13 _bm 4 ) and a fifth backup mode ( bm 5 ) has seven backup registers ( br 0 _bm 5 , br 1 _bm 5 , br 2 _bm 5 , br 3 _bm 5 , br 4 _bm 5 , br 9 _bm 5 , and br 14 _bm 5 ). the backup mode signal 203 is used for determining the backup mode of the backup register file 202 according to a plurality of exceptions . because there are five backup modes in the first embodiment , the backup mode signal 203 must have three bits . if a designer defines five exceptions , for example : svc , abt , irq , undef , and fiq , the five backup modes are corresponding to the five exceptions . each backup mode can define a special backup rule , and determine a storing connection between the backup registers and the general registers . that is , the backup mode defines that the data in the general register of the general register file must be stored to the corresponding backup register . for example , in the first backup mode , two backup registers br 5 _bm 1 and br 10 _bm 1 are connected to two general registers r 13 and r 14 of the general register file 201 , respectively . therefore , when an exception occurs , according to the corresponding backup mode , for example the first backup mode , the data in the two general registers r 13 and r 14 of the general register file 201 are stored to the two backup registers br 5 _bm 1 and br 10 _bm 1 of the backup register file 202 , respectively . the selectors 204 to 210 are used for restoring data from the backup registers to the corresponding general registers . a restoring connection between the backup registers and the general registers is determined by the backup mode . each selector comprises at least two input ports and an output port , where one of the input ports is connected to the multiplexer of the external device , the other input port is connected to the corresponding backup register , and the output port is connected to the corresponding general register . for example , one of the input ports of a first selector 204 is connected to the multiplexer 211 , the other input port is connected to the corresponding backup register br 0 _bm 5 , and the output port is connected to the corresponding general register r 8 . one of the input ports of a seven selector 210 is connected to the multiplexer 211 , the other input ports are connected to the corresponding backup register br 1 _bm 1 , br 11 _bm 2 , br 12 _bm 3 , br 13 _bm 4 and br 14 _bm 5 , and the output port is connected to the corresponding general register r 14 . therefore , the selector can control the input of the general register connecting to the general register or the multiplexer . when the occurred exception completes , according to the backup mode , for example , in the first backup mode , the data in the backup registers br 5 _bm 1 and br 1 _bm 1 of the backup register file 202 are restored to the general registers r 13 and r 14 of the general register file 201 by the sixth selector 209 and the seventh selector 210 so as to execute the original program before the exception occurred . referring to fig3 , according to a second embodiment of the invention , an automatic register backup / restore system 30 comprises : a general register file 301 , a backup register file 302 , a backup mode signal 303 , a restore mode signal 304 , seven selectors 305 to 311 , a multiplexer 312 , a logic unit 313 and an external memory 314 . the general register file 301 comprises sixteen general registers r 0 to r 15 for storing data . in normal operation , the general register file 301 is used for storing data from the external memory 314 and by the selection of the multiplexer 312 , and the data in the general register file 301 are transmitted to the logic unit 313 . the multiplexer 312 , the logic unit 313 and the external memory 314 are called as an external device . the multiplexer 312 selects data from the logic unit 313 or the external memory 314 as inputs of the general registers in the general register file 301 . the backup register file 302 comprises twenty - two backup registers ( br 0 _m 5 , br 1 _m 6 , br 2 _m 5 , br 3 _m 6 , br 4 _m 5 , br 5 _m 6 , br 6 _m 5 , br 7 _m 6 , br 8 _m 5 , br 9 _m 6 , br 10 _m 1 , br 11 _m 2 , br 12 _m 3 , br 13 _m 4 , br 14 _m 5 , br 15 _m 6 , br 16 _m 1 , br 17 _m 2 , br 18 _m 3 , br 19 _m 4 , br 20 _m 5 and br 21 _m 6 ) for storing data from the general registers when an exception occurs . the backup register file 302 has six modes ( m 1 to m 6 ), wherein each mode has a backup mode and a restore mode , each mode has at least one backup register , for example , a first mode ( m 1 , having a first backup mode and a first restore mode ) has two backup registers ( br 10 _m 1 and br 16 _m 1 ), a second mode ( m 2 , having a second backup mode and a second restore mode ) has two backup registers ( br 11 _m 2 and br 17 _m 2 ), a third mode ( m 3 , having a third backup mode and a third restore mode ) has two backup registers ( br 12 _m 3 and br 18 _m 3 ), a fourth mode ( m 4 , having a fourth backup mode and a fourth restore mode ) has two backup registers ( br 13 _m 4 and br 19 _m 4 ), a fifth mode ( m 5 , having a fifth backup mode and a fifth restore mode ) has seven backup registers ( br 0 _m 5 , br 2 _m 5 , br 4 _m 5 , br 6 _m 5 , br 8 _m 5 , br 14 _m 5 , and br 20 _m 5 ) and a sixth mode ( m 6 , having a sixth backup mode and a sixth restore mode ) has seven backup registers ( br 1 _m 6 , br 3 _m 6 , br 5 _m 6 , br 7 _m 6 , br 9 _m 6 , br 15 _m 6 and br 21 _m 6 ). the backup mode signal 303 is used for determining the backup mode of the backup register file 302 according to a plurality of exceptions . the restore mode signal 304 is used for determining the restore mode of the backup register file 302 according to a plurality of exceptions . if a designer defines five exceptions , for example : svc , abt , irq , undef , and fiq , the backup register file 302 has six modes ( the five exceptions and one common mode ), and each mode has a backup mode and a restore mode . each backup mode or restore mode can define a special backup rule and restore rule . the backup mode defines that the data in the general register of the general register file must be stored to the corresponding backup register . for example , in the first backup mode , two backup registers br 10 _m 1 and br 16 _m 1 are connected to two general registers r 13 and r 14 of the general register file 301 respectively . the selectors 305 to 311 are used for restoring data from the backup registers to the corresponding general registers . the restore mode defines that the data in the backup register of the backup register file 302 must be restored to the corresponding general register of the general register file 301 . each selector comprises at least three input ports and an output port , where one of the input ports is connected to the multiplexer of the external device , the other two input ports are connected to the corresponding backup registers , and the output port is connected to the corresponding general register . for example , a first port of the input ports of a first selector 305 is connected to the multiplexer 312 , a second port of the input port is connected to the backup register br 0 _m 5 , the other input port is connected to the backup register br 1 _m 6 , and the output port is connected to the corresponding general register r 8 . one of the input ports of a seven selector 311 is connected to the multiplexer 312 , the other input ports are connected to the corresponding backup register br 16 _m 1 , br 17 _m 2 , br 18 _m 3 , br 19 _m 4 , br 20 _bm 5 and br 21 _m 6 , and the output port is connected to the corresponding general register r 14 . therefore , the selector can control the input of the general register connecting to the general register or the multiplexer . the method for processing data between backup registers and general registers of the system 30 according to the second embodiment is different from that of the system 20 according to the first embodiment . the system 30 has the backup mode signal and the restore mode signal , and whenever an exception occurs or the exception completes and returns , the store action and the restore action must be executed according to the corresponding backup mode and restore mode . that is , when an exception occurs , the store action and the restore action must be executed according to the corresponding backup mode and restore mode . and , when the exception completes and returns , the store action and the restore action must be executed according to the corresponding backup mode and restore mode . according to the first embodiment , when an exception occurs , the data is stored . when the exception completes and returns , the data is restored . the data stored is independent from the data restored . according to the second embodiment , when an exception occurs , the data is stored and is then restored . when the exception completes and returns , the data is restored and is restored . the data is stored and restored at the same time . referring to fig4 , an example illustrates the operation of the system 30 according to the second embodiment . when an irq exception ( defines as a fourth mode m 4 in the second embodiment ) occurs at the usr state , the data a 13 and a 14 in the general registers r 13 and r 14 of the general register file 301 are stored to the backup registers br 15 _m 6 and br 21 _m 6 according to the state ( usr ) occurring the exception and the backup mode ( the sixth backup mode ); and the data b 13 and b 14 in the backup registers br 13 _m 4 and br 19 _m 4 are restored to the general registers r 13 and r 14 of the general register file 301 according to the state ( usr ) occurring the exception and the restore mode ( the fourth restore mode ). when an fiq exception ( defines as a fifth mode m 5 in the second embodiment ) occurs during the processing irq exception , the data c 8 to c 12 in the general registers r 8 to r 12 of the general register file 301 are stored to the backup registers br 1 _m 6 , br 3 _m 6 , br 5 _m 6 , br 7 _m 6 and br 9 _m 6 , and the data c 13 and c 14 in the general registers r 13 and r 14 of the general register file 301 are stored to the backup registers br 13 _m 4 and br 19 _m 4 according to the state ( irq exception ) occurring the fiq exception and the backup mode ( the fourth backup mode ); and the data d 8 to d 14 in the backup registers br 0 _m 5 , br 2 _m 5 , br 4 _m 5 , br 6 _m 5 , br 8 _m 5 , br 14 _m 5 and br 20 _m 5 are restored to the general registers r 8 to r 14 of the general register file 301 according to the state ( irq ) rendering the exception and the restore mode ( the fifth restore mode ). after the fiq exception completes , the data e 8 to e 14 in the general registers r 8 to r 14 of the general register file 301 are stored to the backup registers br 0 _m 5 , br 2 _m 5 br 4 _m 5 br 6 _m 5 , br 8 _m 5 , br 14 _m 5 and br 20 _m 5 according to the state ( fiq ) returning the exception and the backup mode ( the fifth backup mode ); and the data c 8 to c 12 in the backup registers br 1 _m 6 , br 3 _m 6 br 5 _m 6 br 7 _m 6 and br 9 _m 6 are restored to the general registers r 8 to r 12 of the general register file 301 , and the data c 13 and c 14 in the backup registers br 13 _m 4 and br 19 _m 4 are restored to the general registers r 13 and r 14 of the general register file 301 according to the state ( fiq ) returning the exception and the restore mode ( the fourth restore mode ). therefore , the system can store the data c 8 to c 14 in the irq exception when the fiq exception occurs , and the data c 8 to c 14 are restored in order to continuously execute the irq exception after the fiq exception completes . after the irq exception completes , the data f 13 and f 14 in the general registers r 13 and r 14 of the general register file 301 are stored to the backup registers br 13 _m 4 and br 19 _m 4 according to the state ( irq ) returning the exception and the backup mode ( the sixth backup mode ); and the data a 13 and a 14 in the backup registers br 15 _m 6 and br 21 _m 6 are restored to the general registers r 13 and r 14 of the general register file 301 according to the state ( irq ) returning the exception and the restore mode ( the sixth restore mode ). therefore , the system can store the data a 13 and a 14 in the usr state when the irq exception occurs , and the data a 13 and a 14 are restored in order to continuously execute the usr state after the irq exception completes . referring to fig5 a to 5 c , they illustrates the timing during the exception occurring in a microprocessor according to the first and second embodiments of the invention . fig5 a to 5 c only illustrate the timing for executing store action , and do not show the timing for executing restore action . in the fig5 a to 5 c , clock 1 and clock 2 respectively represent the first clock and the second clock . in the embodiment , each instruction is designed to have three states : an instruction fetch state ( if ), an instruction decode state ( id ) and instruction execution state ( exe ). as shown in fig5 a , the first instruction of the main program is ldr instruction , and the second instruction is add instruction , instruction b is the next instruction after an fiq exception occurs . fiq_handler is an address . at the first clock ( clock 1 ) the if ( instruction fetch state ) of the first instruction ldr is executed . at the second clock ( clock 2 ), the id ( instruction decode state ) of the first instruction ldr is executed , and the if ( instruction fetch state ) of the second instruction add is executed at the same time . at the third clock ( clock 3 ), the exe ( instruction execution state ) of the first instruction ldr is executed , and the id ( instruction decode state ) of the second instruction add is executed at the same time . if an fiq exception occurs at the third clock , the program will execute the instruction b . at the fourth clock ( clock 4 ), the content of the general register is stored to the backup register according to the backup mode of the fiq exception . at the same time of the fourth clock ( clock 4 ), the if ( instruction fetch state ) of the instruction b is executed . that is , the time of storing data ( backup ) is the same as the time of the instruction fetch stage of the next instruction after the occurred exception . therefore , the microprocessor does not spend extra time to execute the storing data . referring to fig5 b , the time of storing data ( backup ) is the same as the time of the instruction decode stage ( id ) of the next instruction after the occurred exception . the data is stored at the fifth clock ( clock 5 ) and the time delays one clock compared with fig5 a . the time of storing data ( backup ) is the same as the time of the instruction decode stage ( id ) of the instruction b . at clock 5 , the data in the general register can exactly be stored , and the microprocessor does not spend extra time to execute the storing data . referring to fig5 c , the time of storing data ( backup ) is the same as the time of the instruction execution stage ( exe ) of the next instruction after the occurred exception . the data is stored at the sixth clock ( clock 6 ) and the time delays two clocks compared with fig5 a . the time of storing data ( backup ) is the same as the time of the instruction execution stage ( exe ) of the instruction b . at clock 6 , the data in the general register can be exactly stored , and the microprocessor does not spend extra time to execute the storing data . given the above , the time of storing data can be the same as the time of the instruction fetch stage ( if ), the instruction decode stage ( id ) or the instruction execution stage ( exe ) of the next instruction after the exception . similarly , the time of restoring data can be the same as the time of the instruction fetch stage ( if ), the instruction decode stage ( id ) or the instruction execution stage ( exe ) of the next instruction after the exception completes and returns . therefore , whatever storing data or the restoring data is executed , the microprocessor does not spend extra time to execute the storing data or the restoring data . however , the time of storing data does not need to be the same as the time of the instruction fetch stage ( if ), the instruction decode stage ( id ) or the instruction execution stage ( exe ) of the next instruction after the occurred exception . that is , the time of storing data can be before the time of executing a next instruction after the exception occurred . as shown in fig6 , the time of storing data ( backup ) is at clock 4 , and is before the time ( clock 5 ) of executing the instruction fetch stage ( if ) of the next instruction after the exception occurred . similarly , the time of restoring data can be before the time of executing a next instruction after the exception occurred . therefore , according to the automatic register backup / restore system of the invention , when an exception occurs , the system can reduce data movement between registers and memory . besides , because the system of the invention is one operation mode , the system of the invention does not need select mode bits to determine available register in various operation modes as the conventional technique so as to reduce access time . furthermore , compared with the conventional register windows and the banked register , the system of the invention can decrease the area of chip and the access time . while an embodiment of the present invention has been illustrated and described , various modifications and improvements can be made by those skilled in the art . the embodiment of the present invention is therefore described in an illustrative , but not restrictive , sense . it is intended that the present invention may not be limited to the particular forms as illustrated , and that all modifications which maintain the spirit and scope of the present invention are within the scope as defined in the appended claims .