Data interaction method, data processing apparatus, and storage medium

By defining training synchronization codewords and combinations of training codewords, the PCIe link training state machine is simplified, solving the problem of long link training time and achieving faster data interaction and higher stability.

CN121501726BActive Publication Date: 2026-08-04SANECHIPS TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SANECHIPS TECH CO LTD
Filing Date
2025-12-31
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

In existing technologies, the link training process of the PCIe protocol is complex and time-consuming, and how to reduce the link training time is an urgent problem to be solved.

Method used

By defining the same training synchronization codeword and N training codewords, N training character sequences are formed, reducing the number of link training states, simplifying the PCIe training state machine, and using custom transmission synchronization codewords and business data for data interaction, thus avoiding accidental triggering of link training.

Benefits of technology

It reduces link training time and the use of complex dedicated training characters, and improves the stability of data interaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121501726B_ABST
    Figure CN121501726B_ABST
Patent Text Reader

Abstract

Embodiments of the present application provide a data interaction method, a data processing device and a storage medium. The method is applied to a first data processing device. The method comprises: performing interaction with a second data processing device through N training character sequences to complete link training, and entering a data transmission state if the link training is completed, wherein the N training character sequences comprise a same training synchronization code word and N training code words, and N is less than 11; and performing data interaction with the second data processing device through service data and a transmission synchronization code word in the data transmission state. The embodiments of the present application can reduce the time of link training and reduce the complexity of link training.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to, but is not limited to, the field of chip technology, and in particular to a data interaction method, a data processing device, and a storage medium. Background Technology

[0002] For high-speed interface interconnection and link establishment, commonly used standard interconnects include PCIe (Peripheral Component Interconnect Express), USB (Universal Serial Bus), and SATA (Serial Advanced Technology Attachment). These standard interconnects have strict protocol specifications, and the link training process is complex.

[0003] In related technologies, the PCIe protocol physical layer completes link training by sending training characters specified by the protocol and using the protocol state machine. This process is complex and time-consuming. How to reduce link training time is an urgent issue that needs to be discussed and resolved. Summary of the Invention

[0004] This application provides a data interaction method, a data processing device, and a storage medium, which can reduce the training time and complexity of the link training.

[0005] On one hand, this application provides a data interaction method applied to a first data processing device. The method includes: interacting with a second data processing device through N training character sequences to complete link training in corresponding N training states, and entering a data transmission state after completing the link training. The N training character sequences include the same training synchronization codeword and N training codewords, where N is less than 11. In the data transmission state, data interaction is performed with the second data processing device through business data and transmission synchronization codewords.

[0006] On the other hand, embodiments of this application also provide a data processing apparatus, including: at least one processor; at least one memory for storing at least one program; and implementing the data interaction method as described above when at least one of the programs is executed by at least one of the processors.

[0007] On the other hand, embodiments of this application also provide a computer-readable storage medium storing computer-executable instructions, characterized in that the computer-executable instructions are used to execute the data interaction method as described above.

[0008] On the other hand, embodiments of this application also provide a computer program product, including a computer program or computer instructions, the computer program or computer instructions being stored in a computer-readable storage medium, a processor of a data processing device reading the computer program or computer instructions from the computer-readable storage medium, and the processor executing the computer program or computer instructions to cause the data processing device to perform the data interaction method as described above.

[0009] In this embodiment, N training character sequences are constructed by defining the same training synchronization codeword and N training codewords. The first data processing device interacts with the second data processing device through the defined N training character sequences in corresponding N training states to achieve link training between the first and second data processing devices, where N is less than 11. Compared with related technologies, this embodiment reduces the number of training states in the link training process, simplifying the training states of PCIe in related technologies, thereby reducing link training time and the use of complex dedicated training characters. In the data transmission state, data interaction is performed with service data through a defined transmission synchronization codeword that is different from the training synchronization codeword. This clearly distinguishes the data in the link training process from the data in the data interaction process, avoiding false triggering of link training and improving the stability of data interaction. Attached Figure Description

[0010] Figure 1 This is a schematic diagram of the PCIe link training process in related technologies; Figure 2 This is a flowchart of a data interaction method provided in one embodiment of this application; Figure 3 This is a schematic diagram of the link training state machine transition provided in an example of this application; Figure 4 This is a schematic diagram of the structure of the training synchronization codeword SYN and the training codeword TS_N provided in an example of this application; Figure 5 This is a schematic diagram of a simplified structure of the sending and receiving directions provided in one embodiment of this application; Figure 6 This is a schematic diagram of a data flow structure with N channels provided in an example of this application; Figure 7 This is a schematic diagram of the state machine architecture and transitions for link training provided in an example of this application; Figure 8 This is a schematic diagram of the structure of a data processing apparatus provided in one embodiment of this application. Detailed Implementation

