A communication method and a communication system
By using the control module and ring buffer module in the communication system to transmit message data between chips, the problems of high CPU load and low efficiency in traditional inter-chip communication are solved, and more efficient data transmission is achieved.
Patent Information
- Application Number
- CN201910186288.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-03-12
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2039-03-12
AI Technical Summary
Traditional inter-chip communication increases CPU load, reduces access efficiency, and lengthens real-time response time, affecting data throughput.
Using a communication system, the first control module obtains message data from the flash memory, controls its writing to the ring buffer module, and sends it to the second ring buffer module through the system bus, so that the second processor obtains the message data and reduces processor occupancy. rate and improve transmission efficiency.
It reduces the processor occupancy rate, improves data transmission efficiency, reduces the real-time response time of data involved in the CPU, and improves data throughput.
Smart Images

Figure CN109828944B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of communication technology, and in particular to a communication method and a communication system. Background Art
[0002] Traditional communication between two chips includes data transmission, where the two chips include a master chip and a slave chip. Data transmission is initiated by the processor (CPU) in the master chip, transmitted to the processor in the slave chip through a high-speed interface, and then the processor in the slave chip returns a response corresponding to the command to the processor of the master chip after executing the command. Data transmission is initiated by the master processor of the master chip. The biggest disadvantages of this data interaction method are as follows:
[0003] 1. The CPU load increases significantly, and the CPU needs to frequently participate in data startup and termination.
[0004] 2. Since the delay of inter-chip communication is generally much greater than that of internal chip communication, the CPU access efficiency is greatly reduced.
[0005] 3. CPU involvement causes the real-time data response time to be longer, which has a significant impact on data throughput. Summary of the invention
[0006] The present invention provides a communication method and a communication system, which can reduce the occupancy rate of a processor and improve the data transmission efficiency at the same time.
[0007] To solve the above technical problems, a technical solution adopted by the present invention is: providing a communication method, applied to a first chip and a second chip, wherein the first chip includes a first processor, a first communication interface and a first flash memory connected to each other in pairs, and the second chip includes a second processor, a second communication interface and a second flash memory connected to each other in pairs, the first communication interface includes a first control module, a first ring buffer module and a first bus interface, the second communication interface includes a second control module, a second ring buffer module and a second bus interface, and the first bus interface of the first communication interface is connected to the second bus interface of the second communication interface through a system bus; the method includes: the first control module obtains message data from the first flash memory, wherein the message data includes read data and write data; the first control module controls the message data to be written into the first ring buffer module, and controls the message data to be sent from the first ring buffer module to the second ring buffer module through the system bus; the second ring buffer module receives the message data from the first ring buffer module through the system bus, so that the second processor obtains the message data.
[0008] To solve the above technical problems, a technical solution adopted by the present invention is: to provide a communication system, including a first chip and a second chip, the first chip including a first processor, a first communication interface and a first flash memory connected to each other in pairs, the second chip including a second processor, a second communication interface and a second flash memory connected to each other in pairs, the first communication interface including a first control module, a first ring buffer module and a first bus interface, the second communication interface including a second control module, a second ring buffer module and a second bus interface, the first bus interface of the first communication interface is connected to the second bus interface of the second communication interface through a system bus; wherein the first control module obtains message data from the first flash memory, wherein the message data includes read data and write data; the first control module controls the message data to be written into the first ring buffer module, and controls the message data to be sent from the first ring buffer module to the second ring buffer module through the system bus; the second ring buffer module receives the message data from the first ring buffer module through the system bus, so that the second processor obtains the message data.
[0009] The beneficial effect of the present invention is: after the communication method and communication system of the present invention obtain message data from the first flash memory through the first control module, the message data is controlled to be sent from the first ring buffer module to the second ring buffer module through the system bus, and the second ring buffer module receives the message data from the first ring buffer module through the system bus so that the second processor obtains the message data, thereby reducing the processor occupancy rate while improving the transmission efficiency of the message data. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 is a schematic diagram of the structure of a communication system according to an embodiment of the present invention;
[0011] Figure 2 is a flow chart of a communication method according to a first embodiment of the present invention;
[0012] Figure 3 for Figure 2 A sub-flowchart in which the first control module controls the writing of message data into the first ring buffer module, and controls the sending of message data from the first ring buffer module to the second ring buffer module via the system bus;
[0013] Figure 4 is a flow chart of a communication method according to a second embodiment of the present invention;
[0014] Figure 5 for Figure 4 The second control module controls the writing of message data into the second ring buffer module, and controls the sending of message data from the second ring buffer module to the first ring buffer module through the system bus. DETAILED DESCRIPTION
[0015] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0016] The terms "first", "second" and "third" in the present invention are only used for descriptive purposes, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first", "second" and "third" can explicitly or implicitly include at least one of the features. In the description of the present invention, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. All directional indications (such as up, down, left, right, front, back...) in the embodiments of the present invention are only used to explain the relative position relationship, movement, etc. between the components under a certain specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indication also changes accordingly. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.
[0017] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present invention. The appearance of the phrase in various places in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0018] Figure 1 Schematic diagram of the structure of the communication system of the embodiment of the present invention. Figure 1 As shown, the communication system 100 includes a first chip 10 and a second chip 20 .
[0019] The first chip 10 includes a first processor 11, a first communication interface 12 and a first flash memory 13 connected in pairs, and the second chip 20 includes a second processor 21, a second communication interface 22 and a second flash memory 23 connected in pairs.
[0020] The first communication interface 12 includes a first bus interface 121 , and the second communication interface 22 includes a second bus interface 221 . The first bus interface 121 of the first communication interface 12 is connected to the second bus interface 221 of the second communication interface 22 via the system bus 30 .
[0021] Preferably, the first bus interface 121 and the second bus interface 221 are PCIe interfaces, and the system bus 30 is a PCIe bus.
[0022] The first communication interface 12 further includes a first control module 122 and a first ring buffer module 123, wherein the first control module 122 is respectively connected to the first ring buffer module 123 and the first bus interface 121. The second communication interface 22 includes a second control module 222 and a second ring buffer module 223, wherein the second control module 222 is respectively connected to the second ring buffer module 223 and the second bus interface 221.
[0023] Preferably, the first ring buffer module 123 and the second ring buffer module 223 are pulse buffers or burst buffers.
[0024] Preferably, the first ring buffer module 123 and the second ring buffer module 223 both include a write data buffer unit and a read data buffer unit, which are respectively used to store write data and read data in the message data.
[0025] The process of transmitting message data between the first chip 10 and the second chip 20 is specifically as follows: the first control module 122 obtains message data from the first flash memory 13, wherein the message data includes read data and write data; the first control module 122 controls the message data to be written into the first ring buffer module 123, and controls the message data to be sent from the first ring buffer module 123 to the second ring buffer module 223 through the system bus 30; the second ring buffer module 223 receives the message data from the first ring buffer module 123 through the system bus 30, so that the second processor 21 obtains the message data.
[0026] In this embodiment, the second ring buffer module 223 receives message data from the first ring buffer module 123 through the system bus 30 so that the second processor 21 obtains the message data. Specifically, the operation can be: the second ring buffer module 223 receives message data from the first ring buffer module 123 through the system bus 30; the second control module 222 controls the message data to be sent to the second flash memory 23, so that the second processor 2 obtains the message data from the second flash memory 23.
[0027] In other embodiments, the second ring buffer module 223 receives the message data from the first ring buffer module 123 through the system bus 30 so that the second processor 21 obtains the message data. Specifically, the second ring buffer module 223 receives the message data from the first ring buffer module 123 through the system bus 30; the second processor 21 receives the message data from the second ring buffer module 123 through the internal bus.
[0028] When the first chip 10 is the master chip and the second chip 20 is the slave chip, the message data is the write data stored in the first flash memory 13 and written by the master chip to the slave chip, that is, the write data can be defined as the data written by the master chip to the slave chip.
[0029] When the first chip 10 is a slave chip and the second chip 20 is a master chip, the message data is read data stored in the second flash memory 33 and read by the master chip from the slave chip, that is, the read data can be defined as data read by the master chip from the slave chip.
[0030] Figure 2 is a flow chart of a communication method according to a first embodiment of the present invention, Figure 2 The communication method shown is based on Figure 1 The communication system shown in FIG. 1 is a first chip 10 and a second chip 20 is a second chip. Figure 2 As shown, the method is based on the master chip writing data to the slave chip, and the method includes the following steps:
[0031] Step S101: a first control module obtains message data from a first flash memory, wherein the message data is write data.
[0032] In step S101, when the master chip needs to write message data into the slave chip, the first control module in the first communication interface in the master chip first obtains the message data from the first flash memory, wherein the message data is write data.
[0033] Step S102: the first control module controls the message data to be written into the first ring buffer module, and controls the message data to be sent from the first ring buffer module to the second ring buffer module via the system bus.
[0034] In step S102, after the first control module controls the writing of write data into the write data buffer unit in the first ring buffer module, the first control module and the second control module perform a status handshake and notify the second control module that "the first ring buffer module stores write data", the first control module sends the write data stored in the first ring buffer module to the second ring buffer module through the system bus.
[0035] Please refer to Figure 3 , Figure 3 for Figure 2The first control module controls the writing of message data into the first ring buffer module, and controls the sending of message data from the first ring buffer module to the second ring buffer module through the system bus, the sub-flow chart comprising the steps of:
[0036] Step S1021: the first control module obtains the data volume of the message data according to the write address pointer corresponding to the message data stored in the first ring buffer module.
[0037] In step S1021, the first control module actively reads the write address pointer corresponding to the write data stored in the write data buffer unit in the first ring buffer module, and obtains the data amount of the write data according to the write address pointer.
[0038] Step S1022: the first control module obtains the available space of the second ring buffer module according to the write address pointer in the second ring buffer module.
[0039] In step S1022, the first control module obtains the available space of the write data buffer unit in the second ring buffer module according to the write address pointer of the write data buffer unit in the second ring buffer module.
[0040] Step S1023: The first control module compares the data volume of the message data with the available space of the second ring buffer module.
[0041] In step S1023, the first control module compares the data amount of the write data stored in the first ring buffer module and the available space of the write data buffer unit in the second ring buffer module.
[0042] Step S1024: If the comparison result is that the data volume is smaller than the available space of the second ring buffer module, the first control module controls all message data to be written into the available space of the second ring buffer module.
[0043] In step S1024, if the comparison result is that the data amount is smaller than the available space of the second ring buffer module, the first control module controls all write data to be written into the available space of the write data buffer unit in the second ring buffer module.
[0044] Step S1025: If the comparison result is that the data volume is larger than the available space of the second ring buffer module, the first control module controls part of the message data to be written into the available space of the second ring buffer module according to the size of the available space.
[0045] In step S1025, if the comparison result is that the data volume is larger than the available space of the second ring buffer module, the first control module controls part of the write data to be written into the available space of the write data buffer unit in the second ring buffer module according to the size of the available space.
[0046] Step S103: the second ring buffer module receives the message data from the first ring buffer module via the system bus, so that the second processor obtains the message data.
[0047] In step S103, in this embodiment, the second ring buffer module receives the message data from the first ring buffer module through the system bus so that the second processor obtains the message data. The step may include: the second ring buffer module receives the message data from the first ring buffer module through the system bus; the second control module controls the message data to be sent to the second flash memory so that the second processor obtains the message data from the second flash memory. Specifically, after the second ring buffer module receives the write data from the first ring buffer module through the system bus and stores it in the write data buffer unit of the second ring buffer module, the second control module controls the message data to be sent to the second flash memory, and then notifies the second processor, thereby realizing the operation of writing the write data from the master chip to the slave chip.
[0048] In other embodiments, the second ring buffer module receives the message data from the first ring buffer module via the system bus so that the second processor acquires the message data. The step may include: the second ring buffer module receives the message data from the first ring buffer module via the system bus; the second processor receives the message data from the second ring buffer module via the internal bus. Specifically, after the second ring buffer module receives the write data from the first ring buffer module via the system bus and stores it in the write data buffer unit of the second ring buffer module, the second control module notifies the second processor, and the second processor receives the message data from the second ring buffer module via the internal bus, thereby realizing the operation of writing the write data from the master chip to the slave chip.
[0049] Through the above method, the present invention realizes the transmission of write data between the master and slave chips through the control module and the ring buffer module in the communication interface, that is, it does not require the participation of the processor in the master and slave chips to realize the master chip writing write data to the slave chip, which greatly improves the efficiency of the master chip writing write data to the slave chip.
[0050] Figure 4 is a flow chart of a communication method according to a second embodiment of the present invention, Figure 4 The communication method shown is based on Figure 1 The communication system shown in FIG. 1 is a first chip 10 and a second chip 20 is a second chip. Figure 4 As shown, the method is based on the master chip reading data from the slave chip, and the method includes the following steps:
[0051] Step S201: the second control module obtains message data from the second flash memory, wherein the message data is read data.
[0052] In step S201, when the master chip needs to read message data from the slave chip, the second control module in the second communication interface in the slave chip first obtains the message data from the second flash memory, wherein the message data is read data.
[0053] Step S202: the second control module controls the message data to be written into the second ring buffer module, and controls the message data to be sent from the second ring buffer module to the first ring buffer module via the system bus.
[0054] In step S202, after the second control module controls the read data to be written into the read data buffer unit in the second ring buffer module, the second control module sends the read data stored in the second ring buffer module to the first ring buffer module through the system bus.
[0055] Please refer to Figure 5 , Figure 5 for Figure 4 The second control module controls the writing of message data into the second ring buffer module, and controls the sending of message data from the second ring buffer module to the first ring buffer module through the system bus, the sub-flow chart comprising the following steps:
[0056] Step S2021: the second control module obtains the read address pointer corresponding to the message data stored in the second ring buffer module, and obtains the data volume of the message data according to the read address pointer.
[0057] In step S2021, the second control module of the slave chip obtains the read address pointer of the read data buffer unit in the first ring buffer module in the master chip.
[0058] Step S2022: the second control module obtains the available space of the first ring buffer module according to the read address pointer in the first ring buffer module.
[0059] In step S2022, the second control module obtains available space of the read data buffer unit in the first ring buffer module according to the read address pointer.
[0060] Step S2023: the second control module compares the data volume of the message data with the available space of the first ring buffer module.
[0061] In step S2023, the second control module compares the amount of read data stored in the second ring buffer module with the available space of the read data buffer unit in the first ring buffer module.
[0062] Step S2024: If the comparison result is that the data volume is smaller than the available space of the first ring buffer module, the second control module controls all message data to be sent to the available space of the first ring buffer module.
[0063] In step S2024: if the comparison result is that the data amount is smaller than the available space, the second control module controls all read data to be sent to the available space of the read data buffer unit in the first ring buffer module.
[0064] Step S2025: If the comparison result is that the data volume is larger than the available space of the first ring buffer module, the second control module controls part of the message data to be sent to the available space of the first ring buffer module according to the size of the available space.
[0065] In step S2025, if the comparison result is that the data amount is greater than the available space, the second control module controls part of the read data to be sent to the available space of the read data buffer unit in the first ring buffer module according to the size of the available space.
[0066] Step S203: the first ring buffer module receives the message data from the second ring buffer module via the system bus, so that the first processor obtains the message data.
[0067] In step S203, in this embodiment, the first ring buffer module receives the message data from the second ring buffer module through the system bus so that the first processor obtains the message data. The step may include: the first ring buffer module receives the message data from the second ring buffer module through the system bus; the first control module controls the message data to be sent to the first flash memory so that the first processor obtains the message data from the first flash memory. Specifically, after the first ring buffer module receives the read data from the second ring buffer module through the system bus and stores it in the read data buffer unit of the first ring buffer module, the first control module controls the read data to be sent to the first flash memory so that the first processor obtains the read data from the first flash memory, thereby realizing the operation of the master chip reading the read data from the slave chip.
[0068] In other embodiments, the first ring buffer module receives message data from the second ring buffer module via the system bus so that the first processor acquires the message data. The step may include: the first ring buffer module receives message data from the second ring buffer module via the system bus; the first processor receives message data from the first ring buffer module via the internal bus. Specifically, after the first ring buffer module receives write data from the second ring buffer module via the system bus and stores it in the write data buffer unit of the first ring buffer module, the first control module sends a "read read data" message to the first processor, and the first processor receives read data from the first ring buffer module via the internal bus, thereby realizing the operation of the master chip reading read data from the slave chip.
[0069] In the above manner, the present invention realizes the transmission of read data between the master and slave chips through the control module and the ring buffer module in the communication interface, which greatly reduces the occupancy rate of the processors in the master and slave chips and improves the efficiency of the master chip reading read data from the slave chip.
[0070] The above are only implementation modes of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A communication method, applied to a first chip and a second chip, characterized in that: The first chip includes a first processor, a first communication interface and a first flash memory connected in pairs, the second chip includes a second processor, a second communication interface and a second flash memory connected in pairs, the first communication interface includes a first control module, a first ring buffer module and a first bus interface, the second communication interface includes a second control module, a second ring buffer module and a second bus interface, and the first bus interface of the first communication interface is connected to the second bus interface of the second communication interface through a system bus; The method comprises: The first control module acquires message data from the first flash memory, wherein the message data includes read data and write data; The first control module controls the message data to be written into the first ring buffer module, and controls the message data to be sent from the first ring buffer module to the second ring buffer module through the system bus; The second ring buffer module receives the message data from the first ring buffer module through the system bus, so that the second processor obtains the message data.
2. The communication method according to claim 1, characterized in that: The step of the second ring buffer module receiving the message data from the first ring buffer module via the system bus so that the second processor acquires the message data comprises: The second ring buffer module receives the message data from the first ring buffer module via the system bus; The second control module controls the message data to be sent to the second flash memory, so that the second processor obtains the message data from the second flash memory.
3. The communication method according to claim 1, characterized in that: The step of the second ring buffer module receiving the message data from the first ring buffer module via the system bus so that the second processor acquires the message data comprises: The second processor receives the message data from the second ring buffer module through an internal bus.
4. The communication method according to claim 1, characterized in that: When the first chip is a master chip and the second chip is a slave chip, the message data is write data stored in the first flash memory and written by the master chip into the slave chip.
5. The communication method according to claim 4, characterized in that: The steps of the first control module controlling the message data to be written into the first ring buffer module, and controlling the message data to be sent from the first ring buffer module to the second ring buffer module through the system bus include: The first control module obtains the data volume of the message data according to the write address pointer corresponding to the message data stored in the first ring buffer module; The first control module obtains the available space of the second ring buffer module according to the write address pointer in the second ring buffer module; The first control module compares the data volume of the message data with the available space of the second ring buffer module; If the comparison result is that the data amount is less than the available space of the second ring buffer module, the first control module controls all the message data to be written into the available space of the second ring buffer module; If the comparison result is that the data volume is larger than the available space of the second ring buffer module, the first control module controls part of the message data to be written into the available space of the second ring buffer module according to the size of the available space of the second ring buffer module.
6. The communication method according to claim 1, characterized in that: When the first chip is a slave chip and the second chip is a master chip, the message data is read data stored in the second flash memory and read by the master chip from the slave chip.
7. The communication method according to claim 6, characterized in that: The steps of the first control module controlling the message data to be written into the second ring buffer module, and controlling the message data to be sent from the first ring buffer module to the second ring buffer module via the system bus include: The first control module obtains a read address pointer corresponding to the message data stored in the first ring buffer module, and obtains a data volume of the message data according to the read address pointer; The first control module obtains the available space of the second ring buffer module according to the read address pointer in the second ring buffer module; If the comparison result is that the data amount is less than the available space of the second ring buffer module, the first control module controls all the message data to be sent to the available space of the second ring buffer module; If the comparison result is that the data volume is larger than the available space of the second ring buffer module, the first control module controls part of the message data to be sent to the available space of the second ring buffer module according to the size of the available space of the second ring buffer module.
Citation Information
Patent Citations
Communication system
CN209514612U
