A design method of intelligent interface based on two-level FIFO
Through the design of two-level FIFO intelligent interface, the resource waste problem caused by interface heterogeneity and verification of embedded systems is solved, and the performance and data transmission reliability of processing units are improved, and real-time performance is met. Require.
Patent Information
- Application Number
- CN202211078174.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-05
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2042-09-05
AI Technical Summary
When an embedded system processes data communication between multiple heterogeneous devices, due to interface inconsistency and data verification requirements, the processing unit resources are wasted, making it difficult to meet the real-time requirements.
The two-level FIFO intelligent interface design is adopted to separate data reception and verification, collect and verify data through the first-level FIFO, and store valid data in the second-level FIFO. The processing unit can directly obtain and send valid data to reduce resource waste.
It improves the performance of the processing unit and data transmission reliability, reduces resource consumption and error risks during data transmission, and improves the real-time and stability of the system.
Smart Images

Figure CN115694772B_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of cruise missile control, and in particular relates to an intelligent interface design method for full-duplex communication. Background Art
[0002] Embedded systems are usually designed to complete specific functions with limited resources. They communicate data by connecting to multiple external devices, integrating the information of each device to complete processing operations according to certain rules and algorithms, and then sending the results of the operations to each device. Therefore, the processing unit must complete the data reception and sending calculations while completing the functional operations. Since the interfaces of the devices in the system are different, the transmission rate and verification method are also inconsistent. The processing unit needs to spend a lot of time resources and memory resources to complete the data reception, transmission and verification of each interface. In order to ensure the integrity of the data, problems such as data message conflicts must also be considered during the data transmission and reception process. For embedded systems with high real-time requirements, the processing unit should spend most of its time on algorithm solving and functional operations. Summary of the invention
[0003] The present invention provides an intelligent interface design method based on two-level FIFO, which greatly improves the performance of the processing unit and the reliability of data transmission.
[0004] A technical solution for intelligent interface design method based on two-level FIFO:
[0005] The intelligent interface separates data reception, verification and valid data reading by using two-level FIFOs. The first-level FIFO is used to collect data and complete data verification according to the interface configuration, and the second-level FIFO is used to place valid data. When reading data, the external FIFO data is read out first by judging the FIFO status to ensure the update of valid data; the processing unit can directly obtain valid data from the intelligent interface and complete the verification and transmission of data.
[0006] Furthermore, the method of the present invention specifically comprises the following steps:
[0007] The first step is to confirm the number of interfaces, determine the data protocol format, the maximum amount of data sent and received by the interface for a single frame of data, and the verification method of the interface data for each interface;
[0008] Each interface is assigned a transceiver FIFO, which is a first-in, first-out data storage module; the send data FIFO needs to be allocated in two levels, the first-level FIFO is used to receive the data sent by the processing unit, and the second-level FIFO verifies the first-level FIFO data and completes the frame header and frame footer data format; the receive data FIFO needs to be allocated in two levels, the first-level FIFO size is used to receive the data received by the interface, and the second-level FIFO is used to filter the data in the first-level FIFO according to the protocol format and verification method, and finally only valid data is stored in the second-level FIFO;
[0009] In the second step, each interface is bound to an integer register as a send command register, and the send command register is set to start sending, sending, and sending completed. In the initialization preparation stage, the empty send FIFO is read first, and the send command register is set to send completed.
[0010] When the processing unit sends data, it first queries the status of the interface's send command register. If it is sending, it updates the data in the primary FIFO, waits for the data to be completed, pushes the data to the secondary FIFO, and starts sending. When the status of the send command register is sending completion, directly pushes the valid data into the secondary FIFO, clears the primary FIFO, writes the send command in the send command register after all the data are pushed in, and when the intelligent interface finds the send command, it sets the protocol format and verification method configured by the current interface to verify the data in the FIFO and align the protocol format. After completing the above steps, the data is sent to the hardware interface chip, and the value in the send command register is set to send completion.
[0011] In the third step, each interface is bound to an integer register as a receiving status register, and the receiving status register is set to three states: no data, data receiving, and data receiving completed. The status setting is determined by the state of the secondary FIFO. In the initialization preparation stage, the primary FIFO and the secondary FIFO of the empty receiving data are read first, and the receiving command register is set to no data.
[0012] Two-level FIFO is used to collect data; when data enters, the data is immediately pushed into the first-level FIFO, and the data is read out from the first-level FIFO by byte, and the data frame header is found from the read data according to the interface data protocol format; when the data frame header is found, the valid data read out is pushed into the second-level FIFO, and the data is verified according to the interface verification method; if the verification result is consistent with the verification word in the data, the data is retained in the second-level FIFO and waits for the processing unit to read and set the receiving status register to complete data reception; if the verification result is different from the verification word in the data, all the data in the second-level FIFO is directly read out, and the receiving status register is set to no data;
[0013] Step 4: Two packets of valid data are saved in the secondary FIFO. When data enters, there are two situations:
[0014] When there is already a packet of valid data in the secondary FIFO, the primary FIFO pushes the data into the secondary FIFO without changing the receive status register;
[0015] When there are two packets of valid data in the secondary FIFO, a packet of data is read out of the secondary FIFO first, and the primary FIFO pushes the data into the secondary FIFO, sets the receive status register to receiving, pushes new data in, and sets the receive status register to receiving completed.
[0016] Furthermore, in the first step, the size of the transmission data FIFO space is greater than the maximum amount of transmission data; the size of the first-level FIFO and the second-level FIFO space of the reception data is greater than twice the maximum amount of reception data.
[0017] The method of the present invention separates data reception and verification by using two-level FIFOs, designs data reception of the first-level FIFO, ensures that online data is not lost, and completes frame verification; designs the second-level FIFO, ensures that the processing unit can get the latest valid data, prevents data packet truncation during data update, and effectively improves the stability and reliability of data transmission. Data transmission and reception are completed through FIFO, freeing the processing unit from waiting for data transmission to be completed, and only relies on the judgment flag to directly read valid data, which greatly improves the software efficiency of the processing unit. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] Figure 1 A schematic diagram of a single-interface two-stage FIFO design process in an embodiment;
[0019] Figure 2 This is a schematic diagram of the interface data sending process in the embodiment;
[0020] Figure 3 Schematic diagram of the interface data receiving process in the embodiment. DETAILED DESCRIPTION
[0021] The present invention will be further described in detail below in conjunction with the accompanying drawings.
[0022] In order to improve the core processing capability of the processing unit, it is necessary to design a two-level FIFO-based intelligent interface to cooperate with the processing unit to complete data transmission and reception and adapt to the data format and verification method of different device protocols. The processing unit can directly obtain valid data from the intelligent interface and complete the data verification and transmission, eliminating the time for its own data communication verification, greatly improving the performance of the processing unit and the reliability of data transmission.
[0023] The present invention provides an intelligent interface design method based on two-level FIFO, which assists a processing unit in completing data transmission and reception and adapts to data formats and verification methods of different device protocols, thereby greatly improving the performance of the processing unit and the reliability of data transmission.
[0024] The method of the present invention comprises the following steps:
[0025] first step
[0026] Confirm the number of interfaces, determine the data protocol format for each interface, the maximum amount of data sent and received by the interface for a single frame of data, and the verification method for interface data.
[0027] Each interface is assigned a transceiver FIFO. FIFO is a first-in, first-out data storage module. The send data FIFO needs to be assigned two levels. The first FIFO is used to receive the data sent by the processing unit, and the second FIFO verifies the first FIFO data and completes the data format such as the frame header and frame tail. The receive data FIFO needs to be assigned two levels. The first FIFO size is used to receive the data received by the interface, and the second FIFO is used to filter the data in the first FIFO according to the protocol format and verification method. Finally, only valid data is stored in the second FIFO. The space size of the first and second FIFOs should be slightly larger than twice the maximum amount of data received, see Figure 1 .
[0028] Step 2
[0029] Each interface is bound to an integer register as a send command register, and the send command register is set to start sending, sending, and sending completed. In the initialization preparation stage, the empty send FIFO is read first, and the send command register is set to send completed.
[0030] like Figure 2 When the processing unit sends data, it first queries the status of the interface's send command register. If it is sending, it updates the data in the primary FIFO. After waiting for the data to be completed, it pushes the data to the secondary FIFO and starts sending. When the status of the send command register is send complete, it directly pushes the valid data into the send secondary FIFO and clears the primary FIFO. After all the data is pushed in, it writes the send command in the send command register. When the intelligent interface finds the send command, it sets the data in the FIFO to check and align the protocol format according to the protocol format and verification method configured by the current interface. After completing the above steps, it sends the data to the hardware interface chip and sets the value in the send command register to send complete.
[0031] Step 3
[0032] Each interface is bound to an integer register as the receive status register, and the receive status register is set to no data, data receiving, and data receiving completed. The status setting is determined by the status of the secondary FIFO. In the initialization preparation stage, the primary FIFO and secondary FIFO of the empty receive data are read first, and the receive command register is set to no data.
[0033] like Figure 3 In order to ensure that data is not lost, two-level FIFO is used to collect data. When data enters, the data is immediately pushed into the first-level FIFO, and the data is read out byte by byte from the first-level FIFO. The data frame header is found from the read data according to the interface data protocol format. When the data frame header is found, the valid data read out is pushed into the second-level FIFO, and the data is verified according to the interface verification method. If the verification result is consistent with the check word in the data, the data is retained in the second-level FIFO and waits for the processing unit to read and set the receiving status register to complete data reception. If the verification result is different from the check word in the data, all the data in the second-level FIFO is directly read out, and the receiving status register is set to no data.
[0034] Step 4
[0035] To prevent data loss, two packets of valid data are stored in the secondary FIFO. There are two situations when data enters.
[0036] When there is already a packet of valid data in the secondary FIFO, the primary FIFO pushes the data into the secondary FIFO without changing the receive status register.
[0037] When there are two packets of valid data in the secondary FIFO, a packet of data is read out of the secondary FIFO first, and the primary FIFO pushes the data into the secondary FIFO, sets the receive status register to receiving, pushes new data in, and sets the receive status register to receiving completed.
[0038] The above specific implementations are limited to explaining and illustrating the technical solutions of the present invention, but cannot constitute a limitation on the protection scope of the claims. Those skilled in the art should be aware that any new technical solutions obtained by making any simple deformation or replacement on the basis of the technical solutions of the present invention fall within the protection scope of the present invention.
Claims
1. A two-stage FIFO-based intelligent interface design method, characterized in that: The intelligent interface separates data reception, verification and valid data reading by using two-level FIFO. The first-level FIFO is used to collect data and complete data verification according to the interface configuration, and the second-level FIFO is used to place valid data. When reading data, the external FIFO data is read out first by judging the FIFO status to ensure the update of valid data; the processing unit can directly obtain valid data from the intelligent interface and complete the verification and transmission of data; The method of the present invention specifically comprises the following steps: The first step is to confirm the number of interfaces, determine the data protocol format, the maximum amount of data sent and received by the interface for a single frame of data, and the verification method of the interface data for each interface; Each interface is assigned a transceiver FIFO, which is a first-in, first-out data storage module; the send data FIFO needs to be allocated in two levels, the first-level FIFO is used to receive the data sent by the processing unit, and the second-level FIFO verifies the first-level FIFO data and completes the frame header and frame tail data format; the receive data FIFO needs to be allocated in two levels, the first-level FIFO size is used to receive the data received by the interface, and the second-level FIFO is used to filter the data in the first-level FIFO according to the protocol format and verification method, and finally only valid data is stored in the second-level FIFO; In the second step, each interface is bound to an integer register as a send command register, and the send command register is set to start sending, sending, and sending completed. In the initialization preparation stage, the empty send FIFO is read first, and the send command register is set to send completed. When the processing unit sends data, it first queries the status of the interface's send command register. If it is sending, it updates the data in the primary FIFO, waits for the data to be completed, pushes the data to the secondary FIFO, and starts sending. When the status of the send command register is sending completion, directly pushes the valid data into the secondary FIFO, clears the primary FIFO, writes the send command in the send command register after all the data are pushed in, and when the intelligent interface finds the send command, it sets the protocol format and verification method configured by the current interface to verify the data in the FIFO and align the protocol format. After completing the above steps, the data is sent to the hardware interface chip, and the value in the send command register is set to send completion. In the third step, each interface is bound to an integer register as a receiving status register, and the receiving status register is set to three states: no data, data receiving, and data receiving completed. The status setting is determined by the state of the secondary FIFO. In the initialization preparation stage, the primary FIFO and the secondary FIFO of the empty receiving data are read first, and the receiving command register is set to no data. Two-level FIFO is used to collect data; when data enters, the data is immediately pushed into the first-level FIFO, and the data is read out byte by byte from the first-level FIFO, and the data frame header is searched from the read data according to the interface data protocol format; when the data frame header is found, the valid data read out is pushed into the second-level FIFO, and the data is verified according to the interface verification method; If the check result is consistent with the check word in the data, the data is retained in the secondary FIFO and waits for the processing unit to read it and sets the receiving status register to indicate that the data reception is completed. If the check result is different from the check word in the data, all the data in the secondary FIFO is directly read out and the receiving status register is set to no data. Step 4: Two packets of valid data are saved in the secondary FIFO. When data enters, there are two situations: When there is already a packet of valid data in the secondary FIFO, the primary FIFO pushes the data into the secondary FIFO without changing the receive status register; When there are two packets of valid data in the secondary FIFO, a packet of data is read out of the secondary FIFO first, and the primary FIFO pushes the data into the secondary FIFO, sets the receive status register to receiving, pushes new data in, and sets the receive status register to receiving completed.
2. The intelligent interface design method based on two-stage FIFO according to claim 1, characterized in that: In the first step, the size of the transmit data FIFO space is greater than the maximum amount of transmit data; the size of the receive data primary FIFO and secondary FIFO space is greater than twice the maximum amount of receive data.