[0011] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0012] It should be noted that although the flowchart shows a logical order, in some cases, the steps shown or described may be executed in a different order than that shown in the flowchart. In the description of the embodiments of this application, "multiple" (or more than) means two or more, "greater than," "less than," and "exceeding" are understood to exclude the number itself, while "above," "below," and "within" are understood to include the number itself. If "first," "second," etc., are described, they are only used to distinguish technical features and should not be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated or the order of the technical features indicated. Furthermore, in the description of the embodiments of this application, the various values ​​mentioned (such as first value, second value, etc.) can be flexibly represented as a single numeric code or an enumerated type value.

[0013] In related technologies, high-speed interface interconnection and link establishment commonly uses standard interconnects such as PCIe (Peripheral Component Interconnect Express), USB (Universal Serial Bus), and SATA (Serial Advanced Technology Attachment). These standard interconnects have strict protocol specifications, and the link training process is complex. Protocol-based link establishment requires the strict generation of dedicated training codewords, and the data structure has strict regulations. Related research is based on standard protocols. In traditional cross-socket (interface) interconnection devices, standard protocol devices such as PCIe or Ethernet are often used to complete the link connection, involving a complex link training process and proprietary training characters.

[0014] In related technologies, the PCIe protocol physical layer completes link training through the protocol state machine by sending training characters specified by the protocol. (See reference...) Figure 1 The PCIe physical layer training state machine is divided into a total of 11 large state machines, such as... Figure 1 As shown, each large state machine contains multiple sub-state machines, and the entire training process needs to strictly adhere to the PCIe protocol, making the training process complex and time-consuming. How to reduce the training time of the link is a problem that urgently needs to be discussed and solved.

[0015] To reduce link training time and the use of complex dedicated characters, embodiments of this application provide a data interaction method, a data processing device, a computer-readable storage medium, and a computer program product. In this application embodiment, N training character sequences are constructed by defining the same training synchronization codeword and N training codewords. A first data processing device interacts with a second data processing device through the defined N training character sequences in corresponding N training states, realizing link training between the first and second data processing devices, where N is less than 11. Compared to related technologies, this application embodiment reduces the training states in the link training process, simplifying the training states of PCIe in related technologies, thereby reducing link training time and the use of complex dedicated training characters. In the data transmission state, data interaction is performed using a transmission synchronization codeword different from the training synchronization codeword and service data, clearly distinguishing between data in the link training process and data in the data interaction process, avoiding false triggering of link training, and improving the stability of data interaction.

[0016] Based on the above analysis, the embodiments of this application will be further described below with reference to the accompanying drawings.

[0017] Reference Figure 2 , Figure 2 This is a flowchart of a data interaction method provided in one embodiment of this application. The data interaction method is executed by a first data processing device, and the data interaction method may include, but is not limited to, steps 210 to 220.

[0018] Step 210: Interact with the second data processing device through N training character sequences to complete the link training, and enter the data transmission state after the link training is completed. The N training character sequences include the same training synchronization codeword and N training codewords, where N is less than 11. Step 220: In the data transmission state, data interaction is performed with the second data processing device through business data and transmission synchronization codeword.

[0019] In some embodiments, the data processing device is a chip or hardware device with a PCIe physical layer (including SerDes) and a controller, possessing data processing capabilities. The first data processing device and the second data processing device are two data processing devices that need to transmit data to each other.

[0020] For example, the data processing device can be: a computing core chip such as a CPU (Central Processing Unit), a GPU (Graphics Processing Unit), or a SoC (System on a Chip); or storage control hardware such as an NVMe SSD (Non-Volatile Memory Express Solid State Drive) controller chip, a storage array controller, or a memory controller chip; or peripheral expansion hardware such as a network card chip, a graphics card expansion dock chip, or a dedicated terminal chip. SerDes stands for Serializer / Deserializer. The Serializer is responsible for converting parallel data into serial data for transmission, and the Deserializer is responsible for restoring the received serial data back to parallel data.

[0021] In some embodiments, the training character sequence is a sequence of characters sent / received by the first and second data processing devices during the link training process, used to indicate training status and training information. The training character sequence includes a custom training synchronization codeword and a training codeword; the training synchronization codeword can be the same for different training character sequences. The training synchronization codeword is used for synchronizing the data sequence and defining the boundaries of the data sequence; that is, the training synchronization codeword represents the starting point of each training character sequence segment. The training codeword indicates the corresponding training status and related training information.

