An exception handling method, and an exception handling structure, apparatus
Patent Information
- Application Number
- CN202210910384.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-29
- Publication Date
- 2026-10-27
- Estimated Expiration
- 2042-07-29
AI Technical Summary
[0004]现有技术中,电子设备需要专门为挂起异常和活跃异常配置不同的处理单元以对多个挂起异常和活跃异常进行筛选处理,随着挂起异常和活跃异常的数量增加,电子设备中配置的处理单元的复杂度以及处理单元的面积也随之增加,增加了电子设备的体积,也会提高电子设备的制造成本
Smart Images

Figure CN115145710B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of chips, and more specifically to an exception handling method, exception handling structure, and apparatus. Background Technology
[0002] During the operation of an electronic device's processor, it may be interrupted by an exception. The processor needs to execute the corresponding program (called an exception handler) to handle the exception. When an exception occurs, different exceptions have different priorities. The processor will handle higher-priority exceptions first. Exceptions that have not yet been handled by the processor are called pending exceptions or unhandled exceptions, while exceptions that the processor is currently processing and have not yet finished are called active exceptions.
[0003] When multiple pending exceptions and multiple active exceptions exist simultaneously, the electronic device needs to determine the highest priority pending exception from the multiple pending exceptions and the highest priority active exception from the multiple active exceptions. Then, it needs to determine whether the highest priority pending exception can preempt the current active exception, that is, whether the priority of the highest priority pending exception is higher than the priority of the highest priority active exception. If it is determined that the priority of the highest priority pending exception is higher than the priority of the highest priority active exception, the processor interrupts the active exception and switches to handling the pending exception.
[0004] In the prior art, electronic devices need to be configured with different processing units for suspended and active exceptions in order to filter and process multiple suspended and active exceptions. As the number of suspended and active exceptions increases, the complexity and area of the processing units configured in the electronic device also increase, which increases the size of the electronic device and also increases the manufacturing cost of the electronic device. Summary of the Invention
[0005] This application provides an exception handling method, exception handling structure, and apparatus.
[0006] In a first aspect, embodiments of this application provide an exception handling method applied to an electronic device. The method includes: acquiring a first type of exception and a second type of exception; determining a first exception from the first type of exception that meets a first preset condition; corresponding to a received event response, determining a second exception from the second type of exception that meets a second preset condition and temporarily storing the second exception; comparing the first exception and the second exception, determining an exception from the first exception and the second exception that meets a third preset condition as a target exception, and processing the target exception.
[0007] In the embodiments described in this application, the electronic device can be a system-on-a-chip (SoC). The first type of exception and the second type of exception can be a suspended exception and an active exception, respectively. The first exception can be the highest-priority suspended exception, and the second exception can be the highest-priority active exception. The target exception can be the suspended exception or active exception with the highest priority among the selected highest-priority suspended exceptions and highest-priority active exceptions. After receiving the first type of exception and the second type of exception, the electronic device determines whether it has received an event response. If an event response is received, the electronic device selects the highest-priority second exception from the second type of exceptions and temporarily stores the exception information of the second exception. The event response can be an instruction issued by the processor of the electronic device to indicate that the processing of the second type of exception should begin.
[0008] If no event response is received, the electronic device selects the highest priority first exception from the first type of exceptions, and then further determines whether there is a temporarily stored second exception. If there is, the priority between the selected first exception and the temporarily stored second exception is compared, and the highest priority exception is determined as the target exception, and the processor is instructed to handle the target exception; if there is no target exception, the selected first exception is determined as the target exception, and the processor is instructed to handle the target exception.
[0009] The exception handling method provided in the application embodiment allows electronic devices to switch between the handling processes of the first type of exception and the second type of exception through event response. In other words, only one exception handling unit needs to be configured in the hardware structure of the electronic device to handle the first type of exception and the second type of exception asynchronously. That is, one exception handling unit switches between the handling of the first type of exception and the second type of exception, which saves the production cost of electronic devices and also ensures the accuracy of exception handling.
[0010] In one possible implementation of the first aspect above, determining a first exception from the first type of exceptions that meets the first preset condition includes:
[0011] Compare the anomaly information of the first type of anomaly
[0012] The highest priority type of exception corresponding to the exception information is identified as the first exception.
[0013] In the application embodiment, the abnormal information here can correspond to the priority of the first type of abnormality. The smaller the value corresponding to the priority, the higher the priority of the first type of abnormality. If the priority values of the two first type of abnormalities being compared are the same, the priority of the suspended abnormality is determined according to the numbers of the two first type of abnormalities. That is, among the two first type of abnormalities with the same priority value, the suspended abnormality with the smaller number has a higher priority.
[0014] In one possible implementation of the first aspect above, corresponding to receiving an event response, determining a second exception from the second type of exceptions that meets the second preset condition and temporarily storing the exception information of the second exception includes:
[0015] Switch to comparing the exception information for the second type of exception;
[0016] The second type of exception, which has the highest priority, is identified as the second exception.
[0017] Temporarily store the exception information of the second type of exception, wherein the event response includes an instruction to switch to comparing the exception information of the second type of exception.
[0018] In the application embodiment, the abnormal information here can correspond to the priority of the second type of abnormality. The smaller the value corresponding to the priority, the higher the priority of the second type of abnormality. If the priority values of the two second type of abnormalities being compared are the same, the priority of the suspended abnormality is determined according to the numbers of the two second type of abnormalities. That is, among the two second type of abnormalities with the same priority value, the suspended abnormality with the smaller number has a higher priority.
[0019] One possible implementation of the first aspect mentioned above also includes:
[0020] For cases where no event response is received, a first exception that meets the first preset condition is identified from the first type of exceptions and is used as the target exception and processed.
[0021] In one possible implementation of the first aspect above, comparing the first exception and the second exception, determining a target exception that meets a third preset condition from the first exception and the second exception, and processing the target exception includes:
[0022] Compare the anomaly information of the first and second anomalies;
[0023] The first or second highest priority exception corresponding to the exception information is identified as the target exception.
[0024] In the proposed embodiment, if the priority values of the second exception and the first exception being compared are the same, the priority between the second exception and the first exception is determined according to their respective numbers. That is, among the second exception and the first exception with the same priority value, the one with the smaller number has a higher priority. The exception with the highest priority between the determined second exception and the first exception is taken as the target exception, and then the target exception is sent to the processor of the electronic device for processing.
[0025] One possible implementation of the first aspect mentioned above also includes:
[0026] If there is no second anomaly, the first anomaly is identified as the target anomaly and is then processed.
[0027] Secondly, embodiments of this application provide an anomaly handling device applied to an electronic device, characterized in that the device comprises:
[0028] An exception selection unit is used to acquire first-type and second-type exceptions;
[0029] An exception handling unit is used to determine a first exception from the first type of exceptions that meets a first preset condition;
[0030] An event response unit is used to receive event responses. Corresponding to the event response unit receiving an event response, the exception handling unit determines a second exception from the second type of exceptions that meets the second preset condition.
[0031] An exception storage unit is used to temporarily store exception information for the second exception.
[0032] The preemption controller is used to compare the first anomaly and the second anomaly, determine a target anomaly that meets a third preset condition from the first anomaly and the second anomaly, and instruct the electronic device to handle the target anomaly.
[0033] In the embodiments of the application, the exception handling device can be the exception controller in the figure, and the exception selection unit can be... Figure 4 The exception selection unit and exception handling unit in the middle can be Figure 4 The exception handling unit and event response unit in the code can be... Figure 4 The event generation unit and exception storage unit in the middle can be Figure 4 The exception storage unit in the middle, the preemption controller can be Figure 4 The preemption controller in the system. After the exception selection unit receives the first type of exception and the second type of exception, the event response unit determines whether an event response has been received. If an event response has been received, the exception handling unit selects the second exception with the highest priority from the second type of exception and temporarily stores the exception information of the second exception.
[0034] In one possible implementation of the second aspect above, the exception handling unit is used to compare the exception information of the first type of exception and determine the first type of exception with the highest priority corresponding to the exception information as the first exception.
[0035] In the application embodiment, the exception handling unit compares the exception information of the first type of exception to determine the priority of the first type of exception. The smaller the value corresponding to the priority, the higher the priority of the first type of exception. If the priority values of the two first type of exceptions being compared are the same, the priority of the suspended exception is determined according to the numbers of the two first type of exceptions. That is, among the two first type of exceptions with the same priority value, the suspended exception with the smaller number has a higher priority.
[0036] In one possible implementation of the second aspect above, the event response unit receives an event response, and the exception handling unit switches to comparing the exception information of the second type of exception, and determines the second type of exception with the highest priority corresponding to the exception information as the second exception.
[0037] In the application embodiment, the exception handling unit compares the exception information of the second type of exception to determine the priority of the second type of exception. The smaller the value corresponding to the priority, the higher the priority of the second type of exception. If the priority values of the two compared second type of exceptions are the same, the priority of the suspended exception is determined according to the number of the two second type of exceptions. That is, among the two second type of exceptions with the same priority value, the suspended exception with the smaller number has a higher priority.
[0038] In one possible implementation of the second aspect above, the exception storage unit temporarily stores the exception information of the second exception, wherein the event response includes an instruction from the event response unit to the exception handling unit to switch to comparing the exception information of the second type of exception.
[0039] In the application embodiment, the exception storage unit can temporarily store the exception information of the second exception, which is used to preempt the controller to compare the first exception and the temporarily stored second exception, determine a target exception that meets the third preset condition from the first exception and the second exception, and instruct the electronic device to process the target exception.
[0040] In one possible implementation of the second aspect above, if the event response unit does not receive an event response, the exception handling unit determines a first exception from the first type of exceptions that meets the first preset condition.
[0041] In the application embodiment, when the event response unit does not receive an event response, the exception handling unit may only handle the first type of exception.
[0042] In one possible implementation of the second aspect above, the preemptive controller compares the exception information of the first exception and the second exception, and determines the first exception or the second exception with the highest priority corresponding to the exception information as the target exception.
[0043] In the proposed embodiment, the preemption controller compares the exception information of a first exception and a second exception. If the priority values of the second exception and the first exception being compared are the same, the priority between the second exception and the first exception is determined according to their respective numbers. That is, among the second exception and the first exception with the same priority value, the one with the smaller number has a higher priority. The exception with the highest priority between the determined second exception and the first exception is taken as the target exception, and then the target exception is sent to the processor of the electronic device for processing.
[0044] In one possible implementation of the second aspect above, if there is no second exception in the exception storage unit, the preemption controller identifies the first exception as the target exception and instructs the electronic device to handle the target exception.
[0045] In one possible implementation of the second aspect above, the exception handling unit includes a comparison module, which receives at least two first exceptions or second exceptions from N first-type exceptions or N second-type exceptions respectively, and compares at least two first exceptions or second exceptions respectively to determine an exception information that is higher than a preset threshold. Here, N is a natural number greater than or equal to 2.
[0046] In one possible implementation of the second aspect described above, the number of comparison modules is 2. N-1 +2 N-2 +…+2 1 +2 0 .
[0047] In the embodiments described in the application, the comparison module can be a comparison circuit. The comparison module may include two input terminals and one output terminal. Taking a pending exception as an example, two different pending exceptions are input to the comparison circuit through their respective input terminals. The comparison circuit compares the priorities of the two pending exceptions, determines the pending exception with the higher priority, and outputs it from the output terminal. The number of comparison circuits is determined by the number of first-type or second-type exceptions supported by the electronic device. For example, if the electronic device supports 16 first-type exceptions, the number of comparison circuits is 2. 3 +2 2 +2 1 +2 0 =15.
[0048] Thirdly, embodiments of this application provide an exception handling architecture applied to electronic devices, characterized in that the architecture includes:
[0049] An event response unit is communicatively connected to the processor of the electronic device and is used to receive event responses from the processor.
[0050] An exception selection unit is communicatively connected to the processor of the electronic device. It obtains a first type of exception and a second type of exception from the processor. When the event response unit receives an event response, the event response unit sends an event response instruction to the exception selection unit. In response to the event response instruction, the exception selection unit sends the second type of exception to the exception handling unit.
[0051] An exception handling unit is communicatively connected to an exception selection unit and an event response unit. The exception handling unit receives a first type of exception from the exception selection unit, determines a first exception that meets a first preset condition from the first type of exception, and when the event response unit receives an event response, the event response unit sends an event response instruction to the exception selection unit. The exception handling unit receives a second type of exception from the exception selection unit, determines a second exception that meets a second preset condition from the second type of exception.
[0052] An exception storage unit is communicatively connected to the exception handling unit and is used to receive and temporarily store a second exception from the exception handling unit.
[0053] The preemption control unit is communicatively connected to the exception storage unit and the exception handling unit. It is used to receive a first exception from the exception handling unit and a second exception from the exception storage unit. When the first exception and the second exception exist, the first exception and the second exception are compared, and a target exception that meets a third preset condition is determined from the first exception and the second exception. When only the first exception exists, the first exception is determined as the target exception.
[0054] In the embodiments of the application, the exception handling device can be the exception controller in the figure, and the exception selection unit can be... Figure 4 The exception selection unit and exception handling unit in the middle can be Figure 4 The exception handling unit and event response unit in the code can be... Figure 4 The event generation unit and exception storage unit in the middle can be Figure 4 The exception storage unit in the middle, the preemption controller can be Figure 4 The preemption controller in the system. The exception selection unit can receive Type I and Type II exceptions from the processor of the electronic device or from external devices of the electronic device.
[0055] In one possible implementation of the third aspect described above, the preemption control unit communicates with the processor of the electronic device, and the preemption control unit sends the target anomaly to the processor of the electronic device, instructing the processor of the electronic device to process the target anomaly.
[0056] In one possible implementation of the third aspect above, when the event response unit does not receive an event response, the exception handling unit receives a first type of exception from the exception selection unit, and determines a first exception that meets a first preset condition from the first type of exception.
[0057] In one possible implementation of the third aspect above, the exception handling unit includes a comparison module, which includes two input terminals and one output terminal. The two input terminals respectively receive at least two first exceptions or second exceptions from N first-type exceptions or N second-type exceptions. The comparison module compares at least two first exceptions or second exceptions respectively to determine a first exception that meets a first preset condition or a second exception that meets a second preset condition, where N is a natural number greater than or equal to 2.
[0058] In one possible implementation of the third aspect described above, the number of comparison modules is 2. N-1 +2 N-2 +…+2 1 +2 0 .
[0059] In the application embodiment, the exception handling architecture of this application only needs to set up one exception handling unit to realize asynchronous processing of the first type of exception and the second type of exception. The newly added event response unit realizes the switching of exception handling units to handle the first type of exception and the second type of exception, and the newly added exception storage unit stores the exception information of the filtered second exception.
[0060] In one possible implementation of the third aspect above, the exception handling unit compares the exception information of the first type of exception and determines the first type of exception with the highest priority corresponding to the exception information as the first exception.
[0061] In one possible implementation of the third aspect above, the exception handling unit compares the exception information of the second type of exception and determines the second type of exception with the highest priority corresponding to the exception information as the second exception.
[0062] In one possible implementation of the third aspect above, determining a target anomaly that meets the third preset condition includes:
[0063] The preemptive controller compares the anomaly information of the first anomaly and the second anomaly, and determines the first or second anomaly with the highest priority corresponding to the anomaly information as the target anomaly, which meets the third preset condition.
[0064] Fourthly, embodiments of this application provide an electronic device including the exception handling architecture described in the third aspect above. Attached Figure Description
[0065] Figure 1 A hardware structure diagram of an electronic device (system-on-a-chip) provided for an embodiment of this application;
[0066] Figure 2 A hardware structure diagram of an exception controller in an electronic device (system-on-a-chip) provided in an embodiment of this application;
[0067] Figure 3 A hardware structure diagram of an exception controller in an electronic device (system-on-a-chip) provided in an embodiment of this application;
[0068] Figure 4 A hardware structure diagram of an exception controller in an electronic device (system-on-a-chip) provided in an embodiment of this application;
[0069] Figure 5 The diagram shown is a flowchart of an exception handling method provided in an embodiment of this application.
[0070] Figure 6 The diagram shown is a schematic block diagram of an electronic device to which an exception handling method provided in this application is applicable;
[0071] Figure 7 The diagram shown is a schematic block diagram of a system-on-a-chip provided in an embodiment of this application;
[0072] Figure 8 The diagram shown is a schematic block diagram of a SoC provided in an embodiment of this application. Detailed Implementation
[0073] To clearly understand the technical solutions provided in the embodiments of this application, the relevant technical terms involved in the exception handling solutions provided in the embodiments of this application will be explained below.
[0074] An exception is an unexpected situation encountered by the processor of an electronic device (such as a system-on-a-chip) during operation, which will terminate the normal execution flow of the processor. Exceptions can include internal system exceptions and external exceptions. Common internal system exceptions can include: processor's own memory access exceptions and bus access exceptions; external exceptions can be exceptions generated by external devices, such as those generated by keyboards, mice, etc., connected to the electronic device. Users or developers of electronic devices can pre-configure the types of exceptions supported by the electronic device and their priorities.
[0075] Exception Table: The exception table stores exception information. It can store the exception number, type, and priority. The exception number and type are unique, while exceptions with different numbers or types can have the same priority. It can be understood that for the suspended and active exceptions mentioned in the background technology, the electronic device (e.g., a system-on-a-chip) can have separate exception tables for suspended and active exceptions to store their information. It can be understood that since both suspended and active exceptions are exceptions supported by the electronic device, the maximum number of exceptions that can be stored in the exception tables for suspended and active exceptions is the same.
[0076] The following is for reference. Figure 1 , Figure 1 A hardware structure diagram of an electronic device 100 (system-on-a-chip) is shown, such as... Figure 1 As shown, the electronic device 100 includes: an exception controller 101, a processor 102, a bus 103, and an external device 104.
[0077] The exception controller 101, also known as the Nested Vectored Interrupt Controller (NVIC), is connected to the processor 102 and is used to determine the order in which the processor 102 processes exceptions based on their priority.
[0078] The processor 102 is used to process data, instructions or exceptions. In this embodiment, the processor 102 can process exceptions in the order determined by the exception controller 101.
[0079] Bus 103 is used to connect processor 102 to external device 104. External device 104 can generate data or exceptions and send them to processor 102 for processing via bus 103.
[0080] It is understood that in another embodiment of this application, the external device 104 can also transmit data back to the processor 102 via the bus 103, and the exception generated by the external device 104 can be directly connected to the exception controller 101.
[0081] Understandable Figure 1 The hardware structure of the electronic device 100 (system-on-a-chip) is merely illustrated and should not be construed as limiting the embodiments of this application.
[0082] The following is for reference. Figure 2 , Figure 2 A hardware structure diagram of an exception controller 101 in an electronic device 100 (system-on-a-chip) is shown, as follows: Figure 2 As shown, the exception controller 101 includes: a suspended exception handling unit 1011, an active exception handling unit 1012, and a preemption controller 1013.
[0083] The suspended exception handling unit 1011 is used to select the highest priority suspended exception based on the priority of the suspended exceptions stored in the exception table of suspended exceptions; similarly, the active exception handling unit 1012 is used to select the highest priority active exception based on the priority of the active exceptions stored in the exception table of active exceptions.
[0084] The preemption controller 1013 can be connected to both the suspended exception handling unit 1011 and the active exception handling unit 1012. The preemption controller 1013 determines a target exception from the highest-priority active exceptions and the highest-priority suspended exceptions selected by the suspended exception handling unit 1011 and the active exception handling unit 1012, respectively, and instructs the processor 102 to handle the target exception. For example, if the target exception is an active exception, the processor 102 can continue processing the active exception; if the target exception is a suspended exception, the processor 102 will interrupt processing the current active exception and begin processing the target exception. In other words, the suspended exception preempts the current active exception.
[0085] Understandable Figure 2 The hardware structure of the electronic device 100 (system-on-a-chip) is merely illustrated and should not be construed as limiting the embodiments of this application.
[0086] The following is for reference. Figure 3 , Figure 3 A hardware structure diagram of an exception controller 101 in an electronic device 100 (system-on-a-chip) is further shown, as follows: Figure 3 As shown, the suspended exception handling unit 1011 and the active exception handling unit 1012 each include a certain number of comparison circuits, which can also be called comparison modules. (Continue to refer to...) Figure 3 The comparison circuit here can include two input terminals and one output terminal. Taking a pending exception as an example, two different pending exceptions are input to the comparison circuit through the input terminals. The comparison circuit compares the priorities between the two pending exceptions, determines the pending exception with higher priority, and outputs it from the output terminal.
[0087] It can be seen that the number of comparison circuits in the suspended exception handling unit 1011 and the active exception handling unit 1012 is the same, and the number of comparison circuits is determined by the number of exceptions supported by the electronic device 100. For example, taking the suspended exception handling unit 1011 as an example, when the electronic device 100 supports 16 suspended exceptions, the number of comparison circuits in the suspended exception handling unit 1011 is 2. 3 +2 2 +2 1 +2 0 =15.
[0088] The process of the suspended exception handling unit 1011 selecting suspended exceptions may include: first, using eight comparison circuits to select eight higher-priority suspended exceptions from 16 suspended exceptions; then, using four comparison circuits to select four more higher-priority suspended exceptions from the eight higher-priority suspended exceptions, and so on; then, using two comparison circuits to select two higher-priority suspended exceptions from the four suspended exceptions; and finally, selecting the highest-priority suspended exception from the two suspended exceptions. Similarly, the active exception handling unit 1012 can select the highest-priority active exception in the same way. Finally, the preemption controller 1013 determines a target exception from the highest-priority active exception and the highest-priority suspended exception selected by the suspended exception handling unit 1011 and the active exception handling unit 1012, and instructs the processor 102 to process the target exception.
[0089] However, through Figure 3 As shown in the hardware structure diagram of the exception controller 101, as the number of exceptions that the electronic device 100 can support increases, the number of comparison circuits in the suspended exception handling unit 1011 and the active exception handling unit 1012 also increases significantly. For example, if the number of exceptions that the electronic device 100 can support reaches 512, the number of comparison circuits included in the suspended exception handling unit 1011 and the active exception handling unit 1012 will each reach 2. 8 +2 7 +…+2 1 +2 0 = 511. This will increase the size of the electronic device 100 (system-on-a-chip), thereby increasing the production cost of the electronic device 100 (system-on-a-chip).
[0090] To address the aforementioned problems, this application provides an exception handling method for an electronic device (system-on-a-chip). In this method, after the electronic device receives a suspended exception and an active exception, it determines whether an event response has been received. If an event response is received, the electronic device selects the highest-priority active exception from the current active exception list and temporarily stores its exception information. Here, the event response can be an instruction issued by the electronic device's processor, indicating the start of active exception processing.
[0091] If no event response is received, the electronic device selects the highest priority pending exception from the pending exception table, and then further determines whether there are any temporarily active exceptions. If there are, the priority between the selected pending exception and the temporarily active exception is compared, and the highest priority exception is determined as the target exception, instructing the processor to handle the target exception; if there are no such exceptions, the selected pending exception is determined as the target exception, and the processor is instructed to handle the target exception.
[0092] The exception handling method provided in the application embodiment allows electronic devices to switch between handling suspended exceptions and active exceptions through event responses. In other words, only one exception handling unit needs to be configured in the hardware structure of the electronic device to handle suspended exceptions and active exceptions asynchronously. This means that switching between handling suspended exceptions and active exceptions is achieved through a single exception handling unit, saving production costs for electronic devices while ensuring the accuracy of exception handling.
[0093] The following is for reference. Figure 4 , Figure 4 This paper illustrates a hardware structure diagram of an exception controller 101 in an electronic device 100 (system-on-a-chip) according to an embodiment of this application. Figure 4 As shown, the exception controller 101 includes: a preemption controller 1013, an exception handling unit 1014, an exception selection unit 1015, an event generation unit 1016, and an exception storage unit 1017.
[0094] The exception handling unit 1014 is used to filter out the highest priority pending exception or active exception based on the priority of pending exceptions or active exceptions stored in the exception table of pending exceptions or active exceptions. The exception handling unit 1014 includes a certain number of comparison circuits, and the number of comparison circuits in the exception handling unit 1014 can be the same as the number of exceptions supported by the electronic device 100 (system on chip).
[0095] The event generation unit 1016 is used to send control commands to the exception selection unit 1015 after receiving an event response. The event response can be generated by the processor 102 of the electronic device 100 and sent to the event generation unit 1016. The event generation unit 1016 receives the event response from the processor 102 of the electronic device 100 and outputs the corresponding control command to the exception selection unit 1015.
[0096] The exception selection unit 1015 is connected to the exception handling unit 1014 and the event generation unit 1016. It is also connected to the processor 102 of the electronic device 100. The processor receives suspended exceptions and active exceptions, and outputs either a suspended exception or an active exception to the exception handling unit 1014 based on whether it receives a control command from the event generation unit 1016. If the exception selection unit 1015 does not receive a control command from the event generation unit 1016, it selects to receive a suspended exception and sends it to the exception handling unit 1014. If the exception selection unit 1015 receives a control command from the event generation unit 1016, it selects to receive an active exception and sends it to the exception handling unit 1014.
[0097] The exception storage unit 1017 is connected to the exception handling unit 1014 and the preemption controller 1013, and is used to temporarily store the highest priority active exception after the exception handling unit 1014 selects the highest priority active exception.
[0098] The preemption controller 1013 can be connected to both the exception handling unit 1014 and the exception storage unit 1017. The preemption controller 1013 is used to determine a target exception from the highest-priority suspended exceptions selected by the exception handling unit 1014 and the highest-priority active exceptions temporarily stored in the exception storage unit 1017, and then instructs the processor 102 to process the target exception. That is, when both suspended exceptions and temporarily stored active exceptions exist, the suspended exceptions and active exceptions are compared, and the highest-priority target exception is determined from them; when only suspended exceptions exist, the suspended exception is determined as the target exception.
[0099] It is understood that if the event generation unit 1016 does not receive an event response, the exception selection unit 1015 will continuously send suspended exceptions to the exception handling unit 1014. The exception handling unit 1014 will filter out the suspended exception with the highest priority. At this time, if the exception storage unit 1017 does not temporarily store active exceptions, the preemption controller 1013 will directly determine the suspended exception with the highest priority filtered by the exception handling unit 1014 as the target exception and instruct the processor 102 to handle the target exception.
[0100] As can be seen from Table 1, under a typical configuration (total number of exceptions = 64, priority range = 3, system clock = 215MHz, TSMC 40nm process), the exception controller 101 in the electronic device 100 (system-on-a-chip) proposed in this embodiment can save 19.8% of the unit area of the electronic device 100 (system-on-a-chip). Furthermore, under the maximum configuration (total number of exceptions = 512, priority range = 8, system clock = 215MHz, TSMC 40nm process), it can save 27% of the unit area of the electronic device 100 (system-on-a-chip). Therefore, the complexity and cost of manufacturing the electronic device 100 (system-on-a-chip) can be reduced. The values in Table 1 were calculated and obtained using the simulation tool Cadence-genus, version 19.10-p002_1. The total number of exceptions represents exceptions from the processor and exceptions from external devices; for example, the number of exceptions from the processor could be 32, and the number of exceptions from external devices could be 480.
[0101]
[0102] Table 1
[0103] Figure 5 An exemplary diagram illustrating the method flow of an exception handling method is provided. It can be understood that... Figure 5 The method shown can be implemented by an electronic device equipped with an anomaly controller executing relevant instructions, see reference. Figure 5 The display method may include the following steps:
[0104] S501: Get suspended exceptions and active exceptions.
[0105] In this embodiment, the suspended exception and active exception can be exceptions generated by the processor of the electronic device or exceptions generated by external devices of the electronic device. Table 2 shows the parameters of some exceptions. For example, exception number 2 is of type reset and can have a priority of -3; exception number 5 is of type bus error and can have a priority of 0; exception number 33 is of type IRO#0 and can have a priority of 8. Here, IRO#0 indicates that the exception can be a user-defined exception of the electronic device.
[0106] 2 Reset -3 Reset … 5 Bus error 0 Bus error response … 33 IRO#0 8 External interrupt #0
[0107] Table 2
[0108] Suspended exceptions and active exceptions can be stored in their respective exception tables. The electronic device's exception controller can read the exception tables for suspended and active exceptions respectively and load the exception from them. It can be understood that the electronic device's processor can also, after an exception occurs, instruct the exception controller to read the exception tables for suspended and active exceptions respectively and load the exception from them.
[0109]
[0110]
[0111] Table 3
[0112] Table 3 shows an example of the exception table for suspending exceptions in the embodiments of this application. As can be seen from Table 3, the exception table can store the exception number, the exception type, and the exception priority. For example, the exception with number 2 is of type reset and the priority can be -3; the exception with number 5 is of type bus error and the priority can be 0. The smaller the value corresponding to the priority, the higher the priority of the exception. That is to say, the exception with priority -3 is of type reset and has the highest priority.
[0113] As can be seen, the exception numbers in the exception tables for suspended and active exceptions are unique. In other words, when multiple exceptions with the same number occur consecutively in an electronic device, these exceptions will enter the exception table in sequence and be processed by the exception controller and processor of the electronic device.
[0114] S502: Determine whether an event response has been received. If an event response has been received, proceed to step S504, read the exception table of active exceptions, and load the active exception from the exception table; if no event response has been received, proceed to step S503, read the exception table of suspended exceptions, and load the suspended exception from the exception table.
[0115] In this embodiment, the event response can be an event generated by the processor of the electronic device and sent to the exception controller to instruct the exception controller to handle active exceptions, that is, to instruct the exception controller to read the exception table of active exceptions and load the active exception from the exception table. If an event response is received, the exception table of active exceptions is read and the active exception is loaded from the exception table; if no event response is received, the exception table of suspended exceptions is read and the suspended exception is loaded from the exception table.
[0116] S503: Read the exception table of suspended exceptions, load the suspended exceptions from the exception table, and determine the suspended exception with the highest priority.
[0117] In this embodiment, the electronic device can be pre-configured with 512 exceptions, including 32 internal system exceptions (set by the device manufacturer) and 480 external exceptions (defined by the user). The electronic device can compare the priorities of each exception stored in the exception table to determine the exception with the highest priority. For example, taking an exception table containing 512 pending exceptions as an example, the electronic device can sequentially process 2... 8 +2 7 +…+2 1 +2 0 =511 comparisons were made to determine the highest priority pending exception from 512 pending exceptions. It can be understood that if the priority values of two pending exceptions being compared are the same, the priority of the pending exception is determined by the numbers of the two pending exceptions. That is, among two pending exceptions with the same priority value, the pending exception with the smaller number has a higher priority.
[0118] S504: Read the exception table of active exceptions, load active exceptions from the exception table, determine the active exception with the highest priority and temporarily store it.
[0119] In this embodiment of the application, if the electronic device receives an event response, the electronic device can determine the highest priority active exception from the exception table of active exceptions in the same way as step S503, and then temporarily store the determined highest priority active exception.
[0120] S505: Determine if there is a temporarily stored high-priority active exception.
[0121] In this embodiment, if a temporarily stored highest-priority active exception exists, step S506 is executed to compare the priorities of the determined highest-priority suspended exception and the temporarily stored highest-priority active exception again, and to determine another highest-priority exception from the suspended exception and active exception, which is the target exception. If no temporarily stored highest-priority active exception exists, step S507 is executed to send the determined highest-priority suspended exception as the target exception to the processor of the electronic device for processing.
[0122] S506: Determine a target exception from the highest priority active exceptions in the temporary pool and the highest priority suspended exceptions in the confirmed pool.
[0123] In this embodiment, the method for comparing the priorities of the highest-priority active exception and the highest-priority suspended exception can be the same as the method in step S503. If the priority values of the active exception and the suspended exception being compared are the same, the priority between the active exception and the suspended exception is determined according to their respective numbers. That is, among active exceptions and suspended exceptions with the same priority value, the smaller the number, the higher the priority. The exception with the highest priority between the determined active exception and the suspended exception is taken as the target exception, and then the target exception is sent to the processor of the electronic device for processing. In other words, the target exception can preempt the active exception being processed by the processor of the electronic device, causing the processor of the electronic device to interrupt the active exception being processed and instead process the target exception first.
[0124] S507: Identify the highest priority suspended exception as the target exception.
[0125] In this embodiment, if there are no temporarily stored active exceptions, the electronic device can directly identify the highest priority suspended exception as the target exception. That is, the processor of the electronic device is not currently handling exceptions, and the processor can directly handle suspended exceptions.
[0126] The electronic devices involved in implementing this method, as provided in this application embodiment, can be mobile phones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, personal digital assistants (PDAs), and other devices with displays. This application embodiment does not impose any restrictions on the specific type of electronic device.
[0127] Figure 6 According to an embodiment of this application, a schematic block diagram of an electronic device 600 to which an exception handling structure is applied is shown.
[0128] like Figure 6 As shown, the electronic device 600 may include a processor 610, a wireless communication module 620, a mobile communication module 630, a power supply module 640, an audio module 650, an interface module 660, a camera 670, a memory 680, a sensor module 690, buttons 601, and a display screen 602, etc.
[0129] It is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 600. In other embodiments of this application, the electronic device 600 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0130] Processor 610 may include one or more processing units, such as processing modules or circuits of a central processing unit (CPU), graphics processing unit (GPU), digital signal processor (DSP), microprocessor (MCU), AI (Artificial Intelligence) processor, or field programmable gate array (FPGA). Different processing units may be independent devices or integrated into one or more processors. Processor 610 may include storage units, such as memory 680, for storing instructions and data. In some embodiments, the storage unit in processor 610 is a cache memory.
[0131] Processor 610 can be used to execute Figure 5 The described exception handling method.
[0132] The wireless communication module 620 may include an antenna, which enables the transmission and reception of electromagnetic waves. The wireless communication module 620 can provide solutions for wireless communication applications on the electronic device 600, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The electronic device 600 can communicate with networks and other devices via wireless communication technologies.
[0133] The mobile communication module 630 may include, but is not limited to, antennas, power amplifiers, filters, and low-noise amplifiers (LNAs). The mobile communication module 630 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use on the electronic device 600. The mobile communication module 630 can receive electromagnetic waves via the antenna, filter and amplify the received electromagnetic waves, and then transmit them to a modem processor for demodulation. The mobile communication module 630 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via the antenna. In some embodiments, at least some functional modules of the mobile communication module 630 may be housed in the processor 610. In some embodiments, at least some functional modules of the mobile communication module 630 and at least some modules of the processor 610 may be housed in the same device.
[0134] In some embodiments, the mobile communication module 630 and the wireless communication module 620 of the electronic device 600 may also be located in the same module.
[0135] The power module 640 may include a power supply, a power management component, etc. The power supply may be a battery. The power management component is used to manage the charging of the power supply and the power supply to other modules.
[0136] Audio module 650 is used to convert digital audio information into a predictive audio signal output, or to convert predictive audio input into a digital audio signal. Audio module 650 can also be used for encoding and decoding audio signals.
[0137] The interface module 660 includes an external memory interface, a universal serial bus (USB) interface, and a subscriber identification module (SIM) card interface.
[0138] Camera 670 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element converts the light signal into an electrical signal, which is then passed to the ISP (Image Signal Processing) to be converted into a digital image signal. Electronic device 600 can realize the shooting function through the ISP, camera 670, video codec, GPU (Graphics Processing Unit), display screen 602, and application processor.
[0139] The sensor module 690 may include proximity sensors, pressure sensors, gyroscope sensors, barometric pressure sensors, magnetic sensors, accelerometers, distance sensors, fingerprint sensors, temperature sensors, touch sensors, ambient light sensors, bone conduction sensors, etc.
[0140] The display screen 602 is used to display human-computer interaction interfaces, images, videos, etc. The display screen 602 includes a display panel.
[0141] In some embodiments, the electronic device 600 further includes buttons 601, a motor, and indicators. Buttons 601 may include volume buttons, a power button, etc. The motor is used to generate a vibration effect in the electronic device 600, for example, vibrating when the user's electronic device 600 is called to prompt the user to answer the call. The indicator may include a laser indicator, a radio frequency indicator, an LED indicator, etc.
[0142] Figure 7 A schematic block diagram of a system-on-a-chip 700 is shown according to an embodiment of this application.
[0143] like Figure 7 As shown, system 700 may include one or more processors 704, system control logic 708 connected to at least one of the processors 704, system memory 712 connected to system control logic 708, non-volatile memory (NVM) 716 connected to system control logic 708, and network interface 720 connected to system control logic 708.
[0144] In some embodiments, processor 704 may include one or more single-core or multi-core processors. In some embodiments, processor 704 may include any combination of general-purpose processors and special-purpose processors (e.g., graphics processors, application processors, baseband processors, etc.). Processor 704 may be configured to perform various corresponding embodiments, for example, with reference to the above. Figure 2-5 The embodiment described is shown.
[0145] In some embodiments, system control logic 708 may include any suitable interface controller to provide any suitable interface to at least one of the processors 704 and / or any suitable device or component communicating with system control logic 708.
[0146] In some embodiments, system control logic 708 may include one or more memory controllers to provide an interface to system memory 712. System memory 712 may be used to load and store data and / or instructions. In some embodiments, memory 712 of system 700 may include any suitable volatile memory, such as suitable dynamic random access memory (DRAM).
[0147] NVM / Memory 716 may include one or more tangible, non-transitory computer storage media for storing data and / or instructions. In some embodiments, NVM / Memory 716 may include any suitable non-volatile memory such as flash memory and / or any suitable non-volatile storage device, such as at least one of HDD (Hard Disk Drive), CD (Compact Disc) drive, and DVD (Digital Versatile Disc) drive. NVM / Memory 716 may include a portion of storage resources on the device on which System 700 is installed, or it may be accessible by the device, but is not necessarily part of the device. For example, NVM / Memory 716 may be accessed over a network via Network Interface 720.
[0148] Specifically, system memory 712 and NVM / memory 716 may each include a temporary copy and a permanent copy of instruction 724. Instruction 724 may include instructions that, when executed by at least one of processors 704, cause system 700 to perform the aforementioned actions. Figure 7 Instructions for the function of the encoder structure shown. In some embodiments, instructions 724, hardware, firmware and / or their software components may additionally / alternatively be placed in system control logic 708, network interface 720 and / or processor 704.
[0149] Network interface 720 may include a transceiver for providing a radio interface to system 700, thereby enabling communication with any other suitable device (such as a front-end module, antenna, etc.) via one or more networks. In some embodiments, network interface 720 may be integrated into other components of system 700. For example, network interface 720 may be integrated into at least one of processor 704, system memory 712, NVM / memory 716, and firmware device (not shown) with instructions that, when at least one of processor 704 executes the instructions, enable system 700 to implement... Figure 5 The functions shown.
[0150] The network interface 720 may further include any suitable hardware and / or firmware to provide a multiple-input multiple-output radio interface. For example, the network interface 720 may be a network adapter, a wireless network adapter, a telephone modem, and / or a wireless modem.
[0151] In one embodiment, at least one of the processors 704 may be packaged together with the logic of one or more controllers for system control logic 708 to form a system-in-package (SiP). In another embodiment, at least one of the processors 704 may be integrated on the same die with the logic of one or more controllers for system control logic 708 to form a system-on-a-chip (SoC).
[0152] System 700 may further include an input / output (I / O) device 732. The I / O device 732 may include a user interface enabling a user to interact with system 700; the peripheral component interface is designed to allow peripheral components to also interact with system 700. In some embodiments, system 700 may also include sensors for determining at least one of environmental conditions and location information related to system 700.
[0153] Figure 8 A schematic block diagram of a SoC (System on Chip) 800 is shown according to an embodiment of this application. Figure 8 In the diagram, similar components share the same reference numerals. Additionally, dashed boxes are an optional feature for more advanced SoCs. Figure 8 In this SoC 800, the following are included: an interconnect unit 850 coupled to a processor 810; a system proxy unit 870; a bus controller unit 880; an integrated memory controller unit 840; a group or one or more coprocessors 820, which may include integrated graphics logic, an image processor, an audio processor, and a video processor; a static random access memory (SRAM) unit 830; and a direct memory access (DMA) unit 860. In one embodiment, the coprocessor 820 includes a dedicated processor, such as, for example, a network or communication processor, a compression engine, a GPGPU, a high-throughput MIC processor, or an embedded processor, etc.
[0154] The System-on-Chip 800 can be used to execute... Figure 5 The described exception handling method.
[0155] The various embodiments of the mechanisms disclosed in this application can be implemented in hardware, software, firmware, or a combination of these implementation methods. Embodiments of this application can be implemented as computer programs or program code executable on a programmable system, the programmable system including at least one processor, a storage system (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device.
[0156] Program code can be applied to input instructions to execute the functions described in this application and generate output information. The output information can be applied to one or more output devices in a known manner. For the purposes of this application, the processing system includes any system having a processor such as, for example, a digital signal processor (DSP), a microcontroller, an application-specific integrated circuit (ASIC), or a microprocessor. The program code can be implemented using a high-level procedural language or an object-oriented programming language to communicate with the processing system. Assembly language or machine language can also be used to implement the program code when necessary. In fact, the mechanisms described in this application are not limited to any particular programming language. In either case, the language can be a compiled language or an interpreted language.
[0157] In some cases, the disclosed embodiments may be implemented in hardware, firmware, software, or any combination thereof. The disclosed embodiments may also be implemented as instructions carried or stored thereon on one or more temporary or non-temporary machine-readable (e.g., computer-readable) storage media, which may be read and executed by one or more processors. For example, the instructions may be distributed via a network or via other computer storage media. Therefore, machine storage media may include any mechanism for storing or transmitting information in a machine-readable (e.g., computer-readable) form, including but not limited to floppy disks, optical disks, CD-ROMs, magneto-optical disks, read-only memory (ROM), random access memory (RAM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), magnetic cards or optical cards, flash memory, or tangible machine-readable storage for transmitting information (e.g., carrier waves, infrared signals, digital signals, etc.) using the Internet in the form of electrical, optical, acoustic, or other propagation signals. Therefore, machine storage media include any type of machine storage medium suitable for storing or transmitting electronic instructions or information in a machine-readable (e.g., computer-readable) form.
[0158] In this specification, the reference to "an embodiment" or "an embodiment" means that a specific feature, structure, or characteristic described in connection with the embodiment is included in at least one exemplary implementation or technology disclosed according to an embodiment of this application. The appearance of the phrase "in an embodiment" in various places in the specification does not necessarily refer to the same embodiment.
[0159] Furthermore, the language used in this specification has been primarily chosen for readability and instructional purposes and may not have been chosen to depict or limit the disclosed subject matter. Therefore, the embodiments disclosed herein are intended to illustrate, and not limit, the scope of the concepts discussed herein.
Claims
1. An anomaly handling method, applied to electronic devices, characterized in that, The method includes: Obtain a first type of exception and a second type of exception, wherein the first type of exception includes a suspended exception and the second type of exception includes an active exception; From the first type of anomalies, determine a first anomaly that meets a first preset condition, wherein the first preset condition is that it has the highest priority among the first type of anomalies; In response to the received event response, a second exception that meets the second preset condition is determined from the second type of exception and the second exception is temporarily stored. The event response is used to indicate the processing of the second type of exception, and the second preset condition is that the exception has the highest priority among the second type of exception. Compare the first anomaly and the second anomaly, and determine an anomaly that meets the third preset condition from the first anomaly and the second anomaly as the target anomaly, and process the target anomaly, wherein the third preset condition is the highest priority; Corresponding to the second exception where no event response is received and no temporary exception exists, the first exception is taken as the target exception and the target exception is processed.
2. The method according to claim 1, characterized in that, From the first type of anomalies, determine a first anomaly that meets the first preset condition, including: Compare the anomaly information of the first type of anomaly The highest priority first type of anomaly corresponding to the anomaly information is identified as the first anomaly.
3. The method according to claim 1, characterized in that, Corresponding to the received event response, a second exception that meets the second preset condition is determined from the second type of exceptions, and the exception information of the second exception is temporarily stored, including: Switch to comparing the exception information of the second type of exception; The second type of anomaly with the highest priority corresponding to the anomaly information is identified as the second anomaly. The exception information of the second type of exception is temporarily stored, wherein the event response includes an instruction to switch to comparing the exception information of the second type of exception.
4. The method according to claim 1, characterized in that, Also includes: For the second exception that has not received an event response and has been temporarily stored, the first exception and the second exception are compared, and an exception that meets the third preset condition is determined from the first exception and the second exception as the target exception and the target exception is processed.
5. The method according to claim 1, characterized in that, Comparing the first anomaly and the second anomaly, determining a target anomaly that meets a third preset condition from the first anomaly and the second anomaly, and processing the target anomaly, including: Compare the anomaly information of the first anomaly and the second anomaly; The first or second anomaly with the highest priority corresponding to the anomaly information is identified as the target anomaly.
6. An anomaly handling device, applied to electronic equipment, characterized in that, The device includes: An exception selection unit is used to obtain a first type of exception and a second type of exception, wherein the first type of exception includes a suspended exception and the second type of exception includes an active exception; An exception handling unit is configured to determine a first exception from the first type of exceptions that meets a first preset condition, wherein the first preset condition is that it has the highest priority among the first type of exceptions. An event response unit is configured to receive an event response, the event response being used to instruct the handling of the second type of exception, and, corresponding to the event response unit receiving the event response, the exception handling unit determines a second exception from the second type of exceptions that meets a second preset condition, the second preset condition being that it has the highest priority among the second type of exceptions; An exception storage unit is used to temporarily store the exception information of the second exception; A preemption controller is configured to, when the exception information of the second exception exists in the exception storage unit, compare the first exception and the second exception, determine a target exception that meets a third preset condition from the first exception and the second exception, and, when the exception information of the second exception does not exist in the exception storage unit, take the first exception as the target exception and instruct the electronic device to process the target exception, wherein the third preset condition is the highest priority.
7. The anomaly handling device according to claim 6, characterized in that, The exception handling unit is used to compare the exception information of the first type of exception and determine the first type of exception with the highest priority corresponding to the exception information as the first exception.
8. The anomaly handling device according to claim 6, characterized in that, When the event response unit receives the event response, the exception handling unit switches to comparing the exception information of the second type of exception and determines the second type of exception with the highest priority corresponding to the exception information as the second exception.
9. The anomaly handling device according to claim 8, characterized in that, The exception storage unit temporarily stores the exception information of the second exception, wherein the event response includes an instruction from the event response unit to the exception handling unit to switch to comparing the exception information of the second type of exception.
10. The anomaly handling device according to claim 6, characterized in that, If the event response unit does not receive the event response, the exception handling unit determines a first exception from the first type of exception that meets the first preset condition.
11. The anomaly handling device according to claim 6, characterized in that, The preemption controller compares the exception information of the first exception and the second exception, and determines the first exception or the second exception with the highest priority corresponding to the exception information as the target exception.
12. The anomaly handling device according to claim 7, characterized in that, The exception handling unit includes a comparison module, which receives at least two first exceptions or second exceptions from N first-type exceptions or N second-type exceptions. The comparison module compares the at least two first exceptions or second exceptions to determine a first exception that meets the first preset condition or a second exception that meets the second preset condition, where N is a natural number greater than or equal to 2.
13. The anomaly handling device according to claim 12, characterized in that, The number of comparison modules is: + +…+ + .
14. An exception handling architecture applied to electronic devices, characterized in that, The architecture includes: An event response unit, which is communicatively connected to the processor of the electronic device, is used to receive an event response from the processor, the event response being used to indicate the handling of a second type of exception; An exception selection unit is communicatively connected to the processor of the electronic device. It obtains a first type of exception and a second type of exception from the processor. When the event response unit receives the event response, the event response unit sends an event response instruction to the exception selection unit. In response to the event response instruction, the exception selection unit sends the second type of exception to the exception handling unit. The first type of exception includes a suspended exception, and the second type of exception includes an active exception. An exception handling unit is communicatively connected to the exception selection unit and the event response unit. When the event response unit does not receive the event response, the exception handling unit receives a first type of exception from the exception selection unit, determines a first exception that meets a first preset condition from the first type of exception, and when the event response unit receives the event response, the event response unit sends an event response instruction to the exception selection unit. The exception handling unit receives a second type of exception from the exception selection unit, switches to determining a second exception that meets a second preset condition from the second type of exception, wherein the first preset condition is that the exception has the highest priority among the first type of exceptions, and the second preset condition is that the exception has the highest priority among the second type of exceptions. An exception storage unit, which is communicatively connected to the exception handling unit, is used to receive and temporarily store the second exception from the exception handling unit. A preemption control unit, which is communicatively connected to the exception storage unit and the exception handling unit, is used to receive the first exception from the exception handling unit and the second exception from the exception storage unit. When both the first exception and the second exception exist, the first exception and the second exception are compared, and a target exception that meets a third preset condition is determined from the first exception and the second exception. When only the first exception exists, the first exception is determined as the target exception. The third preset condition is the highest priority.
15. The exception handling architecture according to claim 14, characterized in that, The preemption control unit is communicatively connected to the processor of the electronic device. The preemption control unit sends the target anomaly to the processor of the electronic device, instructing the processor of the electronic device to process the target anomaly.
16. The exception handling architecture according to claim 14, characterized in that, The exception handling unit includes a comparison module, which includes two input terminals and one output terminal. The two input terminals respectively receive at least two first exceptions or second exceptions from N first-type exceptions or N second-type exceptions. The comparison module compares the at least two first exceptions or second exceptions respectively to determine a first exception that meets the first preset condition or a second exception that meets the second preset condition, where N is a natural number greater than or equal to 2.
17. The exception handling architecture according to claim 16, characterized in that, The number of comparison modules is: + +…+ + .
18. The exception handling architecture according to claim 14, characterized in that, The exception handling unit compares the exception information of the first type of exception and determines the first type of exception with the highest priority corresponding to the exception information as the first exception.
19. The exception handling architecture according to claim 14, characterized in that, The exception handling unit compares the exception information of the second type of exception and determines the second type of exception with the highest priority corresponding to the exception information as the second exception.
20. The exception handling architecture according to claim 14, characterized in that, The determination of a target anomaly that meets the third preset condition includes: The preemption control unit compares the anomaly information of the first anomaly and the second anomaly, and determines the first anomaly or the second anomaly with the highest priority corresponding to the anomaly information as the target anomaly, which meets the third preset condition.
21. An electronic device, characterized in that, Includes the exception handling architecture of any one of claims 14 to 20.
Citation Information
Patent Citations
Method for Handling Exceptions in Exception-Driven System
CN107402831A