Industrial Ethernet data transmission method and FPGA

FPGA receives and stores Ethernet frames, and sends data to the processor under certain conditions, which solves the problem of large processor processing capacity and improves data transmission efficiency.

CN118502323BActive Publication Date: 2024-10-11BEIJING CONSEN AUTOMATION CONTROL
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410953864.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-16
Publication Date
2024-10-11
Estimated Expiration
2044-07-16

AI Technical Summary

Technical Problem

In the industrial field, the processor has a large processing capacity when implementing data transmission between the physical layer chip and the processor, resulting in low efficiency.

Method used

Receive Ethernet frames sent by the physical layer chip through the FPGA, store and write the target data into the memory when certain conditions are met, and then send it to the processor as an endpoint device, reducing the processor's active access time and processing volume.

Benefits of technology

It effectively reduces the processor's processing load and data transmission delay, delays the processor's processing time of Ethernet frames, and improves data transmission efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118502323B_ABST
    Figure CN118502323B_ABST
Patent Text Reader

Abstract

The present application discloses an industrial Ethernet data transmission method and FPGA, belonging to the field of industrial communications. The method comprises: a field programmable gate array FPGA receives an Ethernet frame sent by a physical layer chip; the FPGA obtains target data to be written into a memory based on the Ethernet frame; the FPGA writes the target data into the memory; when the target condition is met, the FPGA reads the target data from the memory; the FPGA, as an endpoint device, sends the target data to a processor, and the target data is used for processing by the processor.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of industrial communications, and specifically relates to an industrial Ethernet data transmission method and FPGA. Background Art

[0002] In the industrial field, Ethernet has been widely used due to its versatility, high-efficiency and security of transmission, and long transmission distance. Especially in distributed control systems (DCS), Ethernet is more widely used, and in DCS systems, multiple Ethernet interface scenarios are the main ones. Therefore, the transmission and processing technology of Ethernet data is a topic worthy of attention.

[0003] When the related technology realizes data transmission between the physical layer chip interface and the processor, there is a problem of large processor processing load. Summary of the invention

[0004] The embodiments of the present application provide an industrial Ethernet data transmission method and FPGA, which can solve the problem of large processing load of the processor in the related technology.

[0005] In a first aspect, an embodiment of the present application provides a method for transmitting industrial Ethernet data, including:

[0006] The Field-Programmable Gate Array (FPGA) receives the Ethernet frames sent by the physical layer chip;

[0007] The FPGA acquires target data to be written into a memory based on the Ethernet frame;

[0008] The FPGA writes the target data into the memory;

[0009] When the target condition is met, the FPGA reads the target data from the memory;

[0010] The FPGA acts as an endpoint device to send the target data to the processor, and the target data is used for processing by the processor.

[0011] In a second aspect, an embodiment of the present application further provides an FPGA, including:

[0012] A receiving module, used for receiving Ethernet frames sent by the physical layer chip;

[0013] An acquisition module, used for acquiring target data to be written into a memory based on the Ethernet frame;

[0014] A writing module, used for writing the target data into the memory;

[0015] A reading module, configured to read the target data from the memory when a target condition is met;

[0016] The sending module is used to use the FPGA as an endpoint device to send the target data to the processor, and the target data is used for processing by the processor.

[0017] In a third aspect, an embodiment of the present application provides a computer-readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed, the steps of the method described in the first aspect are implemented.

[0018] In a fourth aspect, an embodiment of the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the steps of the method described in the first aspect.

[0019] In a fifth aspect, an embodiment of the present application provides a distributed control system controller, which includes a physical layer chip, a processor and the FPGA described in the second aspect; wherein the physical layer chip and the FPGA are communicatively connected, and the FPGA and the processor are communicatively connected.

[0020] At least one of the above technical solutions provided in the embodiments of the present application can achieve the following technical effects:

[0021] In an embodiment of the present application, an FPGA receives an Ethernet frame sent by a physical layer chip; the FPGA obtains target data to be written into a memory based on the Ethernet frame; the FPGA writes the target data into the memory; when the target condition is met, the FPGA reads the target data from the memory; the FPGA sends the target data to the processor as an endpoint device, and the target data is used for processing by the processor. In this way, when data is transmitted between the physical layer chip and the processor, the FPGA can receive the Ethernet frame sent by the physical layer chip and store the Ethernet data frame. When the target condition is met, the FPGA reads the target data from the memory and sends the target data to the processor as an endpoint device, so that the processor obtains the target data and processes it. In this way, the FPGA can actively send the target data to the processor as an endpoint device, which can reduce the time of active access by the processor and the processing amount of the processor. In addition, when the physical layer chip transmits the Ethernet frame, it can be stored through the memory. The Ethernet frame will be sent to the processor only when the condition is met, which can delay the processing time of the processor for the Ethernet frame, and to a certain extent, it can reduce the processing amount of the processor, and solve the problem of large processing amount of the processor in the related technology. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0023] Figure 1 It is a flow chart of a method for transmitting industrial Ethernet data provided by an embodiment of the present application;

[0024] Figure 2 It is a schematic diagram of the overall concept of an industrial Ethernet data transmission method provided in an embodiment of the present application;

[0025] Figure 3 is a schematic diagram of an interface conversion process provided by an embodiment of the present application;

[0026] Figure 4 is a flow chart of another industrial Ethernet data transmission method provided by an embodiment of the present application;

[0027] Figure 5 is a schematic diagram of a corresponding relationship between a marking storage space and a memory provided in an embodiment of the present application;

[0028] Figure 6 It is a schematic diagram of an industrial Ethernet data transmission method provided by an embodiment of the present application;

[0029] Figure 7 is a schematic diagram of a write time slot control module provided in an embodiment of the present application;

[0030] Figure 8 is a flow chart of another industrial Ethernet data transmission method provided by an embodiment of the present application;

[0031] Fig. 9 It is a schematic diagram of a peripheral component interconnect express (PCIe) transmission time slot control module provided in an embodiment of the present application;

[0032] Fig.10 is a schematic diagram of a PCIe sending module provided in an embodiment of the present application;

[0033] Fig.11 This is a complete flow chart of an industrial Ethernet data transmission method provided by an embodiment of the present application;

[0034] Fig.12It is a structural block diagram of an FPGA provided in an embodiment of the present application;

[0035] Fig.13 This is a structural block diagram of a distributed control system controller provided in an embodiment of the present application. DETAILED DESCRIPTION

[0036] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0037] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0038] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. 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.

[0039] The industrial Ethernet data transmission method provided in the embodiment of the present application is applied to data transmission, and in particular, can be applied to industrial Ethernet data transmission, and in particular, can be applied to data transmission between a processor and a physical layer chip interface in a multi-Ethernet scenario.

[0040] The industrial Ethernet data transmission method provided in the embodiment of the present application can be executed by a target device having an FPGA, wherein the target device can be an electronic device. Specifically, it can be executed by software or hardware installed on the electronic device. The electronic device can be, for example, a terminal device such as a desktop computer, a mobile phone, a laptop computer, a tablet computer, or a server.

[0041] The embodiments of the present application may adopt various processors, including but not limited to domestically developed processors (such as Loongson 2K1000 series processors), which may be used as core processors for business processing.