[0022] In some embodiments, N can be 4, meaning there are four training character sequences. Correspondingly, there are 4 training codewords and 4 corresponding training states. For example, the four training states are T0, T1, T2, and T3. In state T0, the two parties involved in the link training initialize the physical layer link; in state T1, they negotiate which physical channels (Lane) are available; in state T2, they match the physical and logical channels based on the physical channels determined in state T1 to ensure the negotiated Lanes function correctly; in state T3, they confirm the link training is complete and align the data. In other examples, other N training states can be set according to specific needs, using N training states and N training character sequences to complete the above link training process; N can be 3, 5, 6, 7, etc., and N can be less than 11.

[0023] In some embodiments, the number of training states in the custom physical layer link training state machine corresponds to the types of training character sequences, with one training character sequence corresponding to one training state. In addition to the training states, a normal state is also included. The normal state represents the state where the link is performing normal data transmission, i.e., the data transmission state. For example, Figure 3 This is a schematic diagram of the link training state machine transitions provided in an example of this application. Still using four training states, namely T0, T1, T2, and T3 as described in the above embodiments, the training state machine of this example defines training state T0, training state T1, training state T2, training state T3, and a Normal state. The transitions between the states are as follows: Figure 3 As shown in the diagram, T0, T1, T2, and T3 correspond to various training states. When transmitting and sending custom training character sequences, states T0, T1, T2, and T3 are used to determine if the link can stably transmit data. The Normal state corresponds to the state where normal data transmission occurs after the link training is completed. During the process from link training to normal data transmission after training completion, if all training stages are normal, the transition occurs in the order of training state T0 → training state T1 → training state T2 → training state T3 → Normal state. If an anomaly occurs in any of the states T1, T2, T3, or Normal, the transition back to state T0 occurs. In the above embodiment, four custom training character sequences and four training states plus one Normal state are used to interface with PCIe's SerDes for link training, completing cross-chip data transmission. Compared to the 11 large state machines of PICe in related technologies, this example only requires four training states plus one Normal state, effectively simplifying the PCIe training state machine and reducing link training time and the use of complex dedicated training characters.

[0024] In some embodiments, the data transmission state is the state of completed link training, i.e., the completion of interconnection and link establishment, and the commencement of business data transmission. The transmission synchronization codeword is also used for synchronizing data sequences (business data) and defining the boundaries of data sequences (business data), but the defined transmission synchronization codeword is different from the training synchronization codeword.

[0025] In some embodiments, the training codewords include training information, and the training information in different training codewords is different. The training information included in different training codewords is determined according to the training state corresponding to that training codeword, and the training information is the information that the two parties in the link training need to interact in the corresponding training state.

[0026] For example, the training synchronization codeword (SYN) and training codeword (TS_N) are customized according to requirements. The N in the training codeword TS_N is the N of the corresponding N training codewords. For example, when there are 4 training states (T0, T1, T2 and T3), there are 4 corresponding training codewords, namely TS_0, TS_1, TS_2 and TS_3.

[0027] Figure 4 This is a schematic diagram illustrating the structure of the training synchronization codeword SYN and the training codeword TS_N provided in an example of this application. (Refer to...) Figure 4 The structure of the training codeword TS_N is as follows: The header of the training codeword has a custom format, as shown in the figure as Header_TS_N. The remaining fields include training information bits (tranching_info), reserved bits, and CRC (Cyclic Redundancy Check) verification field bits. The training codeword is sent according to the different states of the link training process, carrying the information that the training parties need to interact with; for example, in training state T0, the training codeword TS_0 is sent, and the training codeword TS_0 carries the information that the training parties need to interact with in state T0.

[0028] The structure of the training synchronization codeword SYN is similar to that of the training codeword, the difference being that the header of the training synchronization codeword is Header_SYN. The training synchronization codeword SYN is a packet header codeword, and its function is similar to the COM codeword used in the PCIe physical layer, used for initial data stream identification and locking.

[0029] In some embodiments, the bit width of the training codeword is determined based on the number of physical transmission channels between the first data processing device and the second data processing device. These physical transmission channels are SerDes (serializers / deserializers), meaning the bit width of the training codeword depends on the bit width when interfacing with the SerDes. The core task of the SerDes is to achieve bidirectional conversion between parallel data and serial data streams. On the transmitting side, it "weaves" N bits of parallel data into a high-speed serial stream; on the receiving side, it "disassembles" the serial stream back into N bits of parallel data. Therefore, the bit width of the training codeword needs to be determined based on the bit width of the SerDes to ensure that the training codeword is correctly recognized and parsed during transmission, guaranteeing effective communication.

