A communication method among multiple CPUs
By setting up communication channels between a strong computing power CPU and multiple weak computing power CPUs in the hardware, and using message formats for decoding and forwarding, the problem of difficult communication between multiple weak computing power CPUs is solved, and simple hardware is realized Design and efficient message passing reduce memory requirements and improve system scalability.
Patent Information
- Application Number
- CN202411027771.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-30
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2044-07-30
AI Technical Summary
It is difficult to achieve communication between multiple CPUs with weak computing power, which increases the difficulty of hardware design and requires high memory for CPUs with weak computing power. Existing technologies such as shared memory, message passing and Internet or DMA have scalability limitations and complexity. question.
By setting up communication channels between a strong computing power CPU and multiple weak computing power CPUs in the hardware, using message formats for message decoding and forwarding, and using asynchronous receivers and transceivers, serial peripheral interfaces or direct memory access to achieve communication, the hardware is simplified Designed to reduce the memory requirements of CPUs with weak computing power.
It realizes message communication between all CPUs, simplifies the hardware design, reduces the memory requirements of CPUs with weak computing power, avoids the complexity of establishing communication connections between all CPUs, and improves the scalability and efficiency of the system.
Smart Images

Figure CN118550736B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of chip technology, in particular to a communication method between multiple CPUs. Background Art
[0002] Weak computing CPUs do not support the establishment of multiple communication channels. In specific situations where weak computing CPUs need to communicate with each other, it is difficult to achieve mutual communication among all CPUs. In particular, when there are multiple weak computing CPUs in a hardware, if all CPUs need to communicate with each other, it will increase the difficulty of hardware design and place high memory requirements on weak computing CPUs.
[0003] In the prior art, the communication between CPUs can be done in a variety of ways depending on the physical connection and system architecture. The following are several common communication methods between CPUs and their advantages and disadvantages:
[0004] Shared Memory:
[0005] advantage:
[0006] Efficient data access: The CPU can directly read and write shared memory, and data access efficiency is high.
[0007] Low latency: Communication latency is low due to direct access to memory.
[0008] shortcoming:
[0009] Coherence management: Complex cache coherence protocols are required to ensure the consistency of shared data.
[0010] Scalability limitations: As the number of CPUs increases, shared memory architectures may face scalability challenges.
[0011] Limitations: Not suitable for distributed systems or massively parallel processing.
[0012] Messaging:
[0013] advantage:
[0014] Parallelism: Each CPU can execute tasks independently without waiting for the results of other CPUs, which is suitable for highly parallel tasks.
[0015] Flexible: Suitable for different hardware layouts and sizes, and can be easily expanded to larger systems.
[0016] shortcoming:
[0017] Communication overhead: Creating, transmitting, and receiving messages consumes time and resources, i.e., additional overhead.
[0018] Complex programming model: Compared with shared memory, the message passing model may require more complex programming skills and management.
[0019] Interconnect or DMA (Direct Memory Access):
[0020] advantage:
[0021] Low latency: Data is transferred directly through hardware, which has better performance characteristics than shared memory and system buses.
[0022] shortcoming:
[0023] Depends on hardware support: Requires hardware support between the CPU and the motherboard.
[0024] Complexity: Internetworks need to be designed and implemented or precise configuration and management are required to ensure correct and consistent data transmission. Summary of the invention
[0025] In order to solve the above problems, the present invention proposes a communication method among multiple CPUs which enables all CPUs to perform message communication and has a simpler hardware design.
[0026] In order to achieve the above object, the present invention is implemented by the following technical solutions:
[0027] The present invention is a communication method between multiple CPUs, comprising the following operations:
[0028] Establish a communication channel between a strong computing power CPU and multiple weak computing power CPUs;
[0029] Setting a message format for a strong computing power CPU to communicate with multiple weak computing power CPUs, wherein the message format includes a source CPU of the message, namely SrcCPU, a destination CPU of the message, namely DstCPU, a main type, namely Mtype, a subtype, namely Stype, and a message content, namely Content;
[0030] After the strong computing power CPU receives the message sent by the weak computing power CPU through the communication channel, it decodes the message according to the message format to obtain the source CPU of the message, the destination CPU of the message and the message content;
[0031] The strong computing power CPU determines the corresponding communication channel according to the destination CPU of the received message, and forwards the message to the corresponding weak computing power CPU through the corresponding communication channel;
[0032] After receiving the message, the weak computing power CPU executes the message content decoded by the strong computing power CPU and returns the execution result to the strong computing power CPU;
[0033] The powerful CPU sends the execution result to the source CPU of the message through the communication channel.
[0034] A further improvement of the present invention is that the communication channel between the high-computing power CPU and the low-computing power CPU is established by using an asynchronous transceiver, a serial peripheral interface, or a direct memory access.
[0035] A further improvement of the present invention is that the source CPU of the message and the destination CPU of the message in the message format are both three-bit binary codes, the main type is two-bit binary code, and the subtype is eight-bit binary code.
[0036] A further improvement of the present invention is that the message content is obtained by decoding the main type and subtype in the message by a high-computing power CPU, wherein the main type indicates the type of the message, including control message, management message, and data message, and the subtype indicates the specific function of the message.
[0037] The beneficial effects of the present invention are as follows: for hardware with a strong computing power CPU and multiple weak computing power CPUs, the present invention can enable all CPUs to communicate messages, and the function is more convenient to implement, the hardware design is more concise, and there is no need to establish communication connections between all CPUs. The present invention can reduce the memory of the weak computing power CPU. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a schematic diagram of a communication method between multiple CPUs in an embodiment of the present invention;
[0039] Figure 2 It is a schematic diagram of a flow chart in an embodiment of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0041] This embodiment is a method for realizing mutual communication between each CPU while reducing the design difficulty caused by hardware interleaving, for hardware having at least one high-computing power CPU and multiple low-computing power CPUs.
[0042] like Figure 2 As shown, a communication method between multiple CPUs implemented in this embodiment includes the following operations:
[0043] Step 1: Establish a communication channel between a strong computing power CPU and multiple weak computing power CPUs;
[0044] Step 2: Setting the message format for the strong computing power CPU to communicate with multiple weak computing power CPUs;
[0045] Step 3: After receiving the message sent by the weak computing power CPU through the communication channel, the strong computing power CPU decodes the message according to the message format to obtain the source CPU, the destination CPU and the message content;
[0046] Step 4: The strong computing power CPU determines the corresponding communication channel according to the destination CPU of the obtained message, and forwards the message to the corresponding weak computing power CPU through the corresponding communication channel; after receiving the message, the weak computing power CPU executes the message content decoded by the strong computing power CPU, and returns the execution result to the strong computing power CPU;
[0047] Step 5: The powerful CPU sends the execution result to the source CPU of the message through the communication channel.
[0048] The communication channel between the strong computing power CPU and multiple weak computing power CPUs in step 1 is as follows Figure 1 As shown, Figure 1 CPU3 is a high-computing CPU, while CPU1, CPU2, CPU4, and CPU5 are all low-computing CPUs, and they only have the ability to establish one communication channel. CPU3 establishes four communication channels to communicate with CPU1, CPU2, CPU4, and CPU5 respectively, and CPU3 has the ability to process messages from four channels. In actual applications, although the four low-computing CPUs have their own functions to complete, in some cases the four low-computing CPUs also need to communicate to improve their functions. Since the low-computing CPUs only have the ability to establish one communication channel, they cannot directly establish a communication channel. Figure 1 In this way, each weak computing power CPU establishes a communication channel with the strong computing power CPU 3, so that the strong computing power CPU 3 communicates with all weak computing power CPUs, processes the message according to the message content or forwards the message to the target weak computing power CPU, and realizes the communication function between each weak computing power CPU. The communication between the strong computing power CPU and the weak computing power CPU can use UART (asynchronous receiver and transmitter), SPI (serial peripheral interface), DMA (direct memory access), etc. The specific situation can be determined according to the function of the chip.
[0049] The message format in step 2 can be configured according to requirements. Table 1 shows a specific message format:
[0050] Table 1: Message format
[0051]
[0052] Among them, SrcCPU is the message source CPU, which is used to indicate the source of the message. It is a three-bit binary code and can be configured as needed. For example: 1 represents CPU1, 2 represents CPU2, 4 represents CPU3, 5 represents CPU4, and 5 represents CPU5.
[0053] DstCPU is the destination CPU of the message, indicating the destination of the message. It is a three-bit binary code and can be configured as needed. For example: 1 represents CPU1, 2 represents CPU2, 4 represents CPU3, 5 represents CPU4, and 5 represents CPU5.
[0054] Mtype is the main type, which is a two-bit binary code and can be configured as needed. For example, 0 represents a control message, 1 represents a management message, and 2 represents a data message.
[0055] Stype is a subtype, which is an eight-bit binary code and can be configured as needed. For example, 0 means that DDR is mapped to the memory of cpu1. In this case, the message content Content includes the memory start address, DDR address and the length to be mapped.
[0056] 1 indicates the DDR mapping result, where success is represented by 0 and failure is represented by 1.
[0057] Mtype and Stype are used to classify and distinguish messages. Mtype indicates the type of the message. For example, the message can be classified into control message, management message, data message, etc. Stype indicates the specific function of the message.
[0058] Combination Figure 1 To explain specifically, assume that after the strong computing power CPU3 receives a message, it decodes it according to the message format described in Table 1, and obtains SrcCPU=1, DstCPU=3, indicating that the message is sent from the weak computing power CPU1 to the strong computing power CPU3. The strong computing power CPU3 continues to parse Mtype=2, Stype=0, and concludes that CPU3 needs to perform memory mapping. The strong computing power CPU3 obtains a specific message from Mtype and Stype, that is, determines the format of the message content Content. As above, Mtype=2, Stype=2, then the message content Content can be decoded to obtain the starting address CPU3_addr of the CPU3 memory and the address DDR_addr of the DDR and the length len that needs to be mapped. CPU3 can map the DDR memory DDR_addr to CPU3_addr, and the mapping length is cold. The above is a message communication between the weak computing power CPU1 and the strong computing power CPU3.
[0059] If the strong computing power CPU3 receives a message and decodes it according to the message format described in Table 1, and obtains SrcCPU=1, DstCPU=2, it indicates that the message is sent from the weak computing power CPU1 to the weak computing power CPU2. The strong computing power CPU3 continues to decode to obtain the message content, and sends the message from the message channel between the strong computing power CPU3 and the weak computing power CPU2 to the weak computing power CPU2. After receiving the message, the weak computing power CPU2 completes the corresponding operation according to the message content decoded by the strong computing power CPU3, thereby realizing the communication between the weak computing power CPU1 and the weak computing power CPU2.
[0060] For a powerful CPU, you can configure it as a time-sharing system or a real-time system according to the installed system and requirements. If the messages of each weak CPU are equally important, the powerful CPU is a time-sharing system, processing all messages in a time-sharing manner. If the message priorities of each weak CPU are different, the powerful CPU can be configured as a real-time system by setting the message level to achieve message priority division. The powerful CPU decodes the messages of the weak CPU according to the message priority.
[0061] For SSD hard disks using multiple CPUs, the Linux master is a powerful CPU, the boot CPU is mainly hardware configuration, the ftl CPU is mainly used for memory management, and the EV71 CPU is used for AI, mainly for audio and video processing. The Linux master has the most powerful computing power and functions, and is a powerful CPU, while the EV71 CPU, ftl CPU, and boot CPU are considered weak computing CPUs. If the EV71 CPU needs to adjust the transmission speed of audio and video data, the EV71 CPU sends a message to the Linux master through the communication channel between the EV71 CPU and the Linux master. After receiving the message, the Linux master decodes the message and obtains the source CPU (i.e., EV71 CPU), the destination CPU (i.e., boot CPU), and the message content, and sends the message to the boot CPU. The boot CPU sets it according to the message content. After the setting is successful, it returns a success message to the Linux master. The Linux master forwards the success message to the EV71 CPU, and the EV71 CPU learns that the transmission speed of audio and video data has been successfully adjusted.
[0062] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art in the art to which the present invention belongs. It should also be understood that terms such as those defined in common dictionaries should be understood to have the same meaning as in the context of the prior art, and will not be interpreted with an idealized or overly formal meaning unless defined similarly here.
[0063] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A communication method between multiple CPUs, characterized in that: The following operations are included: Establish a communication channel between a strong computing power CPU and multiple weak computing power CPUs; Setting a message format for a strong computing power CPU to communicate with multiple weak computing power CPUs, wherein the message format includes a source CPU of the message, namely SrcCPU, a destination CPU of the message, namely DstCPU, a main type, namely Mtype, a subtype, namely Stype, and a message content, namely Content; After the strong computing power CPU receives the message sent by the weak computing power CPU through the communication channel, it decodes the message according to the message format to obtain the source CPU of the message, the destination CPU of the message and the message content; The strong computing power CPU determines the corresponding communication channel according to the destination CPU of the received message, and forwards the message to the corresponding weak computing power CPU through the corresponding communication channel; After receiving the message, the weak computing power CPU executes the message content decoded by the strong computing power CPU and returns the execution result to the strong computing power CPU; The powerful CPU sends the execution result to the source CPU of the message through the communication channel; The communication channel between the strong computing power CPU and the weak computing power CPU is established by using an asynchronous receiver / transmitter, a serial peripheral interface, or a direct memory access method; The message content is obtained by decoding the main type and subtype in the message based on a powerful CPU. The main type indicates the type of the message, including control message, management message, and data message, and the subtype indicates the specific function of the message.
2. The method for communicating between multiple CPUs according to claim 1, wherein: In the message format, the source CPU of the message and the destination CPU of the message are both three-bit binary codes, the main type is two-bit binary code, and the subtype is eight-bit binary code.
