Chip clock precision test method based on FPGA (Field Programmable Gate Array) and related device
By looping backing event messages in the FPGA environment and calculating the clock difference, the problem of inability to test Ethernet chip clock accuracy in the FPGA environment is solved, and efficient chip clock accuracy testing is achieved, reducing design risks and testing costs.
Patent Information
- Application Number
- CN202411129603.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-16
- Publication Date
- 2024-12-03
AI Technical Summary
The existing technology cannot effectively test the clock accuracy of Ethernet chips in the FPGA environment, resulting in risks in chip design and requires a dedicated testing environment, which consumes a lot of manpower and material resources.
By looping back event messages between the switch's processor and the target port, capturing the loopback reception time, calculating the difference between the timestamp and loopback reception time, to evaluate the chip clock accuracy, the chip in the FPGA environment is realized Clock accuracy test.
No need to consider clock frequency deviation and phase deviation, tests are carried out directly on the FPGA device port, reducing chip design risks, saving manpower and material resources, and avoiding the testing needs after waiting for the chip to return to the chip.
Smart Images

Figure CN119070941A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of chip testing technology, and specifically relates to a chip clock accuracy testing method and related devices based on FPGA. Background Art
[0002] The network device clock synchronization solution provided by the IEEE1588v2 (also known as PTP) protocol has been widely used, so clock accuracy is an important concern when designing chips. Currently, the solutions for Ethernet chips to add timestamps to PTP messages mainly include application software implementation, interrupt service implementation, and hardware-assisted implementation. Among them, the hardware-assisted implementation has the highest level of accuracy, that is, when sending PTP protocol messages, the hardware adds timestamps to the messages and sends them to other network devices.
[0003] For the hardware-assisted implementation solution, since the hardware logic does not add the timestamp at the last moment when the message is sent, there is still some hardware logic in the subsequent forwarding process. The usual practice is that when the chip adds a timestamp to the message, it pre-calculates the delay caused by the subsequent logic and adds the delay to the timestamp to offset the impact of this part of the logic; if this part of the delay is calculated incorrectly, the synchronization accuracy between devices will be greatly affected, and the device may not be able to synchronize with other devices, resulting in disordered system behavior. Therefore, during the chip design stage, it is necessary to evaluate whether the accuracy of the timestamp added by the hardware meets expectations.
[0004] In the prior art, a dedicated clock accuracy tester is generally used to test the accuracy of adding timestamps to hardware. Specifically, the port to be tested of the device is connected to the clock tester, and the clock tester measures the accuracy and outputs the test results. However, the clock tester is designed to test the accuracy of the entire Ethernet device. The FPGA test environment of the chip design usually has a clock frequency difference with the real Ethernet device, which makes the clock tester unable to connect with the FPGA environment. Therefore, the clock tester cannot be used to test the accuracy during the design stage. It can only be tested after the chip is returned, which makes the chip design risky.
[0005] In order to achieve the accuracy test of adding timestamps to hardware in the FPGA test environment, the existing technology can only use other clock synchronization methods (such as 1PPS+TOD) outside the FPGA to complete the synchronization of multiple FPGAs, so as to offset the frequency deviation between different FPGA devices, and then run the PTP synchronization protocol stack for clock synchronization to test the clock synchronization accuracy. However, this solution requires the construction of a dedicated FPGA environment, and the design needs to consider the frequency deviation and phase difference between different FPGAs and the difficulty of synchronization between devices. It takes a lot of manpower and material resources to design a separate synchronization solution to offset this deviation. Summary of the invention
[0006] The purpose of this application is to provide a chip clock accuracy testing method and related devices based on FPGA, so as to solve the technical problem that the clock tester in the prior art cannot complete the test of the Ethernet chip clock accuracy in the FPGA environment, and in order to realize the chip clock accuracy test in the FPGA environment, a dedicated test environment needs to be built, which consumes a lot of manpower and material resources.
[0007] In order to achieve the above-mentioned object, the first aspect of the present application provides a chip clock accuracy test method based on FPGA, which is applied to a processor in a switch, and the method includes:
[0008] The processor assembles an event message and sends it to a target port, so that the target port adds a timestamp to the event message, loops back and forwards the event message, and captures a loopback reception time, wherein the loopback reception time is the time when the target port receives the event message after the loopback;
[0009] The processor receives the event message fed back by the target port and the loopback reception time, and calculates a difference between the timestamp and the loopback reception time;
[0010] The processor evaluates chip clock accuracy based on the difference.
[0011] In one or more implementations, the processor evaluates the chip clock accuracy based on the difference value in the following steps:
[0012] The processor calculates a variation of the difference relative to a preset value, and evaluates chip clock accuracy based on the variation.
[0013] In one or more implementations, the timestamp is added to the event message by the target port with the assistance of chip hardware.
[0014] In order to achieve the above-mentioned object, the second aspect of the present application provides a chip clock accuracy testing method based on FPGA, which is applied to a target port in a switch, and the method includes:
[0015] The target port receives an event message and adds a timestamp to the event message, the event message is assembled and sent by the processor;
[0016] The target port loops back and forwards the event message;
[0017] The target port receives the event message after the loopback, and captures the loopback reception time, wherein the loopback reception time is the reception time when the target port receives the event message after the loopback;
[0018] The target port feeds back the event message and the loopback reception time that have passed the loopback to the processor, so that the processor calculates the difference between the timestamp and the loopback reception time based on the event message and the loopback reception time, and evaluates the chip clock accuracy based on the difference.
[0019] In one or more implementations, the step of adding a timestamp to the event message by the target port is specifically:
[0020] The target port adds the timestamp to the event message with the assistance of chip hardware.
[0021] In one or more implementations, the processor evaluates the chip clock accuracy based on the difference value in the following steps:
[0022] The processor calculates a variation of the difference relative to a preset value, and evaluates chip clock accuracy based on the variation.
[0023] In one or more embodiments, before the step of receiving the event message at the target port and adding a timestamp to the event message, the step further includes:
[0024] The target port receives background traffic and forwards it.
[0025] In order to achieve the above-mentioned purpose, the third aspect of the present application provides a chip clock accuracy test device based on FPGA, which is applied to a processor in a switch, and the device includes:
[0026] A message building module, used for the processor to build an event message and send it to a target port, so that the target port adds a timestamp to the event message, loops back and forwards the event message, and captures the loopback reception time, wherein the loopback reception time is the time when the target port receives the event message after the loopback;
[0027] A time difference calculation module, configured for the processor to receive the event message fed back by the target port and the loopback reception time, and calculate the difference between the timestamp and the loopback reception time;
[0028] A clock evaluation module is used for the processor to evaluate the chip clock accuracy based on the difference.
[0029] In order to achieve the above-mentioned purpose, the fourth aspect of the present application provides a chip clock accuracy test device based on FPGA, which is applied to a target port in a switch, and the device includes:
[0030] A timestamp adding module, used for the target port to receive event messages and add a timestamp to the event messages, the event messages being assembled and sent by the processor;
[0031] A loopback forwarding module, used for the target port to loopback forward the event message;
[0032] A message receiving module, used for the target port to receive the event message after loopback, and to capture the loopback receiving time, wherein the loopback receiving time is the time when the target port receives the event message after loopback;
[0033] A feedback module is used for the target port to feed back the event message that has passed the loopback and the loopback reception time to the processor, so that the processor calculates the difference between the timestamp and the loopback reception time based on the event message and the loopback reception time, and evaluates the chip clock accuracy based on the difference.
[0034] In order to achieve the above-mentioned object, the fifth aspect of the present application provides an electronic device, including:
[0035] at least one processor; and
[0036] A memory storing instructions, which, when executed by the at least one processor, enables the at least one processor to execute the chip clock accuracy testing method as described in any of the above embodiments.
[0037] In order to achieve the above-mentioned purpose, the sixth aspect of the present application provides a machine-readable storage medium, which stores executable instructions, and when the instructions are executed, the machine executes the chip clock accuracy testing method as described in any of the above-mentioned embodiments.
[0038] Different from the prior art, the beneficial effects of this application are:
[0039] The chip clock accuracy test method of the present application performs chip clock accuracy test through loopback of a single FPGA device port. There is no need to consider the frequency deviation and phase deviation of the clock. The chip clock accuracy test can be realized in an FPGA environment. There is no need to wait for the chip to be returned and then use a clock accuracy tester for testing. There is no need to separate the Ethernet chip FPGA from the Ethernet chip to build a dedicated test environment, which saves time and effort. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0041] Figure 1It is a flowchart of an implementation method of a chip clock accuracy test method based on FPGA of the present application;
[0042] Figure 2 It is a structural schematic diagram of an implementation method of a chip clock accuracy testing device based on FPGA of the present application;
[0043] Figure 3 It is a flowchart of another implementation method of the chip clock accuracy testing method based on FPGA of the present application;
[0044] Figure 4 It is a structural schematic diagram of an implementation method of a chip clock accuracy testing device based on FPGA of the present application;
[0045] Figure 5 This is a schematic diagram of the action flow of the processor in an implementation method of the FPGA-based chip clock accuracy test method of the present application;
[0046] Figure 6 This is a schematic diagram of the action flow of an Ethernet port in an implementation method of an FPGA-based chip clock accuracy test method of the present application;
[0047] Figure 7 It is a schematic structural diagram of an embodiment of an electronic device of the present application. DETAILED DESCRIPTION
[0048] In order to enable those skilled in the art to better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only 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 the field without creative work should fall within the scope of protection of the present application.
[0049] The IEEE 1588v2 (also known as PTP) protocol adds timestamps to messages and exchanges time with other Ethernet devices through messages with timestamps to achieve time synchronization. The timestamp format is a count value with seconds as an integer starting from January 1, 1970. For example, the timestamp at 0:0:00 on January 1, 2024 is 1704038400 seconds. Two Ethernet devices calculate the average path delay and time deviation through the timestamp information of the Sync, Follow_Up, Delay_Req, and Delay_Resp messages to achieve time synchronization.
[0050] Currently, there are three main solutions for Ethernet chips to add timestamps to PTP messages: application software implementation, interrupt service implementation, and hardware-assisted implementation. Hardware-assisted implementation has the highest level of accuracy. Specifically, when sending PTP protocol messages, the hardware adds a timestamp to the message and sends it to other network devices.
[0051] However, the hardware logic does not add the timestamp at the last moment when the message is sent. Instead, it pre-calculates the subsequent delay when adding the timestamp and adds the delay to the timestamp in advance. If the delay calculation is wrong, it will affect the synchronization accuracy between devices. Therefore, during the chip design phase, it is necessary to evaluate whether the accuracy of the timestamp added by the hardware meets expectations.
[0052] Since the clock tester is designed to test the accuracy of the entire Ethernet device, the FPGA test environment of the chip design usually has a clock frequency difference with the actual Ethernet device, which makes the clock tester unable to connect with the FPGA environment. Therefore, the clock tester cannot be used to test the accuracy during the design phase. The only option is to wait for the chip to be returned for testing, which poses a risk to the chip design.
[0053] In order to achieve the accuracy test of adding timestamps to hardware in the FPGA test environment, it is only possible to use other clock synchronization methods (such as 1PPS+TOD) outside the FPGA to complete the synchronization of multiple FPGAs to offset the frequency deviation between different FPGA devices, and then run the PTP synchronization protocol stack for clock synchronization to test the clock synchronization accuracy. However, this solution requires the construction of a dedicated FPGA environment, and the design needs to consider the frequency deviation and phase difference between different FPGAs and the difficulty of synchronization between devices. It takes a lot of manpower and material resources to design a separate synchronization solution to offset this deviation.
[0054] In order to solve the above problems, the applicant has developed a new chip clock accuracy test method, which can be applied in FPGA test environment. There is no need to build a dedicated test environment, saving manpower and material resources, and there is no need to wait for the chip to be returned before using a dedicated clock accuracy test instrument for testing, thus reducing the risk of chip design.
[0055] Specifically, see Figure 1 , Figure 1 It is a flow chart of an implementation method of a chip clock accuracy test method based on FPGA of the present application.
[0056] The solution is applied to the processor of the switch, wherein the processor can be the main processor of the switch or the embedded processor of the switch, and the processor can communicate with the switching chip of the switch to realize the forwarding control of the message.
[0057] Specifically, Figure 1 As shown, the method includes:
[0058] S100A: The processor assembles an event message and sends it to the target port.
[0059] The event message is a message that needs to carry a timestamp. In one implementation, the event message may be a PTP event message constructed by the processor based on the PTP protocol.
[0060] The target port is the port that needs to test the timestamp accuracy. During the message forwarding process, the port adds a timestamp to the message with the assistance of hardware. The delay corresponding to each port may be different, so it is necessary to test each port one by one to ensure the accuracy of the timestamp of each port.
[0061] Specifically, after receiving the event message, the target port can add a timestamp to the event message with the assistance of hardware, wherein the hardware assistance can be specifically the chip assistance of the switch, and this function can be realized through the TCP timestamp option in the TCP / IP protocol.
[0062] After the target port adds a timestamp to the event message, the event message can be looped back and forwarded, that is, the event message is sent from the sending side of the target port back to the receiving side of the target port through the loopback.
[0063] After the target port receives the event message after the loopback, the loopback reception time can be captured, that is, the time when the target port receives the event message after the loopback. It can be understood that the loopback reception time is also obtained by the target port with the assistance of the chip, which is also obtained by the chip based on the actual time and the expected delay and sent to the target port.
[0064] The target port feeds back the received event message and the captured loopback reception time to the processor for subsequent calculation and evaluation. The feedback method may be to send the event message and the loopback reception time to the chip, and then send them to the processor from the chip.
[0065] S200A: The processor receives the event message fed back by the target port and the loopback receiving time, and calculates the difference between the timestamp and the loopback receiving time.
[0066] It can be understood that the timestamp represents the sending time of the event message, and the loopback reception time represents the receiving time of the event message. Both are obtained by the chip based on the actual time and the pre-calculated subsequent delay, that is, the timestamp is t1+d1, t1 is the actual time of the chip when the timestamp is added, and d1 is the subsequent sending delay pre-calculated by the chip; the loopback reception time is t2+d2, t2 is the actual time of the chip when the message is received, and d2 is the subsequent receiving delay pre-calculated by the chip.
[0067] Therefore, the difference between the timestamp and the loopback reception time is (t2-t1)+(d2-d1).
[0068] S300A, the processor evaluates the accuracy of the timestamp based on the difference.
[0069] In the above difference, since the loop from the sending side to the receiving side of the target port is constant, t2-t1 is a constant; ideally, the subsequent delays in the sending direction and the receiving direction of the target port calculated with the assistance of chip hardware should be symmetrical, so d2-d1 should be 0 in an ideal state, that is, the above difference should be a constant.
[0070] However, in reality, due to factors such as logic differences and the length of chip wiring, the subsequent delays in the sending and receiving directions of the target port are not symmetrical, resulting in changes in the above difference. The size of the change can be used to judge whether the chip time accuracy meets expectations.
[0071] Therefore, the method for the processor to evaluate the chip clock accuracy may be: calculating the change in the difference relative to the preset value, and evaluating the chip clock accuracy based on the change.
[0072] The preset value is t2-t1, which can be obtained based on the actual loopback route of the message. The change in the difference relative to the preset value represents the subsequent delay error in the sending direction and the receiving direction of the target port calculated by the chip hardware, which can represent the chip clock accuracy.
[0073] Exemplarily, when the change in the difference relative to the preset value is lower than a threshold, it can be determined that the chip clock accuracy meets the design requirements; and when the change in the difference relative to the preset value is not lower than the threshold, it is determined that the chip clock accuracy does not meet the design requirements.
[0074] In order to improve the above test effect and reflect the chip clock accuracy of the target port in a real forwarding environment, background traffic can also be sent to the target port during the test so that the target port forwards and receives event messages while forwarding the background traffic.
[0075] In one implementation, background traffic can be generated by an Ethernet traffic generator and sent to the FPGA environment, and forwarded to the target port by configuring the chip logic. In other implementations, background traffic can also be generated and sent to the target port by other methods, all of which can achieve the effect of this implementation.
[0076] Based on the above steps, since the test is performed through a loopback of a single FPGA device port, there is no need to consider the frequency deviation and phase deviation of the clock. The chip clock accuracy test in the FPGA environment can be realized. There is no need to wait for the chip to be returned and then use the clock accuracy tester for testing. There is no need to separate the Ethernet chip FPGA from the dedicated test environment, which saves time and effort.
[0077] This application also provides a chip clock accuracy test device based on FPGA, please refer to Figure 2 , Figure 2 It is a structural schematic diagram of an implementation scheme of a chip clock accuracy testing device based on FPGA of the present application.
[0078] The device is applied to the processor in the switch, such as Figure 2 As shown, the FPGA-based chip clock accuracy testing device includes a message building module 21A, a time difference calculation module 22A and a clock evaluation module 23A.
[0079] The message forming module 21A is used for the processor to form an event message and send it to the target port, so that the target port adds a timestamp to the event message, loops back and forwards the event message, and captures the loopback reception time, wherein the loopback reception time is the time when the target port receives the looped event message;
[0080] The time difference calculation module 22A is used for the processor to receive the event message fed back by the target port and the loopback reception time, and calculate the difference between the timestamp and the loopback reception time;
[0081] The clock evaluation module 23A is used for the processor to evaluate the chip clock accuracy based on the difference.
[0082] As above Figure 1 , a chip clock accuracy test method according to an embodiment of this specification is described. The details mentioned in the above description of the method embodiment are also applicable to the chip clock accuracy test device of the embodiment of this specification. The above chip clock accuracy test device can be implemented by hardware, or by software, or a combination of hardware and software.
[0083] This application also provides a chip clock accuracy test method for a target port of a switch, see Figure 3 , Figure 3 It is a flow chart of another implementation method of the chip clock accuracy testing method based on FPGA of the present application.
[0084] like Figure 3 As shown, the method includes:
[0085] S100B. The target port receives the event message and adds a timestamp to the event message.
[0086] The event message is formed and sent by the processor. In one embodiment, the event message may be a PTP event message formed by the processor based on the PTP protocol.
[0087] In one implementation, after receiving the event message, the target port can add a timestamp to the event message with the assistance of hardware, wherein the hardware assistance can be specifically the chip assistance of the switch, and this function can be implemented through the TCP timestamp option in the TCP / IP protocol.
[0088] S200B, the target port loops back and forwards the event message.
[0089] S300B, the target port receives the event message after the loopback, and captures the loopback reception time.
[0090] The loopback receiving time is the time when the target port receives the event message after the loopback.
[0091] S400B, the target port feeds back the looped event message and the looped reception time to the processor.
[0092] The processor calculates the difference between the timestamp and the loopback reception time based on the event message and the loopback reception time, and evaluates the chip clock accuracy based on the difference.
[0093] and Figure 1 The corresponding implementation manner is the same, and the method for the processor to evaluate the chip clock accuracy can be: calculating the change in the difference relative to the preset value, and evaluating the chip clock accuracy based on the change.
[0094] The preset value can be obtained based on the actual loopback route of the message. The change of the difference relative to the preset value represents the subsequent delay error of the sending direction and the receiving direction of the target port calculated by the chip hardware, which can represent the chip clock accuracy.
[0095] In order to improve the above test effect and reflect the chip clock accuracy of the target port in a real forwarding environment, in one embodiment, before S100B, the following is further included:
[0096] S100. The target port receives background traffic and forwards it.
[0097] By sending background traffic to the target port, the target port forwards and receives event messages while forwarding the background traffic.
[0098] In one implementation, background traffic can be generated by an Ethernet traffic generator and sent to the FPGA environment, and forwarded to the target port by configuring the chip logic. In other implementations, background traffic can also be generated and sent to the target port in other ways, all of which can achieve the effect of this implementation.
[0099] Based on the above steps, since the test is performed through a loopback of a single FPGA device port, there is no need to consider the frequency deviation and phase deviation of the clock. The chip clock accuracy test in the FPGA environment can be realized. There is no need to wait for the chip to be returned and then use the clock accuracy tester for testing. There is no need to separate the Ethernet chip FPGA from the dedicated test environment, which saves time and effort.
[0100] This application also provides a chip clock accuracy test device based on FPGA, please refer to Figure 4 , Figure 4 It is a structural schematic diagram of an implementation scheme of a chip clock accuracy testing device based on FPGA of the present application.
[0101] The device is applied to the target port in the switch, such as Figure 4 As shown, the FPGA-based chip clock accuracy testing device includes a timestamp adding module 21B, a loopback forwarding module 22B, a message receiving module 23B, and a feedback module 24B.
[0102] The timestamp adding module 21B is used for the target port to receive the event message and add the timestamp in the event message, and the event message is formed and sent by the processor;
[0103] The loopback forwarding module 22B is used for the target port to loopback forward the event message;
[0104] The message receiving module 23B is used for the target port to receive the event message after the loopback, and to capture the loopback receiving time, wherein the loopback receiving time is the time when the target port receives the event message after the loopback;
[0105] Feedback module 24B is used for the target port to feed back the looped event message and loopback reception time to the processor, so that the processor calculates the difference between the timestamp and the loopback reception time based on the event message and the loopback reception time, and evaluates the chip clock accuracy based on the difference.
[0106] As above Figure 3 , a chip clock accuracy test method according to an embodiment of this specification is described. The details mentioned in the above description of the method embodiment are also applicable to the chip clock accuracy test device of the embodiment of this specification. The above chip clock accuracy test device can be implemented by hardware, or by software, or a combination of hardware and software.
[0107] In a specific embodiment, the process of the chip clock accuracy testing method of the present application can be as follows: Figure 5 and Figure 6 As shown, Figure 5 This is a schematic diagram of the action flow of the processor in an implementation method of the FPGA-based chip clock accuracy test method of the present application. Figure 6It is a schematic diagram of the action flow of the Ethernet port in an implementation method of the FPGA-based chip clock accuracy test of the present application.
[0108] like Figure 5 As shown, the processor can first detect whether there is an Ethernet port to be tested. When it is determined that there is a port to be tested, a PTP message can be formed based on the PTP protocol, and the PTP message can be sent to the port to be tested; then the processor continues to detect the message sent by the chip to determine whether there is a PTP message. If so, the timestamp in the PTP message and the message reception time are recorded, and the sending and receiving time difference is calculated to evaluate the clock accuracy.
[0109] like Figure 6 As shown, the Ethernet port can continuously detect the Ethernet message to be sent to determine whether there is a PTP message. If so, a PTP timestamp is added to the message and forwarded through the port loopback. After that, the message is received through the port and continuously detected whether there is a PTP message. If so, the receiving timestamp of the PTP message is captured and sent to the processor together with the notification message.
[0110] This application also provides an electronic device, see Figure 7 , Figure 7 Schematic diagram of the structure of an electronic device of the present application. Figure 6 As shown, the electronic device 30 may include at least one processor 31, a memory 32 (e.g., a non-volatile memory), a memory 33, and a communication interface 34, and the at least one processor 31, the memory 32, the memory 33, and the communication interface 34 are connected together via a bus 35. At least one processor 31 executes at least one computer-readable instruction stored or encoded in the memory 32.
[0111] It should be understood that the computer executable instructions stored in the memory 32, when executed, cause at least one processor 31 to perform the above combined operations in various embodiments of the present specification. Figure 1-Figure 5 Describes the various operations and functions.
[0112] In the embodiments of the present specification, the electronic device 30 may include, but is not limited to, personal computers, server computers, workstations, desktop computers, laptop computers, notebook computers, mobile electronic devices, smart phones, tablet computers, cellular phones, personal digital assistants (PDAs), handheld devices, messaging devices, wearable electronic devices, consumer electronic devices, and the like.
[0113] According to one embodiment, a program product such as a machine-readable medium is provided. The machine-readable medium may have instructions (i.e., the above-mentioned elements implemented in the form of software), which, when executed by a machine, causes the machine to perform the above-mentioned combination of various embodiments of this specification. Figure 1-Figure 5Specifically, a system or device equipped with a readable storage medium may be provided, on which a software program code implementing the functions of any of the above-mentioned embodiments is stored, and a computer or processor of the system or device reads and executes the instructions stored in the readable storage medium.
[0114] In this case, the program code itself read from the machine-readable medium can realize the function of any one of the above embodiments, and thus the machine-readable code and the machine-readable storage medium storing the machine-readable code constitute part of this specification.
[0115] Examples of readable storage media include floppy disks, hard disks, magneto-optical disks, optical disks (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD-RW), magnetic tapes, non-volatile memory cards, and ROMs. Alternatively, the program code may be downloaded from a server computer or a cloud via a communication network.
[0116] Those skilled in the art should understand that the various embodiments disclosed above can be modified and altered in various ways without departing from the essence of the invention. Therefore, the protection scope of this specification should be defined by the appended claims.
[0117] It should be noted that not all steps and units in the above-mentioned processes and system structure diagrams are necessary, and some steps or units can be ignored according to actual needs. The execution order of each step is not fixed and can be determined as needed. The device structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some units may be implemented by the same physical client, or some units may be implemented by multiple physical clients, or some components in multiple independent devices may be implemented together.
[0118] In the above embodiments, the hardware unit or module can be realized by mechanical or electrical means. For example, a hardware unit, module or processor can include permanent dedicated circuit or logic (such as special processor, FPGA or ASIC) to complete the corresponding operation. The hardware unit or processor can also include programmable logic or circuit (such as general-purpose processor or other programmable processor), which can be temporarily set by software to complete the corresponding operation. Specific implementation (mechanical method or dedicated permanent circuit or temporary circuit) can be determined based on cost and time consideration.
[0119] The specific embodiments described above in conjunction with the accompanying drawings describe exemplary embodiments, but do not represent all embodiments that can be implemented or fall within the scope of protection of the claims. The term "exemplary" used throughout this specification means "used as an example, instance or illustration" and does not mean "preferred" or "having advantages" over other embodiments. For the purpose of providing an understanding of the described technology, the specific embodiments include specific details. However, these technologies can be implemented without these specific details. In some instances, in order to avoid making the concepts of the described embodiments difficult to understand, well-known structures and devices are shown in block diagram form.
[0120] The above description of the present disclosure is provided to enable any person of ordinary skill in the art to implement or use the present disclosure. Various modifications to the present disclosure will be apparent to those of ordinary skill in the art, and the general principles corresponding to the present disclosure may be applied to other variations without departing from the scope of protection of the present disclosure. Therefore, the present disclosure is not limited to the examples and designs described herein, but is consistent with the widest range of principles and novel features disclosed herein.
Claims
1. A chip clock accuracy test method based on FPGA, characterized in that: Applied to a processor in a switch, the method comprises: The processor assembles an event message and sends it to a target port, so that the target port adds a timestamp to the event message, loops back and forwards the event message, and captures a loopback reception time, wherein the loopback reception time is the time when the target port receives the event message after the loopback; The processor receives the event message fed back by the target port and the loopback reception time, and calculates a difference between the timestamp and the loopback reception time; The processor evaluates chip clock accuracy based on the difference.
2. The chip clock accuracy testing method according to claim 1, characterized in that: The step of the processor evaluating the chip clock accuracy based on the difference is specifically: The processor calculates a change in the difference relative to a preset value, and evaluates chip clock accuracy based on the change.
3. The chip clock accuracy testing method according to claim 1, characterized in that: The timestamp is added to the event message by the target port with the assistance of chip hardware.
4. A chip clock accuracy test method based on FPGA, characterized in that: Applied to a target port in a switch, the method comprises: The target port receives an event message and adds a timestamp to the event message, the event message is assembled and sent by the processor; The target port loops back and forwards the event message; The target port receives the event message after the loopback, and captures the loopback reception time, wherein the loopback reception time is the time when the target port receives the event message after the loopback; The target port feeds back the event message and the loopback reception time that have passed the loopback to the processor, so that the processor calculates the difference between the timestamp and the loopback reception time based on the event message and the loopback reception time, and evaluates the chip clock accuracy based on the difference.
5. The chip clock accuracy testing method according to claim 4, characterized in that: The step of adding a timestamp to the event message by the target port is specifically as follows: The target port adds the timestamp to the event message with the assistance of chip hardware.
6. The chip clock accuracy testing method according to claim 4, characterized in that: The step of the processor evaluating the chip clock accuracy based on the difference is specifically: The processor calculates a variation of the difference relative to a preset value, and evaluates chip clock accuracy based on the variation.
7. The chip clock accuracy testing method according to claim 4, characterized in that: The step of receiving the event message at the target port and adding a timestamp to the event message also includes: The target port receives background traffic and forwards it.
8. A chip clock accuracy test device based on FPGA, characterized in that: A processor applied to a switch, the device comprising: A message building module, used for the processor to build an event message and send it to a target port, so that the target port adds a timestamp to the event message, loops back and forwards the event message, and captures the loopback reception time, wherein the loopback reception time is the time when the target port receives the event message after the loopback; A time difference calculation module, configured for the processor to receive the event message fed back by the target port and the loopback reception time, and calculate the difference between the timestamp and the loopback reception time; A clock evaluation module is used for the processor to evaluate the chip clock accuracy based on the difference.
9. A chip clock accuracy test device based on FPGA, characterized in that: Applied to a target port in a switch, the device comprises: A timestamp adding module, used for the target port to receive event messages and add a timestamp to the event messages, the event messages being assembled and sent by the processor; A loopback forwarding module, used for the target port to loopback forward the event message; A message receiving module, used for the target port to receive the event message after loopback, and to capture the loopback receiving time, wherein the loopback receiving time is the time when the target port receives the event message after loopback; A feedback module is used for the target port to feed back the event message that has passed the loopback and the loopback reception time to the processor, so that the processor calculates the difference between the timestamp and the loopback reception time based on the event message and the loopback reception time, and evaluates the chip clock accuracy based on the difference.
10. An electronic device comprising: at least one processor; as well as A memory storing instructions, which, when executed by the at least one processor, enables the at least one processor to execute the chip clock accuracy testing method as described in any one of claims 1 to 7.
11. A machine-readable storage medium storing executable instructions, wherein when the instructions are executed, the machine executes the chip clock accuracy testing method according to any one of claims 1 to 7.
Citation Information
Cited By
Transmission delay measurement method and system for secure real-time bus (SRB)
CN119341948A
A method and system for measuring transmission delay of a secure real-time bus (SRB)
CN119341948B