[0030] In some embodiments, both the training synchronization codeword and the transmission synchronization codeword include a data packet header, and the content of the data packet header of the training synchronization codeword is different from that of the transmission synchronization codeword. By customizing different data packet header contents, the training synchronization codeword and the transmission synchronization codeword can be distinguished. The training synchronization codeword is periodically inserted during the link training process when training codewords are sent. The training synchronization codeword is followed by other training codewords and serves as a training status indicator, a distinguishing boundary for training codewords, and a synchronization location. The transmission synchronization codeword is periodically inserted during the normal data transmission process when business data is sent. The transmission synchronization codeword is followed by other business data and serves as an indicator of the current normal data transmission state, a distinguishing boundary for business data streams, and a synchronization location. In the above embodiments, by defining the data packet headers of the training synchronization codeword and the transmission synchronization codeword as different contents, the data during the link training process and the data during the data interaction process can be clearly distinguished, avoiding accidental triggering of link training and improving the stability of data interaction.

[0031] In some embodiments, the N training states include an initialization training state, and the N training codewords include an initialization training codeword. The initialization training state is used for the interaction between the first data processing device and the second data processing device to exchange training synchronization codewords and initialization training codewords, thereby completing the initialization of the physical layer between the first data processing device and the second data processing device. Specifically, the initialization training state corresponds to the initial stage of the link training process, during which the two training parties, namely the first data processing device and the second data processing device, send training synchronization codewords and initialization training codewords to each other. After receiving the initialization training codeword, the first data processing device and the second data processing device perform physical layer initialization based on the training information carried therein, completing the preliminary preparation work for channel negotiation.

[0032] In some embodiments, physical layer initialization includes at least one of the following: Initialization of the physical transmission channel between the first data processing device and the second data processing device; Locking of synchronized codewords during training; Signal polarity reversal; Reversal of the physical transmission channel between the first data processing device and the second data processing device; Adaptive balancing between the first data processing device and the second data processing device.

[0033] Among them, the physical transmission channel is SerDes. The initialization of the physical transmission channel is to make SerDes enter the "ready state" from "power-on standby", activate its serial-to-parallel conversion, signal processing and other functions, and provide the hardware foundation for subsequent synchronization locking and parameter negotiation. By locking the training synchronization codeword, the timing reference is determined and the data boundary is established so that the training codeword can be correctly identified and parsed. The polarity of the signal is reversed, that is, the signal changes from high level (1) to low level (0) and low level (0) to high level (1). The channels between the first data processing device and the second data processing device send differential signals. By reversing the polarity of the differential signals, differential alignment between the transmitting side and the receiving side is achieved. The reversal of the physical transmission channel is the Lane reversal, that is, adjusting the data order of multiple lanes. For example, originally Lane 0 transmits data A and Lane 1 transmits data B. After reversal, Lane 0 transmits data B and Lane 1 transmits data A. When multiple lanes transmit in parallel, the physical order of the lanes may differ from the design order. By reversing the physical transmission channels, the logical order of each lane is corrected to ensure the correct sequence among multiple lanes. Adaptive equalization automatically adjusts the equalizer parameters by detecting signal distortion on the lanes, compensating for attenuation and interference during signal transmission, and restoring clarity to distorted signals. It should be noted that actions such as reversing signal polarity, reversing the physical transmission channels, and adaptive equalization are performed according to actual needs, and are not necessarily executed during initialization.

[0034] For example, in the initial training state, the sending side performs the initialization of the physical transmission channel, and the receiving side performs the locking of the training synchronization codeword, the reversal of the signal polarity, the reversal of the physical transmission channel, adaptive equalization, and other actions.

[0035] In some embodiments, the N training states further include a channel negotiation training state, and the N training codewords further include a channel negotiation training codeword. The channel negotiation training state is used by the first data processing device and the second data processing device to interact with the training synchronization codeword and the channel negotiation training codeword after the physical layer initialization is completed, so as to complete the negotiation of the physical transmission channel between the first data processing device and the second data processing device. The channel negotiation training state corresponds to the physical channel negotiation phase of the link training process. The first data processing device and the second data processing device negotiate the physical transmission channel by sending and receiving training character sequences carrying the channel negotiation training codeword, such as confirming the existence of a valid lane and determining which lanes can be used for subsequent transmission. After receiving the channel negotiation training codeword, the first data processing device and the second data processing device perceive the lane negotiation-related information on the other side based on the training information carried therein. Through channel negotiation training, it is possible to clarify which lanes can be used between the first data processing device and the second data processing device, and at what rate, etc.

[0036] In some embodiments, the initialization training state automatically enters the channel negotiation training state after the physical layer initialization-related actions are completed or after a timeout.