[0042] The following is a detailed description of the industrial Ethernet data transmission method provided by the embodiment of the present application through specific embodiments and their application scenarios in conjunction with the accompanying drawings.

[0043] See also Figure 1 and Figure 2 , Figure 1 is a flow chart of an industrial Ethernet data transmission method provided in an embodiment of the present application, Figure 2 Schematic diagram of the overall concept of an industrial Ethernet data transmission method provided by an embodiment of the present application. Figure 1 As shown, the method comprises the following steps:

[0044] Step 110: The FPGA receives the Ethernet frame sent by the physical layer chip.

[0045] In the embodiments of this application, please refer to Figure 2 , the physical layer chip may include multiple physical layer chips, and there is no limit on the number of physical layer chips, Figure 2 The eight physical layer chips are only examples. When the physical layer chip has an Ethernet frame to send to the processor, the physical layer chip can first send the Ethernet frame to the FPGA, the FPGA processes the Ethernet frame, and then the FPGA sends the Ethernet frame to the processor.

[0046] Step 120: The FPGA obtains target data to be written into the memory based on the Ethernet frame.

[0047] In the embodiment of the present application, since there are multiple physical layer chips sending Ethernet frames to the FPGA at the same time, the Ethernet frames transmitted by the physical layer chips can be first stored in the memory so that the FPGA can read them from the memory in sequence for subsequent processing.

[0048] In the embodiment of the present application, the memory may be a memory inside the FPGA, or a memory outside the FPGA (such as Figure 2As shown). The memory may include a third generation double-data-rate synchronous dynamic random access memory (Double-Data-Rate Three Synchronous Dynamic Random Access Memory, DDR3) and a static random access memory (Static Random Access Memory, SRAM) and other memories. Considering that the number of Ethernet jumbo frames and physical layer chips may be large, a large-capacity DDR3 may be selected as the memory.

[0049] In one embodiment of the present application, in step 120, the FPGA obtains the target data to be written to the memory based on the Ethernet frame, including: the FPGA obtains the data to be stored based on the Ethernet frame; the FPGA sends the data to be stored to an internal receiving buffer for caching; the FPGA obtains the target data to be written to the memory from the receiving buffer when specified conditions are met; wherein the memory is a memory located outside the FPGA.

[0050] In the embodiment of the present application, when the memory is located outside the FPGA, since the FPGA can only store one Ethernet frame of the physical layer chip into the memory at a time, the data to be stored can be first stored in the buffer for subsequent storage. Specifically, one physical layer chip can correspond to one receiving buffer, and the receiving buffer can be used to store the Ethernet frames transmitted by the physical layer chip.

[0051] At the same time, in order to effectively manage the storage of Ethernet frames transmitted by the physical layer chip, when the FPGA meets specified conditions, the FPGA can obtain the Ethernet frames sent by a physical layer chip from the receiving buffer corresponding to the physical layer chip. The specified conditions can be that the FPGA allocates a time slot to the physical layer chip, and the time slot is used by the FPGA to obtain the target data to be written to the memory from the receiving buffer and write the target data into the memory.

[0052] Since the memory is located outside the FPGA, in order to implement the read and write operations of the memory, the FPGA may include a memory controller inside, and the memory controller can be used to control the read and write operations of the memory outside the FPGA.

[0053] In addition, the rate requirements of physical layer chip interfaces of different interface types are also different. The embodiment of the present application can be applied to Ethernet data transmission processing in a multi-Ethernet interface scenario. In order to implement Ethernet interfaces of different interface types, the interface type of the physical layer chip interface can be uniformly converted. Specifically, the following method can be referred to.

[0054] Exemplarily, in one embodiment of the present application, the FPGA obtains the data to be stored based on the Ethernet frame, including: the FPGA performs interface conversion processing on the Ethernet frame to obtain first processed data adapted to the target logical interface; the FPGA performs a cyclic redundancy check on the first processed data to obtain second processed data with correct verification, and uses the second processed data as the data to be stored.

[0055] In the embodiments of the present application, Figure 2 As shown, the interface types of different physical layer chips may include Media Independent Interface (MII), Reduced Media Independent Interface (RMII), Gigabit Media Independent Interface (GMII), Reduced Gigabit Media Independent Interface (RGMII) and Serial Gigabit Media Independent Interface (SGMII).

[0056] Please refer to Figure 3 , Figure 3 1 is a schematic diagram of an interface conversion process provided by an embodiment of the present application. The Ethernet frame transmitted by the physical layer chip can be subjected to interface conversion processing by the MAC_RX module. Specifically, the physical layer chip interface is uniformly converted into a target logical interface by the interface conversion module in the MAC_RX module. The target logical interface can be a GMII interface (the GMII interface data bit width is 8 bits, which is more suitable).

