A method and device for inter-core communication, a communication chip and a storage medium
By using interrupt numbers to transmit communication information between cores, the inconsistency and resource waste caused by shared memory usage in inter-core communication are resolved, and efficient multi-core chip communication is achieved.
Patent Information
- Application Number
- CN202311454662.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-02
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2043-11-02
AI Technical Summary
Existing inter-core communication methods require shared memory, leading to problems such as inconsistent read content, queuing delays, and excessive resource consumption.
Interrupt numbers are used to transmit communication information between the initiating core and the receiving core. Inter-core communication is achieved by querying the interrupt list, avoiding the use of shared memory. Interrupt numbers are used for sequential queuing and synchronous updates to ensure the real-time and correctness of information transmission.
It enables multi-core chip communication without sharing memory, improving real-time performance and accuracy, and solving the problems of inconsistency in read content and resource waste.
Smart Images

Figure CN117573598B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of chip communication technology, in particular to an inter-core communication method and device, a communication chip and a storage medium. BACKGROUND
[0002] At present, the inter-core communication is mainly shared memory communication, and the information flow needs to be transmitted through the shared memory.
[0003] However, the above inter-core communication method has the following problems: (1) it needs to occupy the shared memory, and the content before and after the kernel reads the shared memory may be inconsistent; (2) if the number of running tasks is large and occupies too much shared memory, it may cause the inter-core communication to lag due to queuing and waiting; (3) in order to improve efficiency, a special channel needs to be developed to read the memory, which causes the problem of excessive resource investment.
[0004] Therefore, in order to solve the above problems, it is necessary to propose a new inter-core communication method. SUMMARY
[0005] The technical problem to be solved by the embodiments of the present application is to provide an inter-core communication method, device, communication chip and storage medium, which can realize multi-core chip communication without using shared memory, and can solve the problems of inconsistency of read content, queuing and lagging communication and excessive resource investment in the prior art.
[0006] In order to solve the above technical problems, the embodiments of the present application provide an inter-core communication method, which comprises the following steps:
[0007] The initiating core queries the interrupt number corresponding to the inter-core communication information from a preset first interrupt query list table based on the inter-core communication information, and initiates an interrupt request to the receiving core with the queried interrupt number to trigger the connection of the receiving core; wherein the first interrupt query list table is used to indicate the correspondence between the interrupt number and each inter-core communication information;
[0008] The receiving core queries the target inter-core communication information consistent with the inter-core communication information in a preset second interrupt query list table according to the interrupt number of the interrupt request, and executes.
[0009] The method further comprises:
[0010] When the initiating core has multiple inter-core communication information, the initiating core stores all the interrupt numbers queried in the first interrupt query list table in order according to the generation time, extracts the interrupt number at the first position in order to initiate an interrupt request to the receiving core in a first-in-first-out manner, and further extracts the interrupt numbers from the second to the end in order to send to the receiving core after triggering the connection of the receiving core.
[0011] The method further comprises:
[0012] If the initiating core detects that the number of interrupted orders has reached a predetermined number and there are still multiple waiting orders, after any order position is emptied by an interrupt order, one of the waiting orders is filled into the emptied order position in sequence until all waiting orders are filled.
[0013] The method further comprises:
[0014] The receiving core queries the inter-core communication information corresponding to the received interrupt order in the second interrupt query list table.
[0015] The inter-core communication information includes inter-core communication information generated by the core itself after being powered on and inter-core communication information sent by an APP.
[0016] The inter-core communication information is control flow information or data flow information.
[0017] The embodiment of the present application also provides a device comprising an initiating core and a receiving core, and each core stores program instructions executable by the core, and when the program instructions are called by the initiating core, the inter-core communication method is executed.
[0018] The embodiment of the present application also provides a communication chip comprising an initiating core and a receiving core, and each core stores program instructions executable by the core, and when the program instructions are called by the initiating core, the inter-core communication method is executed.
[0019] The embodiment of the present application also provides a storage medium storing computer executable instructions, comprising a stored program, wherein when the program is running, the device in which the computer readable storage medium is located executes the inter-core communication method.
[0020] The embodiment of the present application also provides a storage medium storing computer executable instructions, comprising a stored program, wherein when the program is running, the device in which the computer readable storage medium is located executes the inter-core communication method.
[0021] The embodiment of the present application has the following beneficial effects:
[0022] The present application uses the existing interrupt function, and can realize multi-core chip communication by transmitting communication information in the initiating core and the receiving core through the interrupt order, so that shared memory is not needed, and substantive information is not needed to be transmitted, the real-time performance and the correctness are improved, and the problems of inconsistency before and after reading content, queuing lag communication and excessive resource investment in the prior art are solved. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, obtaining other drawings based on these drawings without creative effort still falls within the scope of the present invention.
[0024] Figure 1 A flowchart of an inter-core communication method provided in an embodiment of the present invention;
[0025] Figure 2 A logic diagram of interrupt number queuing storage in an inter-core communication method provided in an embodiment of the present invention;
[0026] Figure 3 This is a logic diagram of the initiating core triggering the connection to the receiving core in an inter-core communication method provided by an embodiment of the present invention;
[0027] Figure 4 This is an application scenario diagram of an inter-core communication method provided in an embodiment of the present invention. Detailed Implementation
[0028] To make the objectives, technical solutions, and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings.
[0029] like Figure 1 As shown in the figure, an inter-core communication method is provided in an embodiment of the present invention. The method includes the following steps:
[0030] Step S1: The initiating core queries the interrupt number corresponding to the inter-core communication information from a preset first interrupt query list table based on the inter-core communication information, and initiates an interrupt request to the receiving core with the queried interrupt number to trigger the connection to the receiving core; wherein, the first interrupt query list table is used to indicate the correspondence between the interrupt number and the inter-core communication information.
[0031] Step S2: The receiving core queries the preset second interrupt query list table according to the interrupt number of the interrupt request, finds the target inter-core communication information that matches the inter-core communication information, and executes it.
[0032] Specifically, before step S1, a set of interrupt numbers is named, and a corresponding relationship between the interrupt numbers and various types of information in inter-core communication is mapped one by one to form an interrupt query list, as shown in Table 1 below. It should be noted that the interrupt numbers correspond to various types of information in inter-core communication, not the interrupt entry addresses as in the traditional approach. At the same time, in multi-core communication, each core stores the interrupt query list in the kernel and is given a certain name, such as the first interrupt query list, the second interrupt query list, and so on, and the interrupt query list of each core can be updated synchronously to ensure consistency, that is, the first interrupt query list table, the second interrupt query list table, and so on, are the same.
[0033] Table 1
[0034]
[0035] wherein n and m are positive integers, and m is greater than or equal to n.
[0036] In addition, in order to facilitate the processing of inter-core communication information of multiple instructions, a pointer linked list or other queuing linked list is designed for queuing storage, and the interrupt numbers are filled in the pointer linked list or other queuing linked list in sequence according to the "first-in, first-out" principle. It should be noted that if the queued interrupt numbers exceed the pointer linked list or other queuing linked list, then the waiting interrupt numbers will be filled in the emptied sorting position in sequence after the sorting position is emptied, until all the waiting interrupt numbers are filled, as shown in Figure 2
[0037] In step S1, first, when the initiating core receives the inter-core communication information sent by the user through the APP or the inter-core communication information generated by the kernel of the initiating core after power-on, the initiating core will query the interrupt number that implements the inter-core communication information based on the inter-core communication information in the first interrupt query list table preset thereon. The inter-core communication information includes but is not limited to control flow information and data flow information, etc. It should be noted that the initiating core will automatically match the receiving core cooperating with the initiating core based on the inter-core communication information.
[0038] Secondly, the initiating core will initiate an interrupt request to the receiving core with the queried interrupt number to trigger the connection receiving core, as shown in Figure 3
[0039] It can be understood that, in view of the above-mentioned queuing storage design of the pointer linked list or other queuing linked list for the interrupt number, when there are multiple inter-core communication information, the initiating core stores all the interrupt numbers found in the first interrupt query list table in order based on the time of generation of the inter-core communication information, and extracts the interrupt number at the first position in order in a first-in-first-out manner to initiate an interrupt request to the receiving core, so as to trigger the receiving core, and further extract the interrupt numbers from the second to the end in order to send to the receiving core.
[0040] Of course, if the initiating core detects that the number of interrupt numbers in order has reached a predetermined number and there are still multiple waiting, after any ordered position is emptied due to the sending of an interrupt number, one of all the waiting interrupt numbers is sequentially filled into the emptied ordered position until all the waiting interrupt numbers are filled, so as to realize the polling queuing filling after the pointer linked list or other queuing linked list is emptied.
[0041] In step S2, the receiving core queries the target inter-core communication information consistent with the inter-core communication information in the preset second interrupt query list table according to the interrupt number of the interrupt request, and executes. Since the second interrupt query list table is the same as the first interrupt query list table and is updated synchronously, the transmission of the inter-core communication information does not need to transmit the substantive information, nor does it need to use shared memory, thereby improving the real-time performance and correctness.
[0042] It can be understood that, if the receiving core has interrupt numbers waiting in queue, the interrupt numbers also need to be taken out according to the principle of "first-in-first-out", and the corresponding inter-core communication information is queried first. Therefore, the method further comprises: the receiving core sequentially queries the inter-core communication information corresponding to the received interrupt number in the second interrupt query list table.
[0043] As shown in Figure 4 , the application scenario of the inter-core communication method provided in the embodiment of the application is further described, as follows:
[0044] Step 1, X core is the initiating core, and Y core is the receiving core. The X core determines whether there is an inter-core communication demand through the inter-core communication information; if yes, step 2 is executed; if not, step 1 is returned.
[0045] Step 2, the X core determines that the inter-core communication information is inter-core communication information A.
[0046] Step 3, the X core queries the interrupt number corresponding to the inter-core communication information A in the first interrupt query list table.
[0047] Step 4, the X core stores the queried interrupt number in the queuing unit in order.
[0048] Step 5, the X core judges whether there is other inter-core communication sending interrupt; if yes, step 6 is executed; if no, step 7 is jumped to;
[0049] Step 6, the X core lets the interrupt number enter the queue waiting, and extracts the interrupt number to send to the Y core when the turn order comes;
[0050] Step 7, the X core initiates the interrupt request of the highest priority to the Y core with the interrupt number, to trigger the connection of the Y core;
[0051] Step 8, the Y core receives the interrupt number;
[0052] Step 9, the Y core judges whether there is other interrupt number execution; if yes, step 10 is executed; if no, step 11 is jumped to;
[0053] Step 10, the Y core lets the interrupt number enter the queue waiting, and extracts when the turn order comes;
[0054] Step 11, the Y core queries the inter-core communication information corresponding to the interrupt number as inter-core communication information A in the second interrupt query list table;
[0055] Step 12, the Y core executes the inter-core communication information A.
[0056] Similarly, the specific application scenario process when the Y core is the initiating core and the X core is the receiving core is deduced by analogy, which is not described here.
[0057] Corresponding to the inter-core communication method provided in the embodiment of the application, the embodiment of the application further provides a device, which can include a multi-core processor. Wherein, the multi-core processor includes an initiating core and a receiving core, and each core stores program instructions executable by it, when the program instructions are called by the initiating core, the inter-core communication method provided in the embodiment of the application is executed.
[0058] Corresponding to the device provided in the embodiment of the application, the embodiment of the application further provides a communication chip, which can be a chip for realizing the structure of the above-mentioned device. Wherein, the communication chip includes an initiating core and a receiving core, and each core stores program instructions executable by it, when the program instructions are called by the initiating core, the inter-core communication method provided in the embodiment of the application is executed.
[0059] Corresponding to the inter-core communication method provided in the embodiment of the application, the embodiment of the application further provides a storage medium storing computer executable instructions, which includes stored programs, wherein, when the program runs, the device where the computer readable storage medium is located executes the inter-core communication method provided in the embodiment of the application.
[0060] The embodiment of the application has the following beneficial effects:
[0061] The application uses the existing interrupt function, and realizes the multi-core chip communication by transmitting the communication information in the initiating core and the receiving core through the interrupt number, so that the shared memory is not needed, the substantial information is not needed to be transmitted, the real-time performance and the correctness are improved, and the problems of the inconsistency before and after reading the content, the queuing lag communication and the excessive resource investment in the prior art are solved.
[0062] Those skilled in the art can appreciate that the modules, units and method steps described in the embodiments disclosed in the specification can be realized in electronic hardware, computer software and a combination of electronic hardware and computer software. Whether the functions are realized in the form of hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different ways to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.
[0063] The above only discloses the preferred embodiments of the present application, and of course cannot limit the scope of the right of the present application, so the equivalent changes made according to the claims of the present application still belong to the scope covered by the present application.
Claims
1. A method of inter-core communication, the method comprising: The method comprises the following steps: Before inter-core communication, a set of interrupt numbers are named, and the interrupt numbers are mapped to each type of inter-core communication information one by one to form an interrupt query list table, which comprises a first interrupt query list table and a second interrupt query list table; The interrupt query list table is stored in the kernel of each core participating in multi-core communication, and the interrupt query list table stored in each core is the same and is updated synchronously; The interrupt number corresponds to inter-core communication information, and the inter-core communication information comprises at least one of the following: initiator core broadcast information, initiator core request for receiving core information, receiving core request for initiator core information, receiving core completion of initiator core request, initiator core completion of receiving core request, initiator core failure to complete, receiving core failure to complete, initiator core remaining control instructions, and receiving core remaining control instructions; The initiator core queries the interrupt number corresponding to the inter-core communication information from the preset first interrupt query list table based on the inter-core communication information, and initiates an interrupt request to the receiving core with the queried interrupt number to trigger the connection of the receiving core; the first interrupt query list table is used to indicate the correspondence between the interrupt number and each inter-core communication information; The receiving core queries the target inter-core communication information matching the inter-core communication information in the preset second interrupt query list table according to the interrupt number of the interrupt request and executes.
2. The method of inter-core communication of claim 1, wherein, The method further comprises: When there are multiple inter-core communication information, the initiator core stores all the interrupt numbers queried in the first interrupt query list table in order based on the generation time, extracts the interrupt number at the first position in order to initiate an interrupt request to the receiving core in a first-in-first-out manner, and further extracts the interrupt numbers from the second to the last position in order to send to the receiving core after triggering the connection of the receiving core.
3. The method of inter-core communication of claim 2, wherein, The method further comprises: If the initiator core detects that the number of interrupt numbers in order has reached a predetermined number and there are still multiple waiting interrupt numbers, the initiator core fills one of the waiting interrupt numbers in order to the empty position in order after the empty position is emptied due to the sending of an interrupt number, until all the waiting interrupt numbers are filled.
4. The method of inter-core communication of claim 1, wherein, The method further comprises: The receiving core queries the inter-core communication information corresponding to the received interrupt number in order in the second interrupt query list table.
5. The method of inter-core communication of claim 1, wherein, The inter-core communication information comprises inter-core communication information generated by the kernel of the initiator core after power-on and inter-core communication information sent by an APP.
6. The method of inter-core communication of claim 5, wherein, The inter-core communication information is control flow information or data flow information.
7. An electronic device, comprising: The method comprises an initiator core and a receiving core, and each core stores program instructions executable by itself, and when the program instructions are called by the initiator core, the inter-core communication method of any one of claims 1-6 is executed.
8. A communication chip, comprising: The method comprises an initiator core and a receiving core, and each core stores program instructions executable by itself, and when the program instructions are called by the initiator core, the inter-core communication method of any one of claims 1-6 is executed.
9. A storage computer readable storage medium, characterized in that, including a stored program that, when executed by the device in which the computer-readable storage medium is located, controls the device to perform the inter-core communication method of any one of claims 1-6.
Citation Information
Patent Citations
Inter-core interrupt execution method and device, inter-core interrupt processing method and device, equipment and storage medium
CN114416317A