[0037] In some embodiments, the N training states further include a channel logical alignment training state, and the N training codewords further include channel logical alignment training codewords. The channel logical alignment training state is used by the first data processing device and the second data processing device to interact with the training synchronization codewords and the channel logical alignment training codewords after negotiating the physical transmission channel, so as to complete the logical alignment of the physical transmission channel. The channel logical alignment training state corresponds to the stage of matching the physical channel lanes and logical channels in the link training process, realizing the logical alignment of the physical transmission channels between the sending side and the receiving side. In the channel logical alignment training state, logical alignment is performed based on several lanes negotiated and determined in the channel negotiation training state. The first data processing device and the second data processing device send channel logical alignment training codewords to each other and receive each other's channel logical alignment training codewords. The lanes used in this process correspond one-to-one with the lanes negotiated and determined in the channel negotiation training state, thereby completing the logical alignment based on the training information carried in the channel logical alignment training codewords, ensuring that the negotiated lanes can function normally.

[0038] In some embodiments, when the second data processing device sends at least a first number of channel negotiation training codewords, the first data processing device receives at least a second number of channel negotiation training codewords and determines that it has entered the channel logical alignment training state, wherein the first number is greater than the second number. Similarly, the second data processing device enters the channel logical alignment training state from the channel negotiation training state. Due to the presence of training synchronization codewords, the receiving side can clearly determine the number of channel negotiation training codewords received. By defining the minimum number of channel negotiation training codewords sent by the sending side and the minimum number of channel negotiation training codewords received by the receiving side, the completion boundary of the channel negotiation training state is determined, realizing automatic transition from the channel negotiation training state to the channel logical alignment training state.

[0039] In some embodiments, during the channel negotiation training state, if the sending side fails to send a first number of channel negotiation training codewords or the receiving side fails to receive a second number of channel negotiation training codewords within a preset time period (i.e., a timeout occurs), the system will return to the initialization training state. Alternatively, the system will return to the initialization training state if an error is detected in the training character sequence.

[0040] In some embodiments, the N training states further include a data transmission training state, and the N training codewords further include transmission synchronization codewords. The data transmission training state is used for the first data processing device and the second data processing device to interact with the transmission synchronization codewords after completing the logical alignment of the physical transmission channel, in order to determine whether to enter the data transmission state. The data transmission training state corresponds to the stage in the link training process where both parties confirm the completion of training, switch the interactive data from the training character sequence to business data, and align the data. In the data transmission training state, the first data processing device and the second data processing device confirm the completion of link training by receiving the transmission synchronization codeword sent by the other party, and subsequently interact with data according to the channel determined by the link training negotiation.

[0041] In other embodiments, the N training codewords also include data transmission training codewords. The data transmission training state is used by the first data processing device and the second data processing device to interact with the data transmission training codewords and transmission synchronization codewords after completing the logical alignment of the physical transmission channel, to determine that the link training is complete and enter the data transmission state. The data transmission training codewords contain training information indicating the completion of link training. For example, after entering the data transmission training state, the first data processing device sends the data transmission training codewords to the second data processing device. The second data processing device determines that the link training is complete based on the data transmission training codewords and sends the transmission synchronization codewords to the first data processing device. After receiving the transmission synchronization codewords, the first data processing device switches the transmitted data stream from the training character sequence to normal business data, and simultaneously aligns the data. The second data processing device does the same.

[0042] In some embodiments, when the second data processing device sends at least a third number of channel logical alignment training codewords, the first data processing device receives at least a fourth number of channel logical alignment training codewords and determines that it has entered the data transmission training state, wherein the third number is greater than the fourth number. Similarly, the second data processing device enters the data transmission training state from the channel logical alignment training state in the same manner. Due to the presence of training synchronization codewords, the receiving side can clearly determine the number of channel logical alignment training codewords received. By defining the minimum number of channel logical alignment training codewords sent by the sending side and the minimum number of channel logical alignment training codewords received by the receiving side, the completion boundary of the channel logical alignment training state is determined, enabling automatic transition from the channel logical alignment training state to the data transmission training state.

[0043] In some embodiments, during the channel logical alignment training state, if the transmitting side fails to transmit the third number of channel logical alignment training codewords or the receiving side fails to receive the fourth number of channel logical alignment training codewords within a preset time period (i.e., a timeout occurs), the system will return to the initialization training state. Alternatively, the system will return to the initialization training state if an error is detected in the training character sequence.

[0044] In some embodiments, during data transmission training, if the receiving side fails to receive the transmission synchronization codeword within a preset time period (i.e., timeout), it will return to the initialization training state. Alternatively, it will return to the initialization training state if an error is detected in the training character sequence.

[0045] In some embodiments, the first data processing device includes a data buffer, and the data interaction method further includes: If the amount of data in the data buffer is greater than or equal to a first preset threshold, the training synchronization codewords currently received from the second data processing device are deleted. The first preset threshold is a pre-set safe limit for the amount of data in the data buffer; if the amount of data in the data buffer is greater than or equal to the first preset threshold, it indicates a potential risk of the data buffer overflowing.

