A processor and an interrupt controller therein
By designing an interrupt controller, selecting the highest priority interrupt and temporarily stopping the high priority interrupt, the processor's efficiency problem in multiple interrupts is solved, and the interrupt response and processing speed are improved and the resource release is quickly released.
Patent Information
- Application Number
- CN201910238111.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-03-27
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2039-03-27
AI Technical Summary
When processing multiple interrupts, how can a processor efficiently handle various interrupts with different priorities, avoid deadlock conditions, and improve interrupt response and processing speed.
An interrupt controller is designed, including an interrupt sampling unit and an arbitration unit. By selecting modules and threshold comparison modules, the interrupt with the highest priority is selected, and the modules are temporarily stopped by the high priority interrupts to handle the low priority. interrupts, thereby increasing response speed and resource release.
It realizes priority processing of responded interrupts in case of interrupt nesting, reduce resource usage, improve interrupt processing efficiency and flexibility, and ensures that high-priority interrupts can be processed quickly.
Smart Images

Figure CN111752877B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of processors, and in particular to the field of interrupt processing in processors. Background Art
[0002] The processor needs to handle interrupts from interrupt sources such as I / O devices and timers. The processor handles interrupts by executing interrupt service routines. Since the processor needs to handle different interrupts from multiple interrupt sources, each interrupt has its corresponding interrupt priority and interrupt vector number. Interrupts with high interrupt priority need to be handled first, and it is also expected that interrupts that have been waiting for a long time can be handled immediately so as not to occupy processor resources for too long. Therefore, when the processor handles multiple interrupts, how to efficiently handle various interrupts with different priorities is one of the problems faced by the processor field.
[0003] In addition, when a low-priority interrupt is preempted by a high-priority interrupt, if the low-priority interrupt does not release other resources required for the high-priority interrupt, it will cause a "deadlock" situation in which the high-priority interrupt cannot continue to execute. Therefore, the processor also needs to be able to efficiently handle various interrupts with different priorities.
[0004] Therefore, a new interrupt controller solution in the processor is needed to implement a more efficient interrupt handling method to speed up interrupt response and processing. Summary of the invention
[0005] To this end, the present invention provides a new processor and an interrupt controller therein, in an effort to solve or at least alleviate at least one of the above problems.
[0006] According to one aspect of the present invention, an interrupt controller is provided, comprising an interrupt sampling unit, adapted to receive interrupts from interrupt sources coupled to the interrupt controller; and an arbitration unit, adapted to select an interrupt to be responded to from the received interrupts. The arbitration unit comprises: a selection module, adapted to select a highest priority interrupt with the highest priority from various interrupts; and a threshold comparison module, coupled to the selection module, adapted to compare the priority of the highest priority interrupt with a preset priority threshold. The arbitration unit is adapted to select the highest priority interrupt as the interrupt to be responded to when the threshold comparison module determines that the priority of the highest priority interrupt is higher than the priority threshold.
[0007] Optionally, in the interrupt controller according to the present invention, the arbitration unit further comprises: a threshold setting module, adapted to set a priority threshold; and a threshold clearing module, adapted to clear the priority threshold.
[0008] Optionally, the interrupt controller according to the present invention also includes a vector number register, and a threshold setting module is suitable for storing an interrupt vector number corresponding to the priority threshold in the vector number register when setting the priority threshold, and the threshold clearing module is suitable for clearing the priority threshold when the current interrupt processing is completed if the interrupt vector number of the current interrupt is the same as the interrupt vector number stored in the vector number register.
[0009] Optionally, the interrupt controller according to the present invention also includes a priority register, and a threshold setting module is suitable for storing an interrupt priority of an interrupt to be processed whose priority is not higher than the threshold in the priority register when setting the priority threshold, and the threshold clearing module is suitable for clearing the priority threshold when the current interrupt processing is completed if the interrupt priority of the current interrupt is the same as the interrupt priority stored in the priority register.
[0010] Optionally, in the interrupt controller according to the present invention, the threshold clearing module is suitable for determining that the current interrupt processing is completed when the processor core of the processor executes an interrupt return instruction, and obtaining the interrupt vector number of the interrupt being processed in the processor core as the interrupt vector number of the current interrupt and / or obtaining the interrupt priority level of the interrupt being processed in the processor core as the interrupt priority level of the current interrupt.
[0011] Optionally, in the interrupt controller according to the present invention, the threshold clearing module is adapted to clear the priority threshold when there is no interrupt nesting.
[0012] Optionally, in the interrupt controller according to the present invention, the threshold setting module is adapted to set the interrupt priority of one of the interrupts currently being processed as the priority threshold.
[0013] Optionally, in the interrupt controller according to the present invention, the threshold clearing module is adapted to set the priority threshold to the lowest interrupt priority to clear the priority threshold.
[0014] Optionally, the interrupt controller according to the present invention further comprises: an interrupt configuration unit adapted to store the interrupt priority and interrupt processing status of each interrupt. The threshold clearing module is adapted to determine whether interrupt nesting exists according to the interrupt priority of each interrupt stored in the interrupt configuration unit, and the threshold setting unit is adapted to determine the interrupt currently being processed according to the interrupt processing status of each interrupt stored in the interrupt configuration unit.
[0015] Optionally, in the interrupt controller according to the present invention, the arbitration unit also includes: a priority comparison module, coupled to the selection module, suitable for comparing the priority of the highest priority interrupt with the priority of the interrupt currently executed in the processor, wherein the arbitration unit is also suitable for selecting the highest priority interrupt as the interrupt to be responded to when the threshold comparison module determines that the priority of the highest priority interrupt is higher than the set priority threshold and the priority comparison module determines that the priority of the highest priority interrupt is higher than the priority of the interrupt currently executed in the processor.
[0016] According to another aspect of the present invention, a processor is provided, comprising an interrupt controller according to the present invention, suitable for receiving interrupts from interrupt sources coupled to the interrupt controller and selecting interrupts to be processed; and a processor core, coupled to the interrupt controller, and processing the interrupts selected by the interrupt controller.
[0017] According to another aspect of the present invention, there is provided a system on chip, comprising a processor according to the present invention; and one or more interrupt sources, coupled to the processor and generating interrupts to be processed by the processor.
[0018] According to the solution of the present invention, by setting a priority threshold, the processing of high-priority interrupts can be temporarily stopped, and a specific target interrupt with a lower priority can be processed first in the processor, thereby improving the response and processing speed of the target interrupt and releasing resources as soon as possible. This solution allows the processor to process the interrupt that has been responded to first when interrupt nesting occurs in the processor, thereby releasing processor resources as soon as possible.
[0019] In addition, according to the solution of the present invention, an interrupt priority threshold can be set for a specific interrupt, and the set interrupt priority threshold can be automatically cleared after the interrupt is processed. This allows the processor to quickly process the specific interrupt and immediately process high-priority interrupts after the specific interrupt is processed. In this way, the processor's interrupt processing method is more efficient and flexible. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] To achieve the above and related purposes, certain illustrative aspects are described herein in conjunction with the following description and accompanying drawings, which indicate various ways in which the principles disclosed herein can be practiced, and all aspects and their equivalents are intended to fall within the scope of the claimed subject matter. The above and other purposes, features and advantages of the present disclosure will become more apparent by reading the following detailed description in conjunction with the accompanying drawings. Throughout the present disclosure, the same reference numerals generally refer to the same parts or elements.
[0021] Figure 1 A schematic diagram of a processor 100 according to an embodiment of the present invention is shown;
[0022] Figure 2 A schematic diagram of an interrupt controller 200 according to an embodiment of the present invention is shown;
[0023] Figure 3 A schematic diagram showing a threshold clearing module 240 according to an embodiment of the present invention; and
[0024] Figure 4 A schematic diagram of a system on chip (SoC) 400 according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0025] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0026] Figure 1 FIG. 1 is a schematic diagram of a processor 100 according to an embodiment of the present invention. Figure 1 As shown, the processing system 190 includes a processor 100 and various interrupt sources 210 coupled to the processor 100. The interrupt source 210 generates various types of interrupts and is processed by the processor 100. The processor 100 includes a processor core 150 and an interrupt controller 200. The processor core 150 further includes an instruction processing device 110 and a processor resource 120. The instruction processing device 110 is an instruction processing component in the processor 200, and the processing content includes taking out instructions for decoding and then executing various decoded instructions. The instruction processing device 110 responds to the interrupt at the same time, changes the program flow of the instruction execution in the processor 100, and executes the corresponding interrupt processing program. It should be noted that the instruction processing device 110 is a logical division of the functions of the processor 100, and all the components related to instructions in the processor 100 can be divided into a part of the instruction processing device 110 without exceeding the protection scope of the present invention.
[0027] According to one embodiment, the instruction processing device 110 includes an instruction fetch unit 112, an instruction decoding unit 114 and an instruction execution unit 116. The instruction fetch unit 112 fetches instructions to be executed from the instruction storage area 130 and sends the fetched instructions to the instruction decoding unit 112.
[0028] Instructions generally include an operation code and an address code, wherein the operation code indicates the operation to be performed; and the address code indicates the address or content of the operation object when the operation code is executed. The instruction decoding unit 114 can decode and analyze the instruction to determine the operation code of the instruction and further determine the nature and method of the operation.
[0029] Subsequently, the instruction decoding unit 114 sends the decoded instruction to the instruction execution unit 116, and the instruction is executed in the instruction execution unit 116. According to one embodiment of the present invention, the instruction execution unit 116 includes various execution units for executing special instructions. The present invention is not limited to the specific form of the instruction execution unit for executing special instructions, and all instruction execution units 116 that can execute instructions are within the protection scope of the present invention.
[0030] During execution, the instruction execution unit 116 accesses the processor resources 120 such as various registers and the data storage area 140. For example, it obtains data from the registers and the data storage area 140, and writes the execution results into the registers or the data storage space.
[0031] The processor core 150 also includes an interrupt processing module 152. During the instruction processing of the instruction processing device 110, the interrupt processing module 152 responds to the external interrupt, and thus can change the program currently executed in the processor through the instruction processing device 110, and run the interrupt service program corresponding to the external interrupt to handle the interrupt.
[0032] According to one embodiment, when responding to an interrupt, the processor core 150 first saves the current processor state and the processor execution scene (processor PC), obtains the interrupt service program entry address according to the interrupt information of the interrupt being responded to, and jumps to the address to start processing the interrupt task; after processing the interrupt task, the processor core 150 executes the interrupt return instruction, the processor restores the previously saved processor state, and returns to the previous scene (saved PC) to continue execution. The interrupt processing module 152 can perform the above interrupt response processing through the instruction processing device 110.
[0033] The interrupt controller 200 is coupled to the processor core 150, and selects the interrupt to be processed and sends it to the processor core 150 for processing. Each interrupt has a corresponding interrupt priority and an interrupt vector number. The processor 100 determines the processing order of the interrupts according to the interrupt priorities of each interrupt. When multiple interrupts occur simultaneously, the interrupt with a high priority will be processed first. The processor 100 also determines the interrupt service program when responding to the interrupt for processing according to the interrupt vector number of the interrupt. For example, the base address of the interrupt service program is stored in the interrupt register of the processor resource 120. The processor 100 can determine the entry address of the corresponding interrupt service program according to the base address and the interrupt vector number, and change the processor PC to point to the entry address, so that the instruction processing device 100 executes the interrupt service program.
[0034] Figure 2A schematic diagram of an interrupt controller 200 according to an embodiment of the present invention is shown. The interrupt controller 200 obtains interrupts from a plurality of interrupt sources 210 coupled thereto and selects interrupts to be sent to the processor core 150 for processing.
[0035] like Figure 2 As shown, the interrupt controller 200 includes an interrupt sampling unit 220 and an arbitration unit 230. The interrupt sampling unit 220 receives each interrupt from each interrupt source 210 coupled to the interrupt controller 200. Generally, the clock of the external interrupt source 210 is asynchronous with the processor clock. The sampling unit 220 synchronizes and samples the external interrupt source 210 with the processor clock to generate valid interrupt information. In addition, the interrupt source 210 has two different trigger attributes: level triggering and edge triggering (or pulse triggering). The interrupt sampling unit 220 samples these two different triggering modes and unifies them into one processing mode.
[0036] The arbitration unit 230 selects an interrupt to be sent to the processor core 150 for response processing from each interrupt received by the interrupt sampling unit 220. The arbitration unit 230 includes a selection module 232 and a threshold comparison module 234. The selection module 232 selects the highest priority interrupt with the highest priority from the received interrupts. Each interrupt may have pre-configured interrupt information. The interrupt information includes an interrupt priority and an interrupt vector number.
[0037] Optionally, the interrupt information can be stored in the interrupt configuration unit 240 of the interrupt controller 200. The interrupt configuration unit 240 stores the interrupt information (including interrupt priority and interrupt processing status) of each interrupt. The interrupt priority of the interrupt can be configured in the interrupt configuration unit 240 so that the processor 100 schedules the response processing of the interrupt according to the interrupt priority. According to the situation in which the interrupt is processed by the processor, the interrupt has multiple processing states, including interrupt waiting (pending) and interrupt response (active). The interrupt waiting (pending) state indicates that the interrupt has been generated by the interrupt source 210 and received by the interrupt sampling unit 220, but has not been responded to and processed by the processor core 150. The interrupt response (active) state indicates that the interrupt has not only been received by the interrupt sampling unit 220, but has also been processed by the processor core 150, but has not yet been processed. This includes not only the situation that is currently being processed in the processor core 150, but also the situation that the processor core 150 preferentially executes the interrupt with a high priority due to interrupt nesting and is temporarily interrupted.
[0038] Interrupt nesting means that when the processor core 150 is processing a lower priority interrupt, the processor core 150 receives a new interrupt with a higher priority. At this time, the processor core 150 needs to temporarily stop processing the lower priority interrupt, store the scene of the interrupt (including the current program counter PC, push the contents of the relevant registers into the corresponding stack), and start executing the processing corresponding to the high priority interrupt, thus generating interrupt nesting. When there are many levels of interrupt nesting, a large amount of processor resources will be consumed due to the need to store more interrupt information.
[0039] According to an implementation, the interrupt configuration unit 240 may use registers to store configuration information of each interrupt. By changing the values of corresponding positions of these registers, the status of each interrupt may be modified.
[0040] Optionally, the interrupt configuration unit 240 also stores an enable bit of each interrupt to indicate whether to adopt and process the interrupt. The interrupt sampling unit 220 can determine whether to adopt the interrupt according to the value of the enable bit of each interrupt.
[0041] The selection module 232 can select the interrupt with the highest priority according to the interrupt configuration information stored in the interrupt configuration unit 240. According to one embodiment, the selection module 232 can select the interrupt with the highest priority from the interrupts in the pending state and the interrupts newly adopted by the sampling unit 220. According to another embodiment, after each interrupt is sampled by the sampling unit 220, the interrupt processing state in the interrupt configuration unit 240 is first modified to pending, and then the selection module 232 selects the interrupt with the highest priority from all the interrupts in the pending state for subsequent processing. The present invention is not limited to the specific form of interrupt selection by the selection module 232, and all methods that can select the highest priority interrupt from the interrupts that are not currently processed by the processor core 150 are within the protection scope of the present invention.
[0042] The threshold comparison module 234 is coupled to the selection module 232, and compares the priority of the highest priority interrupt with the highest priority selected by the selection module 232 with a preset priority threshold. When the threshold comparison module 234 determines that the priority of the highest priority interrupt is higher than the priority threshold, the arbitration unit 230 selects the highest priority interrupt as the interrupt to be output to the processor core 150 for response processing. In the arbitration unit 230, the threshold comparison module 234 can be used to set the priority threshold to shield interrupts with a priority lower than the priority threshold from being sent to the processor core 150 for response processing. In this way, when the processor core 150 is processing multiple interrupts and is in interrupt nesting, the interrupt currently in nesting can be processed by the processor core 150 first, thereby reducing the processor resource occupation caused by interrupt nesting.
[0043] There are multiple ways to clear the priority threshold so that the threshold comparison module 234 does not work. According to one embodiment, the priority threshold value may not be set or may be set to null to clear the priority threshold. According to another embodiment of the present invention, a corresponding enable bit may be set to indicate whether the threshold comparison module 234 works, and when the arbitration unit 230 outputs an interrupt with the highest priority without performing a priority threshold comparison, the enable bit is set to make the threshold comparison module 234 inoperative. According to another embodiment of the present invention, the priority threshold may be set to the lowest priority value so that the priority of all interrupts is higher than this priority, making the threshold comparison module 234 inoperative.
[0044] The priority threshold can be stored in the threshold register 250 and can be configured and modified. The present invention is not limited to the specific storage form of the priority threshold, and all methods that can read and modify the priority threshold are within the protection scope of the present invention.
[0045] In order to set and clear the priority threshold, the arbitration unit 230 also includes a threshold setting module 238 and a threshold clearing module 239. The threshold setting module 238 sets the priority threshold, and the threshold clearing module 239 is suitable for clearing the priority threshold. The threshold clearing module 239 can automatically trigger the clearing of the priority threshold when a predetermined condition is met. According to one embodiment of the present invention, the threshold clearing module 239 can set the priority threshold to the lowest priority to clear the priority threshold. According to another embodiment of the present invention, the threshold clearing module 239 can set the priority threshold to null to clear the priority threshold. The threshold setting module 238 is used to set the priority threshold so that the threshold comparison module 234 works, and the threshold clearing module 239 automatically clears the priority threshold when the condition is met so that the threshold comparison module 234 does not work. The priority threshold can be set for a specific interrupt so that the specific interrupt is quickly responded to and processed without affecting the processing of other interrupts.
[0046] According to one embodiment of the present invention, the interrupt controller 200 includes a vector number register 260. When setting the priority threshold, the threshold setting module 238 may store the interrupt vector number corresponding to the priority threshold in the vector number register 260. For example, in order to allow an interrupt with an interrupt vector number of 16 and an interrupt priority of 2 to be processed as quickly as possible, the threshold setting module 238 may set the priority threshold to 2, thereby preventing interrupts with a priority higher than and equal to the threshold 2 from being sent to the processor core 150 for processing. At the same time, the threshold setting module 238 may store the interrupt vector number 16 in the vector number register 260.
[0047] When the processor core 150 completes processing of the current interrupt, the threshold clearing module 239 can obtain the interrupt vector number of the current interrupt from the processor core 150, and when the interrupt vector number is equal to the interrupt vector number stored in the vector number register 160, clear the priority threshold so that the threshold comparison module 234 no longer works.
[0048] According to another embodiment of the present invention, the interrupt controller 200 includes a priority register 270. When setting the priority threshold, the threshold setting module 238 may store the interrupt priority of the interrupt to be processed first but whose priority is not higher than the priority threshold in the priority register 270. For example, in order to process the interrupt with the interrupt priority of 2 as soon as possible, the threshold setting module 238 may set the priority threshold to 2, thereby preventing the interrupt with the priority higher than and equal to the threshold 2 from being sent to the processor core 150 for processing. At the same time, the threshold setting module 238 may store the interrupt priority 2 in the priority register 270.
[0049] When the processor core 150 completes processing of the current interrupt, the threshold clearing module 239 can obtain the interrupt priority of the current interrupt from the processor core 150, and when the interrupt priority is equal to the interrupt priority stored in the priority register 160, clear the priority threshold so that the threshold comparison module 234 no longer works.
[0050] According to one embodiment, when the processor core 150 is about to complete processing an interrupt, an interrupt return instruction is executed. The interrupt controller 200, in particular the threshold clearing module 239, can be triggered when the processor core 150 executes the interrupt return instruction, and can obtain the interrupt priority and / or interrupt vector number of the currently executing interrupt from the processor core 150. For example, the threshold clearing module 239 can read a register in the processor core 150 to obtain the interrupt priority and / or interrupt vector number of the currently executing interrupt.
[0051] According to another embodiment, when there is no interrupt nesting in the processor core 150, it is not necessary to set the priority threshold because there may be no interrupt being processed or only one interrupt being processed in the processor core 150. Therefore, the threshold clearing module 239 can clear the priority threshold at this time.
[0052] Optionally, the threshold clearing module 239 may determine whether interrupt nesting exists by referring to the interrupt processing status of each interrupt stored in the interrupt configuration unit 240. The interrupt processing status of each interrupt indicates whether the corresponding interrupt has been responded to and is being processed by the processor core 150. When only one interrupt or no interrupt is processed by the processor core 150 according to the processing status of each interrupt in the interrupt configuration unit 240, it can be considered that there is no interrupt nesting at this time, and the threshold clearing module 239 clears the priority threshold accordingly.
[0053] According to another embodiment, the threshold setting module 238 can set a priority threshold for the interrupt currently being responded to and processed by the processor core 150, thereby preventing interrupts with a higher interrupt priority than the interrupt being processed from being responded to by the processor core 150. At this time, the threshold setting module 238 can set the interrupt priority of the interrupt being processed to the priority threshold so that the threshold comparison module 234 can take effect.
[0054] Similarly, the threshold setting module 238 can set the priority threshold with reference to the interrupt processing information of each interrupt stored in the interrupt configuration unit 240. The threshold setting module 238 can select the interrupt for which the priority threshold is to be set from the interrupts whose interrupt processing status is interrupt response (active), and set the priority threshold to the priority of the selected interrupt.
[0055] Figure 3 An example of a specific logic implementation 300 of the threshold clearing module 239 is adaptively shown. Figure 3 As shown, at comparator 310, the priority or vector number of the interrupt being processed in processor core 150 is compared with the value in priority register 270 or vector number register 260. The output level of comparator 310 is ANDed with the processor interrupt return instruction at AND gate 320. OR gate 330 receives the output of AND gate 320 and the indication level of interrupt nesting, and the output of OR gate 330 is the control input of 2-to-1 multiplexer 340.
[0056] When the logic circuit is executed, when the output of the OR gate 330 is 1, the multiplexer 340 selects the value of the lowest priority to output as the priority threshold, thereby clearing the priority threshold, and causing the threshold comparison module 234 to no longer function. In order for the output of the OR gate 330 to be 1, either the indication value of no nested interrupts is 1, or the output of the AND gate 320 is 1. The output of the AND gate 320 is 1 only when the priority or vector number of the interrupt being processed is equal to the value in the priority register 270 or the vector number register 260 (at this time, the output level of the comparator 310 is 1) and there is a processor interrupt return instruction.
[0057] according to Figure 3 The logical implementation method 300 of the threshold clearing module 239 is that when there is no interrupt nesting, the threshold clearing module 239 clears the priority threshold and makes the threshold comparison module 234 inoperative; when there is interrupt nesting, after the interrupt processing is completed (the processor executes the interrupt return instruction) and the priority or vector number of the interrupt being processed is the value in the priority register 270 or the vector number register 260, the threshold clearing module 239 will also clear the priority threshold and make the threshold comparison module 234 inoperative.
[0058] Continue to refer Figure 2 According to another embodiment of the present invention, the arbitration unit 230 further includes a priority comparison module 236. The priority comparison module 236 is coupled to the selection module 232, and compares the priority of the highest priority interrupt selected by the selection module 232 with the priority of the interrupt currently being processed in the processor core 150. When the priority of the highest priority interrupt is higher than the priority of the interrupt currently being processed, the priority comparison module 236 determines that the highest priority interrupt can be selected as the interrupt to be responded to and processed by the processor core 150.
[0059] The arbitration unit 230 determines whether to send the highest priority interrupt to the processor core 150 according to the comparison results of the threshold comparison module 234 and the priority comparison module 236. When the threshold comparison module 234 determines that the priority of the highest priority is higher than the priority threshold, and the priority comparison module 236 determines that the priority of the highest priority interrupt is higher than the priority of the interrupt currently being processed, the arbitration unit 230 sends the selected highest priority interrupt to the processor core for processing.
[0060] The present invention is not limited to the comparison order of the threshold comparison module 234 and the priority comparison module 236 , and all methods that can consider the comparison results of the threshold comparison module 234 and the priority comparison module 236 together are within the protection scope of the present invention.
[0061] The processor core 150 receives the interrupt output by the interrupt controller 200. When the processor core 150 is processing an interrupt, and the interrupt priority of the interrupt output by the interrupt controller 200 is higher than the interrupt priority of the interrupt being processed in the processor core 150, the processing of the interrupt being processed is suspended, and the interrupt selected by the interrupt controller 150 is started, thereby generating interrupt nesting.
[0062] In addition, when the priority comparison module 236 in the arbitration module 230 does not work or the arbitration module 230 does not include the priority comparison module 236, the interrupt priority of the interrupt output by the interrupt controller 200 may not be higher than the interrupt priority of the interrupt being processed in the processor core 150, then the processor core 150 does not process the interrupt selected by the interrupt controller 200, and sets the interrupt processing status of the interrupt to pending, so that the interrupt controller 200 can try to send it to the processor core 150 for processing again later.
[0063] According to the interrupt controller 200 of the present invention, by utilizing the threshold setting module 238 and the threshold clearing module 239, after the priority threshold in the threshold comparison module 234 is set, after the interrupt processing status satisfies the predetermined conditions, the priority threshold is automatically cleared so that the threshold comparison module 234 becomes ineffective immediately after the priority processing of the specific interrupt is completed, thereby enabling interrupt processing to be performed more efficiently in the presence of nested interrupts.
[0064] Figure 4 FIG. 4 is a schematic diagram of a system on chip (SoC) 400 according to an embodiment of the present invention. The system on chip 400 includes a reference Figure 1 The processor 100, reference Figure 1 and 2The various interrupt sources 210, storage space 430 and coprocessor 440, etc. The system on chip can be integrated on a circuit board and constitute a relatively complete processing system. The interrupt source 210 is, for example, various peripheral interfaces, which receive external inputs and output the outputs of the processor 100 after processing. The storage space 430 can provide an external storage space for the processor 100, which is used to store the code to be executed by the processor 100 and the various output data generated. The coprocessor 440 is a special processor used to perform special processing tasks, such as image operations.
[0065] It should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than those explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.
[0066] Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in the devices described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or may be divided into multiple submodules.
[0067] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0068] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0069] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions. Therefore, a processor with necessary instructions for implementing the method or method elements forms a device for implementing the method or method elements. In addition, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.
[0070] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved, and is not intended to imply that the objects so described must have a given order in time, space, order, or in any other manner.
[0071] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is selected primarily for readability and teaching purposes, rather than for explaining or defining the subject matter of the present invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is illustrative, not restrictive, with respect to the scope of the present invention, which is defined by the appended claims.
Claims
1. An interrupt controller in a processor, comprising: an interrupt sampling unit adapted to receive respective interrupts from respective interrupt sources coupled to the interrupt controller; as well as An arbitration unit, adapted to select an interrupt to be responded to from each received interrupt, the arbitration unit comprising: A selection module adapted to select a highest priority interrupt having the highest priority from among the interrupts; and a threshold comparison module, coupled to the selection module, adapted to compare the priority of the highest priority interrupt with a preset priority threshold, wherein the arbitration unit is adapted to select the highest priority interrupt as the interrupt to be responded to when the threshold comparison module determines that the priority of the highest priority interrupt is higher than the priority threshold; a threshold setting module, adapted to store an interrupt vector number corresponding to the priority threshold in a vector number register of the interrupt controller when setting the priority threshold, and a threshold clearing module, adapted to clear the priority threshold when the current interrupt processing is completed if the interrupt vector number of the current interrupt is the same as the interrupt vector number stored in the vector number register; or The threshold setting module is suitable for storing the interrupt priority of the interrupt to be processed whose priority is not higher than the threshold in the priority register of the interrupt controller when setting the priority threshold, and the threshold clearing module is suitable for clearing the priority threshold when the current interrupt processing is completed if the interrupt priority of the current interrupt is the same as the interrupt priority stored in the priority register.
2. In the interrupt controller as described in claim 1, the threshold clearing module is suitable for determining that the current interrupt processing is completed when the processor core of the processor executes an interrupt return instruction, and obtaining the interrupt vector number of the interrupt being processed in the processor core as the interrupt vector number of the current interrupt and / or obtaining the interrupt priority level of the interrupt being processed in the processor core as the interrupt priority level of the current interrupt. 3 . The interrupt controller according to claim 2 , wherein the threshold clearing module is adapted to clear the priority threshold when there is no interrupt nesting.
4. The interrupt controller according to any one of claims 2-3, wherein the threshold setting module is adapted to set the interrupt priority of one of the interrupts currently being processed to the priority threshold.
5. The interrupt controller of claim 2, the threshold clearing module being adapted to clear the priority threshold by setting the priority threshold to a lowest interrupt priority level.
6. The interrupt controller of claim 2, further comprising: An interrupt configuration unit, suitable for storing the interrupt priority and interrupt handling status of each interrupt, The threshold clearing module is adapted to determine whether interrupt nesting exists according to the interrupt priorities of the respective interrupts stored in the interrupt configuration unit, and The threshold setting unit is adapted to determine the interrupt currently being processed according to the interrupt processing status of each interrupt stored in the interrupt configuration unit.
7. The interrupt controller according to claim 1, wherein the arbitration unit further comprises: a priority comparison module, coupled to the selection module, adapted to compare the priority of the highest priority interrupt with the priority of the interrupt currently executed in the processor, The arbitration unit is further adapted to select the highest priority interrupt as the interrupt to be responded to when the threshold comparison module determines that the priority of the highest priority interrupt is higher than the set priority threshold and the priority comparison module determines that the priority of the highest priority interrupt is higher than the priority of the interrupt currently executed in the processor.
8. A processor, comprising: An interrupt controller as claimed in any one of claims 1 to 7, adapted to receive interrupts from interrupt sources coupled to the interrupt controller and select an interrupt to be processed; as well as The processor core is coupled to the interrupt controller and processes the interrupt selected by the interrupt controller.
9. The processor of claim 8, wherein the processor core is adapted to suspend processing of the interrupt being processed and start processing the interrupt selected by the interrupt controller when the interrupt priority of the interrupt selected by the interrupt controller is higher than the interrupt priority of the interrupt being processed in the processor core.
10. The processor of claim 8 or 9, wherein the processor core is adapted to not process the interrupt selected by the interrupt controller when the interrupt priority of the interrupt selected by the interrupt controller is not higher than the interrupt priority of the interrupt being processed in the processor core.
11. A system on chip, comprising: A processor as claimed in any one of claims 8 to 10; as well as One or more interrupt sources are coupled to the processor and generate interrupts to be processed by the processor.
Citation Information
Patent Citations
Programmable exception processing latency
CN102414672A
System and method for optimizing interruption resources in multi-core processor
CN103019835A
Interrupt control method and interrupt controller
CN105094976A
Vector interrupt controller supporting multi-layer interrupt priority level control
CN105824768A
Fast interrupt control system and method for RISC-V architecture
CN109376000A