[0057] In addition, since the Ethernet frame transmitted by the physical layer chip may be an erroneous data frame, transmitting the erroneous data frame to the processor for processing will increase the processing overhead of the processor. Therefore, a cyclic redundancy check (CRC) may be performed on the Ethernet frame. Figure 3 As shown, after the interface conversion module performs interface conversion processing on the Ethernet frame and obtains the first processed data adapted to the target logical interface, the first processed data can be subjected to CRC verification. If the CRC verification is correct, the second processed data with the correct verification is obtained, and the second processed data with the correct verification can be determined as the target data, and the target data can be stored in the receiving buffer corresponding to the physical layer chip (such as Figure 3In the case of a CRC check error, the entire Ethernet frame data may be discarded to prevent the processor from processing the erroneous Ethernet frame and reduce the processing overhead of the processor.

[0058] Step 130: The FPGA writes the target data into the memory.

[0059] In the embodiment of the present application, when the memory is a memory inside the FPGA, the target data can be directly written into the memory inside the FPGA. When the memory is a memory outside the FPGA, the FPGA can include a memory controller inside, and the target data can be written into the memory through the memory controller inside the FPGA.

[0060] Step 140: When the target condition is met, the FPGA reads the target data from the memory.

[0061] In an embodiment of the present application, the target condition may include that readable target data is stored in the memory. When the target condition is met, the FPGA may read the target data from the memory and send the target data to the processor.

[0062] Step 150: The FPGA, as an endpoint device, sends the target data to the processor, and the target data is used for processing by the processor.

[0063] In an embodiment of the present application, the processor may include a Loongson processor. After the FPGA acquires the target data, it may determine whether to unpack the target data according to the length of the target data. If the length of the target data is long (for example, 9K), the target data may be split into several packets of data, and the data packet may be in the form of a write transaction layer packet (Transaction Layer Packet, TLP) message, and the address used for writing the TLP message may be the address in the address register inside the FPGA. The FPGA transmits a write TLP message to the processor each time, and after the target data transmission is completed, the processor may read the target data to the network protocol stack for processing.

[0064] like Figure 2 As shown, after the processor obtains the target data, it can process the data through the human-computer interaction page. In addition, the data uses dual Ethernet for redundant communication. The two Ethernets transmit the same data. The application layer can select one of the data as the calculation data according to the network conditions. Redundant transmission has the advantages of low failure probability and stable data transmission.

[0065] In one embodiment of the present application, after the FPGA sends the target data to the processor as an endpoint device, the method further includes: the FPGA sends an interrupt to the processor; the FPGA stops sending interrupts to the processor after receiving target information sent by the processor in response to the interrupt; the FPGA updates the value of the internal address register based on the target information for subsequent data transmission.

[0066] In an embodiment of the present application, after the FPGA sends a write TLP message to the processor, the FPGA may send an interrupt to the processor, such as an interrupt response (INTA). When the processor receives the write TLP message, the processor responds to the interrupt sent by the FPGA and sends target information to the FPGA, and the target information may be in the form of a message. After receiving the target information, the FPGA stops sending interrupts to the processor, clears the interrupt request in the FPGA interrupt register according to the target information, and updates the address information in the address register inside the FPGA so that it can be used the next time the FPGA transmits data to the processor.

[0067] In an embodiment of the present application, an FPGA receives an Ethernet frame sent by a physical layer chip; the FPGA obtains target data to be written into a memory based on the Ethernet frame; the FPGA writes the target data into the memory; when the target condition is met, the FPGA reads the target data from the memory; the FPGA sends the target data to the processor as an endpoint device, and the target data is used for processing by the processor. In this way, when data is transmitted between the physical layer chip and the processor, the FPGA can receive the Ethernet frame sent by the physical layer chip and store the Ethernet data frame. When the target condition is met, the FPGA reads the target data from the memory and sends the target data to the processor as an endpoint device, so that the processor obtains the target data and processes it. In this way, the FPGA can actively send the target data to the processor as an endpoint device, which can reduce the time of active access by the processor and the processing amount of the processor. In addition, when the physical layer chip transmits the Ethernet frame, it can be stored through the memory. The Ethernet frame will be sent to the processor only when the condition is met, which can delay the processing time of the processor for the Ethernet frame, and to a certain extent, it can reduce the processing amount of the processor, and solve the problem of large processing amount of the processor in the related technology.

[0068] See also Figure 4 , Figure 4 FIG. 1 is a flow chart of another method for transmitting industrial Ethernet data provided by an embodiment of the present application. Figure 4 As shown, the method comprises the following steps:

[0069] Step 410: The FPGA receives the Ethernet frame sent by the physical layer chip; the FPGA includes a tag storage space.

[0070] In the embodiment of the present application, the tag storage space is used to mark the validity of the read and write operations of the memory, and the memory is a memory outside the FPGA. It should be noted that there is no restriction on the tag form of the tag storage space, and the tag form may include a 0-1 tag form and an Ethernet frame length tag form.

[0071] Step 420: The FPGA obtains the data to be stored based on the Ethernet frame.

[0072] Step 430: The FPGA sends the data to be stored to an internal receiving buffer for caching; the receiving buffer includes a data buffer and a length buffer, the data buffer is used to cache the data to be stored, and the length buffer is used to store the length of the data to be stored cached in the data buffer.

[0073] In the embodiments of the present application, Figure 3 As shown, the receiving buffer may be Figure 3 The receiving buffer may include a data buffer (data FIFO) for caching the data to be stored, and a length buffer (length FIFO) for caching the length of the data to be stored. After acquiring the data to be stored, the data to be stored may be cached in the data buffer, and the length of the data to be stored may be cached in the length buffer.

[0074] Step 440: When the length buffer is not empty and the value of the target address in the tag storage space indicates that the memory is writable, the FPGA obtains the target data to be written to the memory from the data buffer; wherein the memory is a memory located outside the FPGA, and there is a one-to-one correspondence between the address in the tag storage space and the address in the memory; and the target address corresponds to the address to be written in the memory.

[0075] In the embodiments of this application, please refer to Figure 5 , Figure 5 Schematic diagram of a corresponding relationship between a tag storage space and a memory provided in an embodiment of the present application. Figure 5 As shown, there is a one-to-one correspondence between the address RAM in the tag storage space and the address in the memory. For example, the RAM address of the frame length data 0 in the tag storage space corresponds to the address of the frame data 0 in the memory, and the frame length data 0 is the length data of the frame data 0.

[0076] Considering the need to store giant frames (such as 9K bytes) in the memory, the address of the memory can be divided into 10K bytes, and every 10K bytes is used as the starting address of a frame data. Figure 5 As shown, the address of the first frame data 0 is 0, the address of the second frame data 1 is 0+1×0x2800 (10K), and so on, the address of the n+1th frame data n is 0+n×0x2800 (10nK).

[0077] Correspondingly, the address in the tag storage space corresponds to the address in the memory. Since the tag storage space is used to store tags (such as 0-1 tags or length tags), and the storage space required to store tags is small, continuous addresses can be directly selected as the storage addresses of frame length data. Figure 5 As shown, the RAM addresses of the frame length data 0 and the frame length data 1 are continuous.

[0078] In the embodiment of the present application, the address in the memory may correspond to the physical layer chip (for example Figure 5 A row in the memory in may correspond to a physical layer chip). When the length buffer corresponding to a physical layer chip is not 0, it indicates that the Ethernet frame sent by the physical layer chip needs to be stored in the memory. At this time, it can be detected whether the address corresponding to the physical layer chip in the memory is empty. When the address corresponding to the physical layer chip in the memory is empty (the address can be written), the Ethernet frame sent by the physical layer chip is stored.

[0079] The memory is located outside the FPGA. In order to more conveniently obtain whether the address to be written in the memory can be written, the value of the target address in the tag storage space can be obtained, and the target address corresponds to the address to be written in the memory. In other words, when the length buffer corresponding to a physical layer chip is not empty (the physical layer chip has Ethernet frames that need to be stored), and the value of the target address in the tag storage space indicates that the memory can be written, the target data is obtained from the data buffer and written into the memory.

[0080] Since the length buffers corresponding to multiple physical layer chips are not empty, only one channel of data can be written to the memory at a time. Therefore, in order to effectively manage data storage, multiple physical layer chips can be polled by using a time slot allocation mechanism. For details, refer to the following method:

[0081] In one embodiment of the present application, the FPGA includes a write time slot control module and a write control module; the FPGA obtains the target data to be written to the memory from the data buffer when the length buffer is not empty and the value of the target address in the tag storage space indicates that the memory is writable, including: the write time slot control module sends a write request signal and a data length value to the write control module when the Ethernet port time slot detects that the length buffer is not empty; the write control module reads the value of the target address in the tag storage space in response to the write request signal; when the value of the target address in the tag storage space indicates that the memory is writable, the write control module obtains the verified target data from the receive buffer; wherein the length of the verified target data is the same as the data length value.

[0082] In the embodiments of this application, please refer to Figure 6 and Figure 7 , Figure 6 is a schematic diagram of an industrial Ethernet data transmission method provided in an embodiment of the present application, Figure 7 Schematic diagram of a write time slot control module provided in an embodiment of the present application. The physical layer chip may include N, where N is a positive integer. Figure 6 The two physical layer chips are shown for example only, and there is no limit on the number of physical layer chips. Figure 6 The PCIe controller in the device is used to control the execution of the entire Ethernet data transmission method. Figure 7 As shown, the order in which the FPGA processes the N physical layer chips can be preset, and the write time slot control module 620 can poll the receiving buffers (RxFIFO) corresponding to the N physical layer chips according to the order to store the Ethernet frames sent by the N physical layer chips.

[0083] Specifically, the processing of a physical layer chip is used as an example for explanation. When the write time slot control module 620 polls the receiving buffer corresponding to the physical layer chip, an Ethernet port time slot is allocated to the receiving buffer, and the Ethernet port time slot is used by the FPGA to store the data frame in the receiving buffer into the memory. Figure 7 As shown, during the Ethernet port time slot, it is detected whether the length buffer (length FIFO) in the receiving buffer is empty.

[0084] When the length FIFO is not empty (i.e., there is a data frame to be written in the physical layer chip), the value of the data length is read from the length buffer. At the same time, the write time slot control module 620 sends a write request signal and a data length value to the write control module 630, and the write request signal includes the address to be written. When the write control module 630 detects a write request signal, it determines the target address in the tag storage space 610 corresponding to the address to be written according to the address to be written, and reads the value of the target address in the tag storage space 610. When the value indicates that the address to be written in the memory can be written with data, the FPGA starts the memory write mechanism and writes the data of the corresponding length in the data FIFO of the receive buffer RxFIFO to the memory through the memory controller. When the value indicates that the address to be written in the memory cannot be written with data, it can wait until the value indicates that the address to be written in the memory can be written with data.

[0085] like Figure 7 As shown, when the length FIFO is empty (ie, there is no data frame to be written into the physical layer chip), the Ethernet port time slot can be directly ended and the next Ethernet port time slot can be entered.

[0086] Step 450: The FPGA writes the target data into the memory;

[0087] In one embodiment of the present application, after the FPGA writes the target data into the memory, the method further includes: writing the data length value into the target address in the tag storage space.

[0088] In the embodiment of the present application, the target data can be directly marked by the data length value. When the FPGA detects that the value of the target address in the tag storage space is 0, it means that the data length value stored at the address corresponding to the target address in the memory is 0, and data can be written. When the FPGA detects that the value of the target address in the tag storage space is not 0, it means that the data length value stored at the address corresponding to the target address in the memory is not 0, and data cannot be written.

[0089] In the embodiment of the present application, after the FPGA writes the target data into the memory, the tag storage space can be updated synchronously, that is, the data length value of the target data is written into the target address in the tag storage space. Specifically, Figure 6As shown, the write time slot control module 620 sends a write request signal and a data length value to the write control module 630. After the write control module 630 completes writing of the target data in response to the write request signal, the data length value is written into the target address in the tag storage space 610. At the same time, the write control module 630 sends a completion signal to the write time slot control module 620. After the write time slot control module 620 receives the completion signal, the write time slot control module 620 enters the next Ethernet port time slot.

[0090] Step 460: When the target condition is met, the FPGA reads the target data from the memory.

[0091] In one embodiment of the present application, the target condition includes that the target address in the tag storage space is not 0. After the FPGA reads the target data from the memory in step 450, the method further includes: storing the target data in a data cache in the FPGA; and the target data sent to the processor is obtained from the data cache.

[0092] In the embodiment of the present application, since the FPGA also has register read and write operations, data is also sent to the processor when the register write operation is completed. Therefore, in order to effectively manage data transmission, after reading the target data from the memory, the target data can be stored in the data cache (such as Figure 6 In the data cache in the embodiment, the data cache is a data cache memory, and the data cache includes a data FIFO and a length FIFO.

[0093] At the same time, since the memory can store multiple data frames, in order to read data from the memory in order, the data can be read from the memory in sequence according to the address sequence in the tag storage space. The following will take the reading of data in the memory as an example for explanation.

[0094] like Figure 6 As shown, the read control module 640 can read the value of the corresponding address in the tag storage space 610 in sequence according to the RAM address sequence. If the value is 0, wait until the value is not 0. If the value is not 0, read the data from the corresponding address in the memory and store it in the data FIFO of the data cache, and then detect the data in the next RAM address of the tag storage space 610.

[0095] In one embodiment of the present application, the target condition includes that the target address in the tag storage space is not 0, and the method further includes: after the target data is read, clearing the value of the target address in the tag storage space.

[0096] In the embodiment of the present application, after the target data is read from the memory, the target data can be deleted from the memory. At the same time, in order to ensure the validity of the tag, the tag storage space can be updated synchronously, and the value of the target address in the tag storage space can be cleared to zero for subsequent use.

[0097] Step 470: The FPGA, as an endpoint device, sends the target data to the processor, and the target data is used for processing by the processor.

[0098] In the embodiment of the present application, the data sent by the FPGA to the processor may include not only the data frame transmitted by the physical layer chip, but also the data of the register in the FPGA. The following will specifically describe the sending and transmission process of the register data in the FPGA.

[0099] like Figure 6 As shown, the FPGA may include a register module 670 and a PCIe receiving module 690. When the PCIe receiving module 690 receives a memory read request (MRD) message transmitted via PCIe, the PCIe receiving module 690 performs message parsing on the MRD message to obtain address information in the MRD message. The PCIe receiving module 690 determines whether it is a register operation based on the address information. Specifically, it can determine whether it is a register operation by determining whether the address information in the MRD message corresponds to the register address space allocated in the FPGA. In the case of determining that the MRD message is a register operation, the register module 670 takes out the data in the register based on the address information, and sends a register write request signal, data, and required PCIe information to the PCIe sending slot control module.

[0100] When the PCIe receiving module 690 receives a memory write request (MWR) message transmitted by PCIe, the PCIe receiving module 690 performs message parsing on the MWR message to obtain the data and address information in the MWR message. The PCIe receiving module 690 determines whether it is a register operation based on the address information. Specifically, it can be determined whether it is a register operation by determining whether the address information in the MWR message corresponds to the register address space allocated in the FPGA. When it is determined that the MWR message is a register operation, the data is updated to the register of the corresponding address.

[0101] Since the data transmitted by the physical layer chip in the FPGA is sent to the processor, and the register data in the FPGA is sent to the processor, in order to realize the management of data transmission, it can be achieved through a time slot allocation mechanism, which can be seen in the following method for details.

[0102] In one embodiment of the present application, the FPGA includes a PCIe transmit time slot control module and a PCIe transmit module; the data cache includes a data buffer for storing the target data and a length buffer for storing the length of the target data; the FPGA sends the target data to the processor as an endpoint device, including: the PCIe transmit time slot control module detects whether the length buffer of the data cache is empty during the data transmit time slot; when the length buffer is not empty, the PCIe transmit time slot control module sends a data request signal to the PCIe transmit module; the PCIe transmit module obtains the target data from the data buffer of the data cache in response to the data request signal, and sends the target data to the processor.

[0103] In the embodiment of the present application, the processing order of register write request and data write request of data cache can be preset, for example, PCIe send time slot control module 650 first detects whether there is a register write request, and when a register write request is detected, a register request time slot is allocated for the register write request, and the register request time slot is used to write register data into the processor. Then, it is detected whether there is a data write request of data cache, and after the data write request of data cache is detected, a data cache write time slot is allocated for the data write request, and the data cache write time slot is used to write the data of data cache into the processor.

[0104] Specifically, Figure 6 As shown, in the register request time slot, the PCIe transmission time slot control module 650 receives the register write request signal, data and required PCIe information sent by the register module 670. The PCIe transmission time slot control module 650 sends the register write request signal, data and required PCIe information to the PCIe transmission module 660, and the PCIe transmission module 660 generates a corresponding completion (Completion with data, cpld) message carrying data based on the register write request signal, data and required PCIe information. The PCIe transmission module 660 sends the cpld message to the processor, and the cpld message is used to update the value of the corresponding space in the processor.

[0105] In the data cache write time slot, the PCIe transmit time slot control module 650 detects whether the length FIFO of the data cache is empty during the data cache write time slot. If the length FIFO of the data cache is not empty (that is, there is readable data in the data cache), the PCIe transmit time slot control module 650 reads the data stored in the data cache and sends a data request signal to the PCIe transmit module 660, and the data request signal includes the target data in the data cache and the data length value of the target data. After receiving the data request signal sent by the PCIe transmit time slot control module 650, the PCIe transmit module 660 generates one or more write TLP messages according to the target data and the data length value of the target data, and sends the TLP message to the processor. The PCIe transmit time slot control module 650 waits for the PCIe transmit module 660 to send a completion signal, and the completion signal is used to indicate that all write TLP message transmissions are completed, and then jumps to the register request time slot.

[0106] In one embodiment of the present application, after the FPGA sends the read target data to the processor as an endpoint device, the method further includes: the FPGA sends an interrupt to the processor; the FPGA stops sending interrupts to the processor after receiving target information sent by the processor in response to the interrupt; the FPGA updates the value of the internal address register based on the target information for subsequent data transmission.

[0107] In an embodiment of the present application, the validity of data in the memory is marked by marking the storage space, the RAM address of the marked storage space is effectively combined with the memory storage space address, and there is a one-to-one correspondence between the RAM address of the marked storage space and the memory storage space address, which can effectively control the reading and writing data operations of the memory.

[0108] The present application embodiment provides a method for a processor to transmit data to a physical layer chip, see Figure 8 , Figure 8 FIG. 1 is a flow chart of another method for transmitting industrial Ethernet data provided by an embodiment of the present application. Figure 8 As shown, the method comprises the following steps:

[0109] Step 810: FPGA receives the Ethernet frame sent by the physical layer chip.

[0110] Step 820: The FPGA obtains target data to be written into the memory based on the Ethernet frame.

[0111] Step 830: The FPGA writes the target data into the memory.

[0112] Step 840: When the target condition is met, the FPGA reads the target data from the memory.

[0113] Step 850: The FPGA, as an endpoint device, sends the target data to the processor, and the target data is used for processing by the processor.

[0114] Step 860: When the first condition is met, the FPGA, as an endpoint device, sends a data acquisition request to the processor.

[0115] In an embodiment of the present application, the first condition includes that the FPGA detects that the processor has data to send. Specifically, when the processor has data to send, the processor may send a message to the FPGA. When the FPGA receives the message, based on the message, the FPGA sends a data acquisition request to the processor.

[0116] Exemplarily, in one embodiment of the present application, the first condition includes: the register module within the FPGA has data updated; the FPGA includes a register module, a peripheral component interconnect express (PCIe) data request module, a peripheral component interconnect express (PCIe) send time slot control module and a peripheral component interconnect express (PCIe) send module; before the FPGA sends a data acquisition request to the processor, the method also includes: when the register module within the FPGA has data updated, the register module sends data length information and a base address where the data is stored in the processor to the PCIe data request module; after the PCIe data request module obtains the time slot allocated by the PCIe send time slot control module, the PCIe send module transmits the data length information and the base address to the PCIe send module via the PCIe send time slot control module; the PCIe send module generates a data acquisition request based on the data length information and the base address.

[0117] In the embodiments of the present application, Figure 6 As shown, when the processor has Ethernet data to send, a message is generated based on the data length information to be sent and the base address where the data is stored in the processor. The processor sends the message to the FPGA. After receiving the message, the PCIe receiving module 690 performs message parsing on the message to obtain the data length information and the base address where the data is stored in the processor. At this time, the PCIe receiving module 690 detects that there is base address information in the message, determines that the message is a register write operation, and writes the data length information and the base address where the data is stored in the processor to the corresponding registers (data length register and data storage base address register) through PCIe.

[0118] When the register module 670 detects that the data length register and the data storage base address register have data updated, it sends a request signal, data length information and the base address where the data is stored in the processor to the PCIe data request module 680. After receiving the sending request signal, the PCIe data request module 680 sends the sending request signal to the PCIe sending time slot control module 650.

[0119] Please refer to Fig. 9 , Fig. 9 Schematic diagram of a PCIe transmit time slot control module provided in an embodiment of the present application. The PCIe transmit time slot control module can obtain a register write request signal sent by the register module 670, a request signal sent by the PCIe data request module 680, and a data request signal sent by the data cache (such as Fig. 9 The processing order of the above three signals can be pre-set, such as Fig. 9 As described above, a time slot may be allocated first for the register write request signal sent by the register module 670, then a time slot may be allocated for the request signal sent by the PCIe data request module 680, and finally a time slot may be allocated for the data request signal sent by the data cache. It should be noted that Fig. 9 The processing order is only an example and is not actually dependent on Fig. 9 processing order.

[0120] After the PCIe data request module 680 obtains the time slot allocated by the PCIe transmission time slot control module, the PCIe transmission time slot control module 650 sends the data length information and the base address where the data is stored in the processor to the PCIe transmission module 660. After receiving the data length information and the base address where the data is stored in the processor, the PCIe transmission module 660 may generate a data acquisition request based on the data length information and the base address where the data is stored in the processor, and the data acquisition request may include one or more frames of TLP read messages.

[0121] In fact, refer to Fig.10 , Fig.10 Schematic diagram of a PCIe transmission module provided in an embodiment of the present application. The PCIe transmission module receives the request signal type of the PCIe transmission time slot control module (including the register write request signal sent by the register module, the request signal sent by the PCIe data request module, and the data request signal sent by the data cache), generates a corresponding PCIe message, and sends the message to the processor. Fig.10 As shown, when the PCIe transmission module is idle, it can receive a request signal sent by the PCIe transmission time slot control module. According to the type of the request signal, when the type of the request signal is a register write request signal sent by the register module (i.e. Fig.10 When the type of the request signal is a request signal sent by the PCIe data request module (i.e. Fig.10 In the read data request, it can be determined whether to unpack the data according to the data length, and wait for all data packets to be transmitted. Fig.10 The write data request in the data packet can determine whether to unpack the data according to the data length and wait for all data packets to be transmitted.

[0122] Step 870: The FPGA receives the first data sent by the processor in response to the data acquisition request.

[0123] In an embodiment of the present application, the data acquisition request may include one or more frames of TLP read messages. After receiving the TLP read message, the processor may read the corresponding first data based on the TLP read message and send the first data to the FPGA.

[0124] Specifically, in one embodiment of the present application, the FPGA also includes: a PCIe receiving module, a sending buffer and a media access control (MAC) sending module; after the FPGA receives the first data sent by the processor in response to the data acquisition request, the method also includes: the PCIe receiving module transmits the first data to the sending buffer; the sending buffer includes a data buffer for storing the first data and a length buffer for storing the length of the first data after the first data is transmitted; the MAC sending module obtains the first data when it detects that the length buffer in the sending buffer is not empty.

[0125] In the embodiments of the present application, Figure 6 As shown, after the PCIe receiving module 690 receives the first data sent by the processor, it sends the first data to the data FIFO of the sending buffer (TxFIFO) corresponding to the corresponding physical layer chip. After all data are received, the length data is sent to the length FIFO of the TxFIFO.

[0126] Step 880: The FPGA obtains second data to be sent based on the first data.

[0127] In one embodiment of the present application, the FPGA obtains second data to be sent based on the first data, including: the FPGA adds a cyclic redundancy check result to the first data to obtain verified verification data; the FPGA performs interface conversion processing on the verification data to obtain second data adapted to the physical layer chip interface.

[0128] In the embodiments of the present application, Figure 3 As shown, when the MAC_TX module detects that the length FIFO of the sending buffer (TxFIFO) is not empty, the first data of the sending buffer is read and the CRC check result is added to the first data. At the same time, the interface conversion module in the MAC_TX module performs interface conversion processing on the check data with the CRC check result added to adapt to the physical layer chip corresponding to the sending buffer to obtain the second data.

[0129] Step 890: When the second condition is met, the FPGA sends the second data to the physical layer chip.

[0130] In an embodiment of the present application, the second condition includes that the second data is data after adding a cyclic redundancy check result. When the second condition is met, the FPGA sends the second data to the physical layer chip to complete the sending of Ethernet data of the processor.

[0131] In the embodiment of the present application, when the first condition is met, the FPGA, as an endpoint device, sends a data acquisition request to the processor; the FPGA receives the first data sent by the processor in response to the data acquisition request; the FPGA obtains the second data to be sent based on the first data; when the second condition is met, the FPGA sends the second data to the physical layer chip. In this way, using the FPGA as an endpoint device to actively initiate a data request can reduce the processor's active access time, reduce the response time during data transmission between the processor and the FPGA, and effectively reduce data latency.

[0132] See also Fig.11 , Fig.11 This is a complete flow chart of an industrial Ethernet data transmission method provided by an embodiment of the present application. Fig.11 As shown, the method comprises the following steps:

[0133] Step 1110: The FPGA receives the Ethernet frame sent by the physical layer chip; the FPGA includes a tag storage space.

[0134] Step 1115: The FPGA obtains the data to be stored based on the Ethernet frame.

[0135] In an embodiment of the present application, the FPGA performs interface conversion processing on the Ethernet frame to obtain first processed data adapted to the target logical interface; the FPGA performs a cyclic redundancy check on the first processed data to obtain second processed data with correct verification, and uses the second processed data as data to be stored.

[0136] Step 1120: The FPGA sends the data to be stored to an internal receiving buffer for caching; the receiving buffer includes a data buffer and a length buffer, the data buffer is used to cache the data to be stored, and the length buffer is used to store the length of the data to be stored cached in the data buffer.

[0137] Step 1125: When the length buffer is not empty and the value of the target address in the tag storage space indicates that the memory is writable, the FPGA obtains the target data to be written to the memory from the data buffer; wherein, there is a one-to-one correspondence between the address in the tag storage space and the address in the memory; and the target address corresponds to the address to be written in the memory.

[0138] In an embodiment of the present application, the FPGA includes a write time slot control module and a write control module; when the length buffer is not empty and the value of the target address in the tag storage space indicates that the memory is writable, the FPGA obtains the target data to be written to the memory from the data buffer, including: when the write time slot control module detects that the length buffer is not empty in the Ethernet port time slot, the write time slot control module sends a write request signal and a data length value to the write control module; the write control module reads the value of the target address in the tag storage space in response to the write request signal; when the value of the target address in the tag storage space indicates that the memory is writable, the write control module obtains the verified target data from the receive buffer; wherein the length of the verified target data is the same as the data length value.

[0139] Step 1130: The FPGA writes the target data into the memory.

[0140] In the embodiment of the present application, after the FPGA writes the target data into the memory in step 1130, the method further includes: writing the data length value into the target address in the tag storage space.

[0141] Step 1135: When the target condition is met, the FPGA reads the target data from the memory.

[0142] In an embodiment of the present application, the target condition includes that the target address in the tag storage space is not 0. After the target data is read, the value of the target address in the tag storage space is cleared. The target data is stored in a data cache in the FPGA; and the target data sent to the processor is obtained from the data cache.

[0143] Step 1140: The FPGA, as an endpoint device, sends the target data to the processor, and the target data is used for processing by the processor.

[0144] In an embodiment of the present application, the FPGA includes a PCIe transmission time slot control module and a PCIe transmission module. The PCIe transmission time slot control module detects whether the length buffer of the data cache is empty during the data transmission time slot; if the length buffer is not empty, the PCIe transmission time slot control module sends a data request signal to the PCIe transmission module; the PCIe transmission module obtains the target data from the data buffer of the data cache in response to the data request signal, and sends the target data to the processor.

[0145] After the FPGA sends the read target data to the processor as an endpoint device, the FPGA sends an interrupt to the processor. After receiving the target information sent by the processor in response to the interrupt, the FPGA stops sending the interrupt to the processor. Based on the target information, the FPGA updates the value of the internal address register for subsequent data transmission.

[0146] Step 1145: When the first condition is met, the FPGA, as an endpoint device, sends a data acquisition request to the processor.

[0147] In an embodiment of the present application, the first condition includes: a register module within the FPGA has data updated; the FPGA includes a register module, a peripheral component interconnect express (PCIe) data request module, a peripheral component interconnect express (PCIe) transmission time slot control module and a peripheral component interconnect express (PCIe) transmission module.

[0148] Before the FPGA sends a data acquisition request to the processor, if the register module in the FPGA has data updated, the register module sends data length information and a base address where the data is stored in the processor to the PCIe data request module. After obtaining the time slot allocated by the PCIe transmission time slot control module, the PCIe data request module transmits the data length information and the base address to the PCIe transmission module via the PCIe transmission time slot control module. The PCIe transmission module generates a data acquisition request based on the data length information and the base address.

[0149] Step 1150: The FPGA receives first data sent by the processor in response to the data acquisition request.

[0150] In an embodiment of the present application, the FPGA further includes: a peripheral component interconnect express (PCIe) receiving module, a sending buffer, and a media access control (MAC) sending module. After the FPGA receives the first data sent by the processor in response to the data acquisition request, the PCIe receiving module transmits the first data to the sending buffer; the sending buffer includes a data buffer for storing the first data and a length buffer for storing the length of the first data after the first data is transmitted. The MAC sending module acquires the first data when it is detected that the length buffer in the sending buffer is not empty.

[0151] Step 1155: The FPGA obtains second data to be sent based on the first data.

[0152] In an embodiment of the present application, the FPGA adds a cyclic redundancy check result to the first data to obtain verified verification data; the FPGA performs interface conversion processing on the verification data to obtain second data adapted to the physical layer chip interface.

[0153] Step 1160: When the second condition is met, the FPGA sends the second data to the physical layer chip.

[0154] In an embodiment of the present application, an FPGA receives an Ethernet frame sent by a physical layer chip; the FPGA obtains target data to be written into a memory based on the Ethernet frame; the FPGA writes the target data into the memory; when the target condition is met, the FPGA reads the target data from the memory; the FPGA sends the target data to the processor as an endpoint device, and the target data is used for processing by the processor. In this way, when data is transmitted between the physical layer chip and the processor, the FPGA can receive the Ethernet frame sent by the physical layer chip and store the Ethernet data frame. When the target condition is met, the FPGA reads the target data from the memory and sends the target data to the processor as an endpoint device, so that the processor obtains the target data and processes it. In this way, the FPGA can actively send the target data to the processor as an endpoint device, which can reduce the time of active access by the processor and the processing amount of the processor. In addition, when the physical layer chip transmits the Ethernet frame, it can be stored through the memory. The Ethernet frame will be sent to the processor only when the condition is met, which can delay the processing time of the processor for the Ethernet frame, and to a certain extent, it can reduce the processing amount of the processor, and solve the problem of large processing amount of the processor in the related technology.

[0155] It is important to understand that Figures 1 to 11The explanations of the same or corresponding steps in the above may refer to each other. For example, Figure 1 The explanation of step 140 and step 150 in Figure 4 Steps 460 and 470 in .

[0156] At the same time, it should be understood that the transmission method of industrial Ethernet data provided by the embodiment of the present application can have the following beneficial effects: First, the interface types such as RGMII, SGMII, RMII, MII, etc. can be converted into GMII interface types through the corresponding interface conversion module, and the direct use of GMII interface types can also be supported, which can meet the needs of different Ethernet interfaces, is suitable for multiple Ethernet scenarios, and can solve the problem of insufficient interface resources in related technologies, and has strong flexibility. At the same time, network data uses redundant dual-channel Ethernet for communication. The two Ethernet channels transmit the same data. The application layer can select one of the channels as the calculation data according to the network situation. The redundant transmission has the advantages of low failure probability and stable data transmission. Second, it supports Ethernet giant frames and supports the use of large-capacity DDR3, with 10K bytes as the basic unit. Each unit space is sufficient to accommodate Ethernet giant frames, thereby improving the effective data transmission bandwidth. Third, using FPGA as an endpoint device to actively initiate data requests and data writes, reduces the processor's active access time, effectively reduces data delay, and FPGA supports the Ethernet data packet CRC check function, which can automatically discard the data frame with check errors and reduce the processor's processing overhead. Fourthly, both the write time slot control module and the PCIe transmit time slot control module adopt the method of allocating time slots. When there is data transmission, the corresponding time slot is allocated for transmission. When there is no data transmission, it is directly skipped, which can improve the overall data transmission efficiency and execution efficiency of the system. Fifthly, the tag storage space is used to mark the validity of the data in the memory, and the RAM address in the tag storage space and the memory storage space address are effectively combined to form a one-to-one correspondence, so that the data in the memory can be effectively read and written.

[0157] See also Fig.12 , Fig.12 This is a structural block diagram of an FPGA provided in an embodiment of the present application. Fig.12 As shown, the FPGA 1200 includes: a receiving module 1210 , an acquiring module 1220 , a writing module 1230 , a reading module 1240 and a sending module 1250 .

[0158] The receiving module 1210 is used to receive the Ethernet frame sent by the physical layer chip;

[0159] The acquisition module 1220 is used to acquire target data to be written into the memory based on the Ethernet frame;

[0160] The writing module 1230 is used to write the target data into the memory;

[0161] The reading module 1240 is used to read the target data from the memory when the target condition is met;

[0162] The sending module 1250 is used to use the FPGA as an endpoint device to send the target data to the processor, and the target data is used for processing by the processor.

[0163] In one embodiment of the present application, the acquisition module includes: an interface conversion unit, which is used to perform interface conversion processing on the Ethernet frame to obtain first processed data that is adapted to the target logical interface; a verification unit, which is used to perform CRC verification on the first processed data to obtain second processed data that is correctly verified, and use the second processed data as data to be stored; a receiving unit, which is used to send the data to be stored to an internal receiving buffer for caching; an acquisition unit, which is used to obtain target data to be written to the memory from the receiving buffer when specified conditions are met; wherein the memory is a memory located outside the FPGA.

[0164] In one embodiment of the present application, there is a tag storage space in the FPGA; the receiving buffer includes a data buffer and a length buffer, the data buffer is used to cache the data to be stored, and the length buffer is used to store the length of the data to be stored cached in the data buffer; the acquisition unit includes: a write time slot control subunit, which is used to send a write request signal and a data length value to a write control subunit when the Ethernet port time slot detects that the length buffer is not empty; the write control subunit reads the value of the target address in the tag storage space in response to the write request signal; when the value of the target address in the tag storage space indicates that the memory is writable, the write control subunit acquires the target data from the receiving buffer; wherein the length of the correctly verified target data is the same as the data length value.

[0165] In one embodiment of the present application, the target condition includes that the target address in the tag storage space is not 0; the write module is also used to: after the target data is written into the memory, write the data length value into the target address in the tag storage space; after the target data is read, clear the value of the target address in the data length storage space.

[0166] In one embodiment of the present application, the reading module is also used to: after reading the target data from the memory, store the target data in a data cache within the FPGA; wherein the target data sent by the sending module to the processor is obtained from the data cache.

[0167] In one embodiment of the present application, the data cache includes a data buffer for storing the target data and a length buffer for storing the length of the target data; the sending module includes: a peripheral component express interconnect (PCIe) sending slot control unit, which is used to detect whether the length buffer of the data cache is empty during the data sending slot; when the length buffer is not empty, the PCIe sending slot control module sends a data request signal to the PCIe sending unit; the PCIe sending unit is used to obtain the target data from the data buffer of the data cache in response to the data request signal, and send the target data to the processor.

[0168] In one embodiment of the present application, the sending module is also used to: when a first condition is met, use the FPGA as an endpoint device to send a data acquisition request to the processor; the receiving module is also used to: receive the first data sent by the processor in response to the data acquisition request; the acquisition module is also used to: perform CRC check on the first data to obtain the checked first data; perform interface conversion processing on the checked first data to obtain second data adapted to the physical layer chip interface; the sending module is also used to: when a second condition is met, the FPGA sends the first data to the physical layer chip.

[0169] In one embodiment of the present application, the first condition includes: a register module within the FPGA has data updated; the FPGA also includes a register module and a peripheral component interconnect express (PCIe) data request module; the sending module includes: a peripheral component interconnect express (PCIe) sending time slot control unit and a peripheral component interconnect express (PCIe) sending unit; the register module is used to: when the register module has data updated, send data length information and a base address where the data is stored in the processor to the PCIe data request module; the PCIe data request module is used to: after obtaining the time slot allocated by the PCIe sending time slot control module, transmit the data length information and the base address to the PCIe sending unit via the PCIe sending time slot control unit; the PCIe sending unit is used to: generate a data acquisition request based on the data length information and the base address.

[0170] In one embodiment of the present application, the FPGA also includes: a sending buffer; the receiving module is also used to: transmit the first data to the sending buffer; the sending buffer includes a data buffer for storing the first data and a length buffer for storing the length of the first data after the first data is transmitted; the acquisition module is also used to acquire the first data when it is detected that the length buffer in the sending buffer is not empty.

[0171] It should be noted that, in the modules described in the embodiments of the present application, two modules with the same functions may be the same module, for example, the interface conversion module and the interface conversion unit may be the same module.

[0172] An embodiment of the present application provides an FPGA, including: a receiving module, an acquisition module, a writing module, a reading module and a sending module; wherein the receiving module is used to receive an Ethernet frame sent by a physical layer chip; the acquisition module is used to acquire target data to be written into a memory based on the Ethernet frame; the writing module is used to write the target data into the memory; the reading module is used to read the target data from the memory when the target condition is met; and the sending module is used to send the target data to a processor using the FPGA as an endpoint device, and the target data is used to be processed by the processor. In this way, when data is transmitted between the physical layer chip and the processor, the FPGA can receive the Ethernet frame sent by the physical layer chip and store the Ethernet data frame. When the target conditions are met, the FPGA reads the target data from the memory and sends the target data to the processor as an endpoint device, so that the processor obtains the target data and processes it. In this way, the FPGA can actively send the target data to the processor as an endpoint device, which can reduce the time of active access by the processor and the processing amount of the processor. In addition, when the physical layer chip transmits the Ethernet frame, it can be stored in the memory. The Ethernet frame will be sent to the processor only when the conditions are met, which can delay the processor's processing time for the Ethernet frame and reduce the processor's processing amount to a certain extent, solving the problem of large processor processing amount in related technologies.

[0173] The FPGA provided in the embodiment of the present application can implement each process implemented in the above method embodiment, and will not be described again here to avoid repetition.

[0174] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, the steps of each embodiment of the industrial Ethernet data transmission method are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.

[0175] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory ROM, a random access memory RAM, a magnetic disk or an optical disk.

[0176] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0177] An embodiment of the present application provides a computer program product, which is stored in a storage medium. The program product is executed by at least one processor to implement the various processes of the above-mentioned method embodiment and can achieve the same technical effect. To avoid repetition, it will not be repeated here.

[0178] See also Fig.13 , Fig.13 1 is a block diagram of a distributed control system controller provided by an embodiment of the present application. Fig.13 As shown, the distributed control system controller 1300 includes: a physical layer chip 1310, a processor 1320 and the above-mentioned FPGA 1330. The physical layer chip 1310 and the FPGA 1330 are connected in communication, and the FPGA 1330 and the processor 1320 are connected in communication.

[0179] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0180] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a computer software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present application.

[0181] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A method for transmitting industrial Ethernet data, characterized in that: include: The field programmable gate array FPGA receives the Ethernet frame sent by the physical layer chip; The FPGA acquires the data to be stored based on the Ethernet frame; The FPGA sends the data to be stored to an internal receiving buffer for caching, and the FPGA includes a tag storage space; the receiving buffer includes a data buffer and a length buffer, the data buffer is used to cache the data to be stored, and the length buffer is used to store the length of the data to be stored cached in the data buffer; The FPGA obtains target data to be written into the memory from the data buffer when the length buffer is not empty and the value of the target address in the tag storage space indicates that the memory is writable; wherein there is a one-to-one correspondence between the address in the tag storage space and the address in the memory; and the target address corresponds to the address to be written in the memory; The FPGA writes the target data into the memory; When the target condition is met, the FPGA reads the target data from the memory; The FPGA acts as an endpoint device to send the target data to the processor, and the target data is used for processing by the processor.

2. The method according to claim 1, characterized in that The memory is a memory located outside the FPGA.

3. The method according to claim 1, characterized in that The FPGA obtains data to be stored based on the Ethernet frame, including: The FPGA performs interface conversion processing on the Ethernet frame to obtain first processing data adapted to the target logical interface; The FPGA performs a cyclic redundancy check on the first processed data to obtain second processed data that is correctly checked, and uses the second processed data as data to be stored.

4. The method according to claim 1, characterized in that: After the FPGA writes the target data into the memory, the method further includes: The data length value of the target data is written into the target address in the tag storage space.

5. The method according to claim 4, characterized in that The target condition includes that the target address in the tag storage space is not 0; the method further includes: After the target data is read, the value of the target address in the tag storage space is cleared.

6. The method according to claim 4, characterized in that The method further comprises: After the FPGA reads the target data from the memory, storing the target data in a data cache in the FPGA; The target data sent to the processor is obtained from the data cache.

7. The method according to claim 1, characterized in that After the FPGA sends the read target data to the processor as an endpoint device, the method further includes: The FPGA sends an interrupt to the processor; The FPGA stops sending an interrupt to the processor after receiving the target information sent by the processor in response to the interrupt; The FPGA updates the value of the internal address register based on the target information for subsequent data transmission.

8. The method according to claim 1, characterized in that The method further comprises: When the first condition is met, the FPGA, as an endpoint device, sends a data acquisition request to the processor; The FPGA receives first data sent by the processor in response to the data acquisition request; The FPGA acquires second data to be sent based on the first data; When the second condition is met, the FPGA sends the second data to the physical layer chip.

9. The method according to claim 8, characterized in that The FPGA acquires second data to be sent based on the first data, including: The FPGA adds a cyclic redundancy check result to the first data to obtain verified check data; The FPGA performs interface conversion processing on the verification data to obtain second data adapted to the physical layer chip interface.

10. A field programmable gate array FPGA, characterized in that: include: A receiving module, used for receiving Ethernet frames sent by the physical layer chip; An acquisition module, used for acquiring data to be stored based on the Ethernet frame; The data to be stored is sent to an internal receiving buffer for caching, the FPGA includes a tag storage space; the receiving buffer includes a data buffer and a length buffer, the data buffer is used to cache the data to be stored, and the length buffer is used to store the length of the data to be stored cached in the data buffer; when the length buffer is not empty and the value of the target address in the tag storage space indicates that the memory can be written, the target data to be written to the memory is obtained from the data buffer; wherein the address in the tag storage space has a one-to-one correspondence with the address in the memory; the target address corresponds to the address to be written in the memory; A writing module, used for writing the target data into the memory; A reading module, configured to read the target data from the memory when a target condition is met; The sending module is used to use the FPGA as an endpoint device to send the target data to the processor, and the target data is used for processing by the processor.

11. A computer-readable storage medium, characterized in that: The medium stores a program or an instruction, and when the program or the instruction is executed, the steps of the method according to any one of claims 1 to 9 are implemented.

12. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 9 when being executed by a processor.

13. A distributed control system controller, characterized in that: include: A physical layer chip, a processor and an FPGA according to claim 10; wherein the physical layer chip and the FPGA are communicatively connected, and the FPGA and the processor are communicatively connected.