[0046] The first and second data processing devices solve the data transmission synchronization problem between them by setting up data buffers, such as asynchronous FIFO (Asynchronous First-In-First-Out) buffers, to avoid data loss or misalignment. However, since the speed at which the first and second data processing devices read and retrieve data may differ, data buffer overflow may occur. For example, if the first data processing device acts as the receiving side and the second data processing device acts as the sending side, the data received by the first data processing device from the second data processing device will first be placed into the data buffer and then retrieved according to the asynchronous FIFO rule. If the second data processing device sends data too quickly, that is, the speed at which data is put into the data buffer in the first data processing device is greater than the speed at which data is retrieved, data buffer overflow will occur, potentially causing data loss. This embodiment reduces the amount of data in the data buffer by deleting training synchronization codewords, thereby increasing the amount of data that the data buffer can hold and avoiding the data overflow problem. The second data processing device also includes a data buffer. When the second data processing device acts as the receiving side, the implementation method and principle for avoiding data overflow are the same, and will not be repeated here.

[0047] In other embodiments, a handshake protocol can be used to prevent data buffer underflow from affecting data transmission.

[0048] It should be noted that the link training process between the first data processing device and the second data processing device is bidirectional. The first data processing device is both the sending side and the receiving side of the second data processing device, and vice versa. Therefore, both the first and second data processing devices will execute the specific implementation details of the sending-side and receiving-side actions described in the above embodiments.

[0049] This embodiment employs a data interaction method including steps 210 to 220, defining the same training synchronization codeword and N training codewords to construct N training character sequences. The first data processing device interacts with the second data processing device through the defined N training character sequences in corresponding N training states, realizing link training between the first and second data processing devices, where N is less than 11. Compared to related technologies, this embodiment reduces the number of training states in the link training process, simplifying the training states of PCIe in related technologies, thereby reducing link training time and the use of complex dedicated training characters. In the data transmission state, data interaction is performed using a defined transmission synchronization codeword different from the training synchronization codeword and service data, clearly distinguishing between data from the link training process and data from the data interaction process, avoiding false triggering of link training, and improving data interaction stability.

[0050] The data interaction method provided in this application will be described in detail below with different specific embodiments.

[0051] Example 1: Figure 5 This is a schematic diagram of a simplified structure of the sending and receiving directions provided in one embodiment of this application.

[0052] like Figure 5 As shown, the transmission directions include: Data distribution module: responsible for distributing the data transmitted from the upper layer to each lane according to the lane; Scrambling module: responsible for randomly scrambling the data of each Lane to prevent inter-symbol interference during data transmission by SerDes; Custom SYN character insertion module: Inserts a custom SYN codeword at regular intervals. The SYN codeword is the synchronization codeword, such as the training synchronization codeword or the transmission synchronization codeword.

[0053] The receiving direction includes: The custom SYN character locking module is responsible for finding periodic SYN characters from the SerDes's chaotic bit stream for data synchronization and boundary determination, thereby ensuring correct data transmission across chips. Descrambling module: Responsible for descrambling the transmitted scrambled data and restoring it to the original data; Asynchronous FIFO module: also known as asynchronous FIFO buffer, is responsible for buffering and retrieving received data according to the asynchronous first-in-first-out rule, thereby achieving data buffering; Data alignment module and decoding module: responsible for restoring the data transmitted in each Lane to the sent data according to the previous alignment.

[0054] For example, the first data processing device and the second data processing device can use the transmission direction and reception direction architecture provided in the above embodiments to realize data transmission and reception during the link training process or normal business data transmission process.

[0055] Example 2: Figure 6 This is a schematic diagram of a data flow structure with N channels provided in an example of this application.

[0056] During training and normal data transmission, the sending side periodically inserts a custom SYN codeword, but the header of the sent synchronization codeword differs depending on whether it's in normal data transmission or training. For example, a training synchronization codeword is sent during various training states, while a transmission synchronization codeword is sent during normal business data transmission. This SYN codeword configuration facilitates subsequent data stream switching.

[0057] like Figure 6 As shown, SYN_training (i.e., training synchronization codeword) is followed by the training codeword (TS0 / TS1 / TS2 in the figure), and SYN_Normal (i.e., transmission synchronization codeword) is followed by the normal service data stream (DATE in the figure). The data stream of each lane is as follows... Figure 6 As shown, both training codewords and business data reside between SYN codewords.

[0058] like Figure 6 The sequence SYN_traing+TS0 / TS1 / TS2 represents the training character sequence. Assuming the corresponding training state is T0, the training character sequence is SYN_traing+TS0.

