The present invention relates to systems and methods for processing interrupt and exceptions to instruction flow in processors and, more particularly, to systems and methods for providing variable cycle interrupt disabling.
Processors, including microprocessors, digital signal processors and microcontrollers, operate by running software programs that are embodied in one or more series of instructions stored in a memory. The processors run the software by fetching the instructions from the series of instructions, decoding the instructions and executing them. The instructions themselves control the order in which the processor fetches and executes the instructions. For example, the order for fetching and executing each instruction may be inherent in the order of the instructions within the series. Alternatively, instructions such as branch instructions, conditional branch instructions, subroutine calls and other flow control instructions may cause instructions to be fetched and executed out of the inherent order of the instruction series.
When a processor fetches and executes instructions in the inherent order of the instruction series, the processor may execute the instructions very efficiently without wasting processor cycles to determine, for example, where the next instruction is. When exceptions to normal instruction flow such as interrupts are processed, many processor cycles are taken away from the normal instruction flow to process an interrupt service routing (ISR) corresponding to the interrupt or exception.
In processor applications in which real-time performance of the processor is critical, there is a need to regulate when an interrupt is serviced in order to prevent impairing the real-time performance of the processor. The need may arise at only certain portions of a larger program, for example, when monitoring and processing operations are being performed. At these times, there is a need for a mechanism to prevent the servicing of an interrupt in order to devote processing power to processing the critical program portions.
According to the present invention, a processor for processing a variable cycle interrupt disable instruction DISI X is provided. The instruction disables interrupt processing for a variable number of processor cycles corresponding to the value specified by the instruction operand X. The DISI X instruction may be strategically used by programmers to prevent interrupts from being taken during certain intervals within a program.
According to one embodiment of the invention, a method of processing an interrupt disable instruction includes fetching and executing an interrupt disable instruction that includes an operand specifying a number of cycles for disabling interrupt processing. The instruction operand may be the number or a pointer to the number. The method may further include changing the number based on processor cycles until the number reaches a predetermined value. The number may be changed by incrementing or decrementing with passing processor cycles. The method may include generating an interrupt disable signal during the changing of the number and generating an interrupt enable signal when the number reaches a predetermined value.
According to another embodiment of the invention, a processor includes an interrupt disable instruction processing feature. It includes a program memory, a register and an instruction fetch/decode unit. The program memory stores instructions, including an interrupt disable instruction DISI X, having an operand X specifying a number corresponding to an interrupt disable duration. The register stores the number and an instruction fetch/decode unit fetches and decodes instructions. When an instruction being processed is a DISI X instruction, the instruction fetch/decode unit decodes the DISI X instruction and disables the interrupt processing capability of the processor based on the number X.
The above described features and advantages of the present invention will be more fully appreciated with reference to the detailed description and appended figures in which:
According to the present invention, a processor for processing a variable cycle interrupt disable instruction DISI X is provided. The instruction disables interrupt processing for a variable number of processor cycles corresponding to the value specified by the instruction operand X. The DISI X instruction may be strategically used by programmers to prevent interrupts from being taken during certain intervals within a program.
In order to describe embodiments of DISI X instruction processing, an overview of pertinent processor elements is first presented with reference to
Overview of Processor Elements
The processor 100 includes a program memory 105, an instruction fetch/decode unit 110, instruction execution units 115, data memory and registers 120, peripherals 125, data I/O 130, and a program counter and loop control unit 135. The bus 150, which may include one or more common buses, communicates data between the units as shown.
The program memory 105 stores software embodied in program instructions for execution by the processor 100. The program memory 105 may comprise any type of nonvolatile memory such as a read only memory (ROM), a programmable read only memory (PROM), an electrically programmable or an electrically programmable and erasable read only memory (EPROM or EEPROM) or flash memory. In addition, the program memory 105 may be supplemented with external nonvolatile memory 145 as shown to increase the complexity of software available to the processor 100. Alternatively, the program memory may be volatile memory which receives program instructions from, for example, an external non-volatile memory 145. When the program memory 105 is nonvolatile memory, the program memory may be programmed at the time of manufacturing the processor 100 or prior to or during implementation of the processor 100 within a system. In the latter scenario, the processor 100 may be programmed through a process called in-line serial programming.
The instruction fetch/decode unit 110 is coupled to the program memory 105, the instruction execution units 115 and the data memory 120. Coupled to the program memory 105 and the bus 150 is the program counter and loop control unit 135. The instruction fetch/decode unit 110 fetches the instructions from the program memory 105 specified by the address value contained in the program counter 135. The instruction fetch/decode unit 110 then decodes the fetched instructions and sends the decoded instructions to the appropriate execution unit 115. The instruction fetch/decode unit 110 may also send operand information including addresses of data to the data memory 120 and to functional elements that access the registers.
The program counter and loop control unit 135 includes a program counter register (not shown) which stores an address of the next instruction to be fetched. During normal instruction processing, the program counter register may be incremented to cause sequential instructions to be fetched. Alternatively, the program counter value may be altered by loading a new value into it via the bus 150. The new value may be derived based on decoding and executing a flow control instruction such as, for example, a branch instruction. In addition, the loop control portion of the program counter and loop control unit 135 may be used to provide repeat instruction processing and repeat loop control as further described below.
The instruction execution units 115 receive the decoded instructions from the instruction fetch/decode unit 110 and thereafter execute the decoded instructions. As part of this process, the execution units may retrieve one or two operands via the bus 150 and store the result into a register or memory location within the data memory 120. The execution units may include an arithmetic logic unit (ALU) such as those typically found in a microcontroller. The execution units may also include a digital signal processing engine, a floating point processor, an integer processor or any other convenient execution unit. A preferred embodiment of the execution units and their interaction with the bus 150, which may include one or more buses, is presented in more detail below with reference to FIG. 2.
The data memory and registers 120 are volatile memory and are used to store data used and generated by the execution units. The data memory 120 and program memory 105 are preferably separate memories for storing data and program instructions respectively. This format is a known generally as a Harvard architecture. It is noted, however, that according to the present invention, the architecture may be a Von-Neuman architecture or a modified Harvard architecture which permits the use of some program space for data space. A dotted line is shown, for example, connecting the program memory 105 to the bus 150. This path may include logic for aligning data reads from program space such as, for example, during table reads from program space to data memory 120.
Referring again to
The data I/O unit 130 may include transceivers and other logic for interfacing with the external devices/systems 140. The data I/O unit 130 may further include functionality to permit in circuit serial programming of the Program memory through the data I/O unit 130.
The W registers 240 are general purpose address and/or data registers. The DSP engine 230 is coupled to both the X and Y memory buses and to the W registers 240. The DSP engine 230 may simultaneously fetch data from each the X and Y memory, execute instructions which operate on the simultaneously fetched data and write the result to an accumulator (not shown) and write a prior result to X or Y memory or to the W registers 240 within a single processor cycle.
In one embodiment, the ALU 270 may be coupled only to the X memory bus and may only fetch data from the X bus. However, the X and Y memories 210 and 220 may be addressed as a single memory space by the X address generator in order to make the data memory segregation transparent to the ALU 270. The memory locations within the X and Y memories may be addressed by values stored in the W registers 240.
Any processor clocking scheme may be implemented for fetching and executing instructions. A specific example follows, however, to illustrate an embodiment of the present invention. Each instruction cycle is comprised of four Q clock cycles Q1-Q4. The four phase Q cycles provide timing signals to coordinate the decode, read, process data and write data portions of each instruction cycle.
According to one embodiment of the processor 100, the processor 100 concurrently performs two operations—it fetches the next instruction and executes the present instruction. Accordingly, the two processes occur simultaneously. The following sequence of events may comprise, for example, the fetch instruction cycle:
The following sequence of events may comprise, for example, the execute instruction cycle for a single operand instruction:
The following sequence of events may comprise, for example, the execute instruction cycle for a dual operand instruction using a data pre-fetch mechanism. These instructions pre-fetch the dual operands simultaneously from the X and Y data memories and store them into registers specified in the instruction. They simultaneously allow instruction execution on the operands fetched during the previous cycle.
Variable Cycle Interrupt Disable Instruction and Processing
Referring to
To prevent interruption of a program, program section or portions thereof for a finite interval, a programmer may insert a DISI X instruction. The DISI X instruction causes the processor not to take an interrupt for a certain number of processor cycles defined by or corresponding to the operand X. The DISI X instruction may be placed anywhere in a program.
The instruction fetch and decode unit 300 decodes instructions, including the DISI X instruction, and dispatches the instructions and operands to the ALU 320, memory and registers 330 and the DSP engine 340.
When a DISI X instruction is received, the instruction fetch and decode unit 300 sends the operand X to a decrement register 350. The decrement register 350 may be associated with the interrupt logic 370. The decrement register receives the value of the operand X and is decremented automatically with each passing processor cycle. In one embodiment of the invention, the decrement register decrements the value in the register until it reaches a value of zero at which point the decrementing stops.
Variable cycle disable logic 360 is coupled to the decrement register 350 and to an interrupt logic and exception vector generation unit 370. The variable cycle disable logic receives the value in the decrement register. When the value is non-zero, the variable cycle disable logic generates an interrupt disable signal and transmits the signal to the logic 370. When the value is zero, the variable cycle disable logic 360 generates an interrupt enable signal and transmits the signal to the logic 370.
The interrupt logic and exception vector generation logic 370 receives interrupt request signals from various components of the processor and determines whether and when and to service the interrupt requests based on the priority of the request. When the interrupt logic and exception vector generation logic 370 receives an interrupt disable signal from the variable cycle disable logic, it ceases to generate interrupts but the interrupts continue to be recognized and latched for later invocation.
A program counter 380 is coupled to the interrupt logic and exception vector generation unit 370. The program counter provides addresses to the program memory 310 which determine the next instruction fetched by the instruction fetch and decode unit 300. In the absence of an interrupt, the program counter 300 is incremented (unless a program instruction calls for a jump to a non-sequential instruction). When an interrupt is generated, the value in the program counter 380 is replaced with the address of instructions in the ISR corresponding to the interrupt generated.
When a DISI X instruction is processed, the value X is loaded into a decrement register, which is decremented in successive processor cycles until it reaches a zero value. While the value in the decrement register is not zero, the variable cycle disable logic generates an interrupt disable signal that disables the servicing of interrupts. Accordingly, many instructions in an instruction series after a DISI X instruction may be executed without interruption.
According to one embodiment of the invention, the decrement register is memory mapped. Accordingly, it may be read from and written to by other instructions. This feature may be used to enable interrupts again prior to the natural completion of a variable cycle interrupt disable. As an example, a variable cycle interrupt disable may be used during a subroutine. During or upon completion of the subroutine, an instruction may cause the decrement register to be written with a zero value to end the variable cycle interrupt on the next processor cycle. Alternatively, the subroutine may, upon completion or upon the occurrence of another event, cause the decrement register to be written with a new value. The new value may be zero to terminate the interrupt disable or another value to perpetuate the variable cycle interrupt disable. The decrement register may also be read as any other memory mapped register.
In step 425, the DISI X instruction disables interrupt processing. Then in step 430, the decrement register 350 decrements the value stored in it based on processor cycles. The decrement register may be set to decrement by one, two or any other value with each passing processor cycle. Moreover, the decrement register may decrement with each Q cycle or other signal on the processor. The decrement register may automatically stop decrementing when it reaches zero. Alternatively, a signal may be sent to the decrement register when the value reaches zero to stop the decrement register from decrementing.
In step 440, the processor determines whether the decrement register 350 has reached a predetermined value such as zero. If yes, then step 460 begins.
If not then step 430 begins again and the register value is decremented again. Steps 430 and 440 continue until in step 440 it is determined that the value in the decrement register has reached zero. When this occurs, step 460 begins and the processor enables interrupt processing again.
While specific embodiments of the present invention have been illustrated and described, it will be understood by those having ordinary skill in the art that changes may be made to those embodiments without departing from the spirit and scope of the invention. For example, it will be understood that instead of a decrementing register 350, an incrementing register may be used. Alternatively, the value may be stored in a register that does not increment or decrement. Instead there may be a separate incrementing or decrementing register that produces values that are compared to the X operand of the DISI X instruction. In still other implementations, values other than zero may be chosen as a predetermined value to which to compare the incremented or decremented X value. All of these variations and others are within the scope of the invention.
Number | Name | Date | Kind |
---|---|---|---|
3771146 | Cotton et al. | Nov 1973 | A |
3781810 | Downing | Dec 1973 | A |
3886524 | Appek | May 1975 | A |
3930253 | Maida | Dec 1975 | A |
4025771 | Lynch et al. | May 1977 | A |
4074353 | Woods et al. | Feb 1978 | A |
4090250 | Carlson et al. | May 1978 | A |
4323981 | Nakamura | Apr 1982 | A |
4379338 | Nishitani et al. | Apr 1983 | A |
4398244 | Chu et al. | Aug 1983 | A |
4408274 | Wheatley et al. | Oct 1983 | A |
4451885 | Gerson et al. | May 1984 | A |
4472788 | Yamazaki | Sep 1984 | A |
4481576 | Bicknell | Nov 1984 | A |
4488252 | Vassar | Dec 1984 | A |
4511990 | Hagiwara et al. | Apr 1985 | A |
4556938 | Parker et al. | Dec 1985 | A |
4615005 | Maejima et al. | Sep 1986 | A |
4626988 | George | Dec 1986 | A |
4709324 | Kloker | Nov 1987 | A |
4730248 | Watanabe et al. | Mar 1988 | A |
4742479 | Kloker et al. | May 1988 | A |
4768149 | Konopik et al. | Aug 1988 | A |
4779191 | Greenblatt | Oct 1988 | A |
4782457 | Cline | Nov 1988 | A |
4800524 | Roesgen | Jan 1989 | A |
4807172 | Nukiyama | Feb 1989 | A |
4829420 | Stahle | May 1989 | A |
4829460 | Ito | May 1989 | A |
4839846 | Hirose et al. | Jun 1989 | A |
4841468 | Miller et al. | Jun 1989 | A |
4872128 | Shimizu | Oct 1989 | A |
4882701 | Ishii | Nov 1989 | A |
4926371 | Vassiliadis et al. | May 1990 | A |
4941120 | Brown et al. | Jul 1990 | A |
4943940 | New | Jul 1990 | A |
4945507 | Ishida et al. | Jul 1990 | A |
4959776 | Deerfield et al. | Sep 1990 | A |
4977533 | Miyabayashi et al. | Dec 1990 | A |
4984213 | Abdoo et al. | Jan 1991 | A |
5007020 | Inskeep | Apr 1991 | A |
5012441 | Retter | Apr 1991 | A |
5032986 | Pathak et al. | Jul 1991 | A |
5034887 | Yasui et al. | Jul 1991 | A |
5038310 | Akagiri et al. | Aug 1991 | A |
5040178 | Lindsay et al. | Aug 1991 | A |
5056004 | Ohde et al. | Oct 1991 | A |
5099445 | Studor et al. | Mar 1992 | A |
5101484 | Kohn | Mar 1992 | A |
5117498 | Miller et al. | May 1992 | A |
5121431 | Wiener | Jun 1992 | A |
5122981 | Taniguchi | Jun 1992 | A |
5155823 | Tsue | Oct 1992 | A |
5177373 | Nakamura | Jan 1993 | A |
5197023 | Nakayama | Mar 1993 | A |
5197140 | Balmer | Mar 1993 | A |
5206940 | Murakami et al. | Apr 1993 | A |
5212662 | Cocanougher et al. | May 1993 | A |
5239654 | Ing-Simmons et al. | Aug 1993 | A |
5276634 | Suzuki et al. | Jan 1994 | A |
5282153 | Bartkowiak et al. | Jan 1994 | A |
5327543 | Miura et al. | Jul 1994 | A |
5327566 | Forsyth | Jul 1994 | A |
5375080 | Davies | Dec 1994 | A |
5379240 | Byrne | Jan 1995 | A |
5386563 | Thomas, deceased | Jan 1995 | A |
5392435 | Masui et al. | Feb 1995 | A |
5418976 | Iida | May 1995 | A |
5422805 | McIntyre et al. | Jun 1995 | A |
5432943 | Mitsuishi | Jul 1995 | A |
5448703 | Amini et al. | Sep 1995 | A |
5448706 | Fleming et al. | Sep 1995 | A |
5450027 | Gabara | Sep 1995 | A |
5463749 | Wertheizer et al. | Oct 1995 | A |
5469377 | Amano | Nov 1995 | A |
5471600 | Nakamoto | Nov 1995 | A |
5497340 | Uramoto et al. | Mar 1996 | A |
5499380 | Iwata et al. | Mar 1996 | A |
5504916 | Murakami et al. | Apr 1996 | A |
5506484 | Munro et al. | Apr 1996 | A |
5517436 | Andreas et al. | May 1996 | A |
5525874 | Mallarapu et al. | Jun 1996 | A |
5548544 | Matheny et al. | Aug 1996 | A |
5561384 | Reents et al. | Oct 1996 | A |
5561619 | Watanabe et al. | Oct 1996 | A |
5564028 | Swoboda et al. | Oct 1996 | A |
5568380 | Brodnax et al. | Oct 1996 | A |
5568412 | Han et al. | Oct 1996 | A |
5596760 | Ueda | Jan 1997 | A |
5600813 | Nakagawa et al. | Feb 1997 | A |
5611061 | Yasuda | Mar 1997 | A |
5619711 | Anderson | Apr 1997 | A |
5623646 | Clarke | Apr 1997 | A |
5638524 | Kiuchi et al. | Jun 1997 | A |
5642516 | Hedayat et al. | Jun 1997 | A |
5649146 | Riou | Jul 1997 | A |
5651121 | Davies | Jul 1997 | A |
5657484 | Scarra | Aug 1997 | A |
5659700 | Chen et al. | Aug 1997 | A |
5682339 | Tam | Oct 1997 | A |
5689693 | White | Nov 1997 | A |
5694350 | Wolrich et al. | Dec 1997 | A |
5696711 | Makineni | Dec 1997 | A |
5701493 | Jaggar | Dec 1997 | A |
5706460 | Craig et al. | Jan 1998 | A |
5706466 | Dockser | Jan 1998 | A |
5715470 | Asano et al. | Feb 1998 | A |
5737570 | Koch | Apr 1998 | A |
5740095 | Parant | Apr 1998 | A |
5740419 | Potter | Apr 1998 | A |
5740451 | Muraki et al. | Apr 1998 | A |
5748516 | Goddard et al. | May 1998 | A |
5748970 | Miyaji et al. | May 1998 | A |
5764555 | McPherson et al. | Jun 1998 | A |
5765216 | Weng et al. | Jun 1998 | A |
5765218 | Ozawa et al. | Jun 1998 | A |
5774711 | Henry et al. | Jun 1998 | A |
5778237 | Yamamoto et al. | Jul 1998 | A |
5778416 | Harrison et al. | Jul 1998 | A |
5790443 | Shen et al. | Aug 1998 | A |
5808926 | Gorshtein et al. | Sep 1998 | A |
5812439 | Hansen | Sep 1998 | A |
5812868 | Moyer et al. | Sep 1998 | A |
5815693 | McDermott et al. | Sep 1998 | A |
5825730 | Nishida et al. | Oct 1998 | A |
5826072 | Knapp et al. | Oct 1998 | A |
5826096 | Baxter | Oct 1998 | A |
5828875 | Halvarsson et al. | Oct 1998 | A |
5862065 | Muthusamy | Jan 1999 | A |
5867726 | Ohsuga et al. | Feb 1999 | A |
5875342 | Temple | Feb 1999 | A |
5880984 | Burchfiel et al. | Mar 1999 | A |
5892697 | Brakefield | Apr 1999 | A |
5892699 | Duncan et al. | Apr 1999 | A |
5894428 | Harada | Apr 1999 | A |
5900683 | Rinehart et al. | May 1999 | A |
5909385 | Nishiyama et al. | Jun 1999 | A |
5917741 | Ng | Jun 1999 | A |
5918252 | Chen et al. | Jun 1999 | A |
5930159 | Wong | Jul 1999 | A |
5930503 | Drees | Jul 1999 | A |
5936870 | Im | Aug 1999 | A |
5937199 | Temple | Aug 1999 | A |
5938759 | Kamijo | Aug 1999 | A |
5941940 | Prasad et al. | Aug 1999 | A |
5943249 | Handlogten | Aug 1999 | A |
5944816 | Dutton et al. | Aug 1999 | A |
5951627 | Kiamilev et al. | Sep 1999 | A |
5951679 | Anderson et al. | Sep 1999 | A |
5973527 | Schweighofer et al. | Oct 1999 | A |
5974549 | Golan | Oct 1999 | A |
5978825 | Divine et al. | Nov 1999 | A |
5983333 | Kolagotia et al. | Nov 1999 | A |
5991787 | Abel et al. | Nov 1999 | A |
5991868 | Kamiyama et al. | Nov 1999 | A |
5996067 | White | Nov 1999 | A |
6002234 | Ohm et al. | Dec 1999 | A |
6009454 | Dummermuth | Dec 1999 | A |
6014723 | Tremblay et al. | Jan 2000 | A |
6018757 | Wong | Jan 2000 | A |
6026489 | Wachi et al. | Feb 2000 | A |
6044392 | Anderson et al. | Mar 2000 | A |
6044434 | Oliver | Mar 2000 | A |
6049858 | Kolagotia et al. | Apr 2000 | A |
6055619 | North et al. | Apr 2000 | A |
6058409 | Kozaki et al. | May 2000 | A |
6058410 | Sharangpani | May 2000 | A |
6058464 | Taylor | May 2000 | A |
6061711 | Song et al. | May 2000 | A |
6061780 | Shippy et al. | May 2000 | A |
6061783 | Harriman | May 2000 | A |
6074880 | Sutton et al. | Jun 2000 | A |
6076154 | Van Eijndhoven et al. | Jun 2000 | A |
6084880 | Bailey et al. | Jul 2000 | A |
6101521 | Kosiec | Aug 2000 | A |
6101599 | Wright et al. | Aug 2000 | A |
6115732 | Oberman et al. | Sep 2000 | A |
6128728 | Dowling | Oct 2000 | A |
6134574 | Oberman et al. | Oct 2000 | A |
6144980 | Oberman | Nov 2000 | A |
6145049 | Wong | Nov 2000 | A |
6181151 | Wasson | Jan 2001 | B1 |
6202163 | Gabzdyl et al. | Mar 2001 | B1 |
6205467 | Lambrecht et al. | Mar 2001 | B1 |
6209086 | Chi et al. | Mar 2001 | B1 |
6243786 | Huang et al. | Jun 2001 | B1 |
6243804 | Cheng | Jun 2001 | B1 |
6260162 | Typaldos et al. | Jul 2001 | B1 |
6282637 | Chan et al. | Aug 2001 | B1 |
6292866 | Zaiki et al. | Sep 2001 | B1 |
6295574 | MacDonald | Sep 2001 | B1 |
6315200 | Silverbrook et al. | Nov 2001 | B1 |
6356970 | Killian et al. | Mar 2002 | B1 |
6377619 | Denk et al. | Apr 2002 | B1 |
6397318 | Peh | May 2002 | B1 |
6412081 | Koscal et al. | Jun 2002 | B1 |
6434020 | Lambert et al. | Aug 2002 | B1 |
6487654 | Dowling | Nov 2002 | B2 |
6523108 | James et al. | Feb 2003 | B1 |
6552625 | Bowling | Apr 2003 | B2 |
6564238 | Kim et al. | May 2003 | B1 |
6633970 | Clift et al. | Oct 2003 | B1 |
6643150 | Kawakami | Nov 2003 | B2 |
6658578 | Laurenti et al. | Dec 2003 | B1 |
6681280 | Miyake et al. | Jan 2004 | B1 |
6694398 | Zhao et al. | Feb 2004 | B1 |
6724169 | Majumdar et al. | Apr 2004 | B2 |
6728856 | Grosbach et al. | Apr 2004 | B2 |
6751742 | Duhault et al. | Jun 2004 | B1 |
6763478 | Bui | Jul 2004 | B1 |
20020194466 | Catherwood et al. | Dec 2002 | A1 |
20030093656 | Masse et al. | May 2003 | A1 |
20040150439 | Greenfeld | Aug 2004 | A1 |
Number | Date | Country |
---|---|---|
0 554 917 | Aug 1993 | EP |
0 855 643 | Jul 1998 | EP |
0 992 888 | Dec 2000 | EP |
0 992 889 | Dec 2000 | EP |
01037124 | Feb 1989 | JP |
9611443 | Apr 1996 | WO |
Number | Date | Country | |
---|---|---|---|
20020188784 A1 | Dec 2002 | US |