[0059] Example 3: Figure 7 This is a schematic diagram of the state machine architecture and transitions for link training provided in an example of this application.

[0060] Reference Figure 7 Assume the simplified state machine has a total of 5 states: T0, T1, T2, T3, and Normal. Transitions between states are not allowed; only returning to the initial state T0 allows retraining until reaching the Normal state. T0, T1, T2, and T3 are four user-defined training states. After these four training states, the interface with standard PCIe's SerDes is established, enabling data transfer between the two systems within the Normal state.

[0061] The link transmitting side sends training codewords corresponding to the current state. During the transmission of training codewords, custom training synchronization codewords or transmission synchronization codewords (i.e., SYN characters) are periodically inserted. In this embodiment, during the training state, each data transmission from the transmitting side is a training character sequence consisting of a training synchronization codeword (SYN_training) and the corresponding training codeword (TS0 / TS1 / TS2), or a transmission synchronization codeword (SYN_Normal) followed by the service data to be transmitted. In the following description, the transmitting side sends a training codeword or a segment of service data along with the corresponding synchronization codeword, which will not be emphasized again.

[0062] The hardware behavior under each state is described below: T0 state (i.e., initial training state): The transmitting side sends the SYN_traning codeword (i.e., training synchronization codeword) and TS0 codeword (i.e., initial training codeword). When the state machine is in T0 state, it will complete the initialization with SerDes. The receiving side completes the locking, polarity flipping, lane inversion and adaptive equalization of the training synchronization codeword (SYN_traning). After all is completed, it enters T1 state, or it will automatically enter T1 state after timeout. T1 state (i.e., channel negotiation training state): The sending side sends TS1 codewords (i.e., channel negotiation training codewords). The TS1 codewords carry the SYN codeword locking information of both parties. After the two parties exchange and negotiate, they determine which lanes to use to continue training. When the sending side sends at least 16 TS1 codewords and the receiving side receives at least 8 TS1 codewords, it enters the T2 state. If the timeout occurs or a SYN codeword error (SYN_error) is found, it returns to the T0 state. T2 state (i.e., channel logic alignment training state): The transmitting side sends TS2 codewords (i.e., channel logic alignment training codewords). After the transmitting side sends at least 16 TS2 codewords and the receiving side receives at least 8 TS2 codewords, it enters the T3 state. The Lane that completes this process corresponds one-to-one with the Lane used in the T1 negotiation, ensuring that the Lane used for negotiation and logic matching can work normally. If a timeout occurs or a SYN codeword error is detected, it returns to the T0 state. T3 state (i.e., data transmission training state): The transmitting side sends the TS3 codeword, and the receiving side waits for the SYN_Normal codeword (i.e., transmission synchronization codeword). Note that the format of the SYN codeword (synchronization codeword) is different in the training state and the normal state. When the receiving side detects the SYN_Normal codeword, the data stream is changed from the training codeword to the service data, and the data is aligned. If a timeout occurs or an error in the SYN codeword is detected, it returns to the T0 state. Normal state: Both parties send and receive normal business data. If a SYN codeword error is detected, the system returns to T0 state to retrain.

[0063] The above embodiments utilize a custom training character sequence and training state machine to interface with PCIe's SerDes for link training, thereby completing cross-chip data transmission. Compared to related PCIe protocols, this simplifies the PCIe training state machine, reduces link training time, and minimizes the use of complex dedicated training characters.

[0064] Additionally, refer to Figure 8 As shown, one embodiment of this application also discloses a data processing apparatus 800, which includes at least one processor 810; at least one memory 820 for storing at least one program; and when the at least one program is executed by the at least one processor 810, it implements the data interaction method as described in any of the preceding embodiments.

[0065] In addition, one embodiment of this application discloses a computer-readable storage medium storing computer-executable instructions for performing data interaction methods as described in any of the preceding embodiments.

[0066] Furthermore, one embodiment of this application discloses a computer program product, including a computer program or computer instructions, which are stored in a computer-readable storage medium. A processor of a data processing device reads the computer program or computer instructions from the computer-readable storage medium and executes the computer program or computer instructions, causing the data processing device to perform the data interaction method as described in any of the preceding embodiments.

[0067] It will be understood by those skilled in the art that all or some of the steps and systems in the methods disclosed above can be implemented as software, firmware, hardware, and suitable combinations thereof. Some or all of the physical components can be implemented as software executed by a processor, such as a central processing unit, digital signal processor, or microprocessor, or as hardware, or as an integrated circuit, such as an application-specific integrated circuit. Such software can be distributed on a computer-readable medium, which can include computer storage media (or non-transitory media) and communication media (or transient media). As is known to those skilled in the art, the term computer storage media includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media includes, but is not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical disc storage, magnetic cartridges, magnetic tape, disk storage or other magnetic storage devices, or any other medium that can be used to store desired information and is accessible to a computer. Furthermore, as is known to those skilled in the art, communication media typically contain computer-readable instructions, data structures, program modules, or other data in modulated data signals such as carrier waves or other transmission mechanisms, and may include any information delivery medium.

[0068] The above is a detailed description of the preferred embodiments of this application. However, this application is not limited to the above embodiments. Those skilled in the art can make various equivalent modifications or substitutions without departing from the spirit of this application. All such equivalent modifications or substitutions are included within the scope defined by the claims of this application.

Claims

1. A data interaction method, characterized in that, Applied to a first data processing device, the method includes: Link training is completed by interacting with the second data processing device through N training character sequences and corresponding N training states. After the link training is completed, the data transmission state is entered. The N training character sequences include the same training synchronization codeword and N training codewords. The training codewords include training information. The training information in different training codewords is different. The training synchronization codeword includes a training synchronization codeword header, training information bits, reserved bits, and cyclic redundancy check (CRC) verification field bits. The training codeword includes a training codeword header, training information bits, reserved bits, and CRC verification field bits, where N is less than 11. In the data transmission state, data interaction is performed with the second data processing device through business data and transmission synchronization codewords; The N training states include an initialization training state, a channel negotiation training state, and a channel logical alignment training state. The N training codewords include an initialization training codeword, a channel negotiation training codeword, and a channel logical alignment training codeword. The initialization training state is used for the first data processing device and the second data processing device to interact with the training synchronization codeword and the initialization training codeword to complete the initialization of the physical layer between the first data processing device and the second data processing device. The channel negotiation training state is used for the first data processing device and the second data processing device to interact with the training synchronization codeword and the channel negotiation training codeword after the physical layer initialization is completed, to complete the negotiation of the physical transmission channel between the first data processing device and the second data processing device. The channel logical alignment training state is used for the first data processing device and the second data processing device to interact with the training synchronization codeword and the channel logical alignment training codeword after the physical transmission channel negotiation is completed, to complete the logical alignment of the physical transmission channel.

2. The data interaction method of claim 1, wherein, The bit width of the training codeword is determined based on the number of physical transmission channels between the first data processing device and the second data processing device.

3. The data interaction method of claim 1, wherein, Both the training synchronization codeword and the transmission synchronization codeword include a data packet header, and the content in the data packet header of the training synchronization codeword is different from the content in the data packet header of the transmission synchronization codeword.

4. The data interaction method of claim 3, wherein, The initialization of the physical layer includes at least one of the following: Initialization of the physical transmission channel between the first data processing device and the second data processing device; Locking of the training synchronization codewords; Signal polarity reversal; The physical transmission channel between the first data processing device and the second data processing device is reversed; Adaptive balancing between the first data processing device and the second data processing device.

5. The data interaction method of claim 1, wherein, The method further includes: When the second data processing device sends at least a first number of the channel negotiation training codewords, and receives at least a second number of the channel negotiation training codewords, it is determined that the channel logic alignment training state has been entered, wherein the first number is greater than the second number.

6. The data interaction method of claim 1, wherein, The N training states also include a data transmission training state, and the N training codewords also include the transmission synchronization codeword. The data transmission training state is used by the first data processing device and the second data processing device to interact with the transmission synchronization codeword after completing the logical alignment of the physical transmission channel, so as to determine the entry into the data transmission state.

7. The data interaction method of claim 6, wherein, The method further includes: When the second data processing device sends at least a third number of the channel logic alignment training codewords, and receives at least a fourth number of the channel logic alignment training codewords, it is determined that the data transmission training state has been entered, wherein the third number is greater than the fourth number.

8. The data interaction method of claim 1, wherein, The first data processing device includes a data buffer, and the method further includes: If the amount of data in the data buffer is greater than or equal to a first preset threshold, the training synchronization codewords currently received from the second data processing device are deleted.

9. A data processing apparatus, characterized by, include: At least one processor; At least one memory for storing at least one program; The data interaction method according to any one of claims 1 to 8 is implemented when at least one of the programs is executed by at least one of the processors.

10. A computer-readable storage medium storing computer-executable instructions, the computer-executable instructions comprising: The computer-executable instructions are used to execute the data interaction method according to any one of claims 1 to 8.

11. A computer program product comprising computer programs or computer instructions, characterized in that, The computer program or the computer instructions are stored in a computer-readable storage medium. The processor of the data processing device reads the computer program or the computer instructions from the computer-readable storage medium and executes the computer program or the computer instructions, causing the data processing device to perform the data interaction method according to any one of claims 1 to 8.