Efficient automatic testing method based on TCL and Python script

By using automated testing methods based on TCL and Python scripts in FPGA board testing, the problem of complex and time-consuming testing in the existing technology is solved, and an efficient, accurate and repeatable testing process is achieved.

CN119557151APending Publication Date: 2025-03-04成都中微达信科技有限公司
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411674080.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-21
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

In small batch FPGA board testing, the prior art results in complex and long testing processes, especially due to the lack of automation tools, testers need to manually control the instrument, export and analyze the data.

Method used

Using an efficient automatic testing method based on TCL and Python scripts, the testing instruments and signal sources are controlled by the host computer to automatically complete the test process, including signal testing, data export and analysis.

Benefits of technology

An automated test process is realized, which significantly reduces the time and error rate of manual operation and improves test efficiency, accuracy and repeatability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557151A_ABST
    Figure CN119557151A_ABST
Patent Text Reader

Abstract

The invention discloses an efficient automatic testing method based on TCL and Python scripts, and relates to the technical field of testing, the method comprises the following steps: S1, setting an upper computer for controlling testing, and setting a data testing instrument, a signal source and a data acquisition board card which are respectively in signal connection with the upper computer for the upper computer; s2, the signal source is in signal connection with a data acquisition board card, and a signal output by the data acquisition board card is set as a target test signal; s3, calling a Python script by using a TCL script to control a data test instrument to start a signal test process; s4, calling a Python script to generate a final result file according to an analysis result of the test data; and S5, reading a data analysis result from the final result file. Automatic control is achieved through the preset TCL and Python scripts, starting, data collection and analysis of the whole testing process can be automatically completed, and the method has the advantages of reducing the manual error rate and improving the testing efficiency, precision and repeatability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of testing technology, and in particular to a high-efficiency automatic testing method based on TCL and Python scripts. Background Art

[0002] In the data acquisition board test, it may be necessary to quickly test the ADC / DAC on the board, but this test requires a lot of test items and is cumbersome. Moreover, in some small-batch boards, R&D personnel often do not make a dedicated test system to test the board. Testers need to complete the test manually step by step. For example, to perform an ADC test index test, the tester first needs to change the signal source output frequency, then manually export the data from ILA through VIVADO software, and finally analyze the exported data to obtain the results. Assuming that the test range is from 10-2500MHz, with a step of 10MHz, a total of 250 frequency points need to be tested. It takes about one minute to test one frequency point, and it takes about 4 hours to test all frequency points. This is just the time consumed by one ADC channel. A high-speed signal processing board often contains several or even more than ten ADC / DAC channels. In the existing method, it takes a huge amount of time to complete the data testing of these ADC / DACs. Usually, the test system requires the board to provide a data export interface, such as exporting data analysis through the network port or serial port; however, some board components often cannot provide the data export interface required by the test system, and only the JTAG debugging interface is used as the data export interface; if the test tool is automated, a large amount of test data needs to be exported manually, which is time-consuming. Therefore, in the existing technology, in the small batch board test, the tester needs to spend a lot of time controlling the instrument, exporting data, and analyzing data, and the board needs to be forced to provide the data interface of the test system. Summary of the invention

[0003] The present invention provides a high-efficiency automatic testing method based on TCL and Python scripts, which solves the problems of complex process and long time spent in testing FPGA board system in the prior art.

[0004] The present invention is achieved through the following technical solutions: An efficient automatic testing method based on TCL and Python scripts, the method comprising: Step S1: setting a host computer for controlling the test, and setting a data test instrument, a signal source and a data acquisition board which are respectively connected to the host computer signals, wherein the host computer and the data acquisition board are connected via a JTAG port; Step S2: the signal source signal is connected to a data acquisition board, the signal output by the data acquisition board is set as a target test signal, and the target test signal is transmitted to a data test instrument as an original signal for a signal test process; Step S3: Preset a TCL script and a Python script on the host computer, use the TCL script to call the Python script to control the data test instrument to start the signal test process, and export the test data generated by the signal test process to the host computer; Step S4: Using the TCL script to call the Python script on the host computer to analyze the test data, presetting the test judgment mechanism in the TCL script, and generating a final result file based on the data analysis results of the Python script for the test data; Step S5: Use the test judgment mechanism to read the data analysis result from the final result file. When the test result is judged to be valid, the test process is judged to be completed and the test process is ended. When the test result is judged to be invalid, return to step S3 to retest.

[0005] In the existing method, it takes a huge amount of time to complete the data testing of these ADC / DACs. Usually, the test system requires the board to provide a data export interface, such as exporting data analysis through a network port or a serial port; however, some board components often cannot provide the data export interface required by the test system, and only the JTAG debugging interface is used as a data export interface; if a free automated test tool is used, a large amount of test data needs to be exported manually, which is time-consuming. Therefore, in the prior art, in the small batch board test, the tester needs to spend a lot of time controlling the instrument, exporting data, and analyzing data, and the board needs to be forced to provide the data interface of the test system. Based on this, the present invention provides an efficient automatic testing method based on TCL and Python scripts to solve the problem of complex process and long time spent when testing the FPGA board system in the prior art.

[0006] Furthermore, the frequency amplitude of the signal source is respectively provided with three different frequency amplitude intervals of high frequency, medium frequency and low frequency, and the target signal type of the signal source is obtained through the signalType variable in the database; each frequency amplitude interval of the signal source has at least one corresponding TCL script configuration.

[0007] Furthermore, the parameters configured by the TCL script include the output gain, output impedance and bias voltage when adjusting the output signal source of the data test instrument; the target test signal includes three signal wave types, including sine wave, triangle wave and square wave, and the parameters configured by the TCL script meet the working parameters of the three signal wave types in each frequency amplitude range; The frequency amplitude range of the high-frequency target test signal is set to be between 50MHZ and 5GHZ; The frequency amplitude range of the intermediate frequency target test signal is set to be between 500KHZ and 50MHZ; The frequency amplitude range of the low-frequency target test signal is set to be between 5 Hz and 500 kHz.

[0008] Furthermore, the setting sizes of the TCL script configuration parameters in the three different frequency amplitude intervals include: The output gain is set as follows: at high frequencies, the output voltage gain of the signal source is set to 1-2 times; at medium frequencies, the output voltage gain of the signal source is set to 5-10 times; and at low frequencies, the output voltage gain of the signal source is set to 10-20 times. The output impedance is set as follows: at high frequencies, the output impedance of the signal source is set to a constant 50Ω, at medium frequencies, the output impedance of the signal source is set to 50-75Ω, and at low frequencies, the output impedance of the signal source is set to 600-1000Ω; The bias voltage is set as follows: the voltage value for the signal source at high frequency is set to 0.1V to 0.2V, the voltage value for the signal source at medium frequency is set to 0.1V to 0.5V, and the voltage value for the signal source at low frequency is set to 1V to 5V.

[0009] Furthermore, the content of the test judgment mechanism of the TCL script includes: using the TCL script to call the Python script to analyze the test data. All status codes generated, select the status code to simulate the frequency response test of the target test signal, randomly output a power measurement value in the frequency response test, write the power measurement value into the TCL script to generate a return value, when the return value is 0, it indicates that the test is successful, and when the return value is not 0, it indicates that the test is not completed or the test has failed.

[0010] Further, the process of selecting the state code to simulate the execution of the frequency response test includes: setting the power measurement range of the power measurement value for the TCL script, performing the frequency response test on the target test signal one by one for all the state codes, When the power measurement value generated by the test is lower than the power critical range, the return value generated in the TCL script of the output power measurement value is set to 1, and the selected status code is determined to be invalid; When the power measurement value generated by the test is within the power measurement range, the return value generated in the TCL script for the output power measurement value is set to 2, and it is determined that the test process is still in progress; When the power measurement value generated by the test exceeds the power critical range, the return value generated in the TCL script of the output power measurement value is set to 0, and it is determined that the selected status code is valid and the test process is completed.

[0011] Furthermore, a tolerance threshold is set at the lower boundary of the power measurement range. When the power measurement value generated by the selected status code is lower than the power critical range and within the tolerance threshold, the return value generated by the output power measurement value in the TCL script is set to 2, and it is determined that the test process is still in progress.

[0012] Furthermore, the process of using TCL script to call Python script to analyze test data includes: using VIVADO's own ILA data format to obtain export commands in the host computer, using the export command to export the test data in VIVADO, and then using TCL script to call Python script to analyze the test data.

[0013] Furthermore, the TCL script exports the test data and stores it as a CSV file, calls the Python script to analyze the CSV file, generates an intermediate result file after the analysis is completed, uses the TCL script to read the intermediate result file and generates a final result file based on the data analysis results in the intermediate result file.

[0014] Furthermore, a parallel asynchronous processing method is used in the TCL script to call the Python script to perform test data analysis.

[0015] Compared with the prior art, the present invention realizes automatic control through preset TCL and Python scripts, and the startup, data collection and analysis of the entire test process can be completed automatically. The automated script can repeat the test many times in a short period of time, and through a unified code and judgment mechanism, it ensures that the steps of each test are consistent, avoiding test errors caused by improper manual operation, and has the advantages of reducing labor costs and error rates and improving test efficiency, accuracy and repeatability. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings described herein are used to provide a further understanding of the embodiments of the present invention, constitute a part of this application, and do not constitute a limitation of the embodiments of the present invention. In the drawings: Figure 1 It is a flowchart of the present invention. DETAILED DESCRIPTION

[0017] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with embodiments and drawings. The exemplary embodiments of the present invention and their description are only used to explain the present invention and are not intended to limit the present invention. Example

[0018] like Figure 1 As shown, the present invention provides an efficient automatic testing method based on TCL and Python scripts, the method comprising: Step S1: setting a host computer for controlling the test, and setting a data test instrument, a signal source and a data acquisition board which are respectively connected to the host computer signals, wherein the host computer and the data acquisition board are connected via a JTAG port; Step S2: the signal source signal is connected to a data acquisition board, the signal output by the data acquisition board is set as a target test signal, and the target test signal is transmitted to a data test instrument as an original signal for a signal test process; Step S3: Preset a TCL script and a Python script on the host computer, use the TCL script to call the Python script to control the data test instrument to start the signal test process, and export the test data generated by the signal test process to the host computer; Step S4: Using the TCL script to call the Python script on the host computer to analyze the test data, presetting the test judgment mechanism in the TCL script, and generating a final result file based on the data analysis results of the Python script for the test data; Step S5: Use the test judgment mechanism to read the data analysis result from the final result file. When the test result is judged to be valid, the test process is judged to be completed and the test process is ended. When the test result is judged to be invalid, return to step S3 to retest.

[0019] The host computer usually refers to a computer system responsible for coordinating and managing other hardware devices and test processes in the test system. It is usually the main device for data interaction and control instruction transmission with the lower computer (such as FPGA board, test instrument, etc.). As the "control center" of the entire test process, the host computer is responsible for managing and scheduling all test tasks. It executes the test plan, issues test instructions, controls the behavior of the lower computer, and collects test results for analysis. The data test instrument refers to various instruments and equipment used to measure, analyze and verify the performance of electronic systems. In the specific implementation, the data test instrument mainly includes oscilloscopes, spectrum analyzers, network analyzers, signal generators and other equipment. The data acquisition board is used to collect and convert analog or digital signals from various signal sources into data that can be processed and analyzed by computers. Its main function is to sample, amplify, filter, convert and process the input signal, and then transmit the data to the host computer or other processing system for further analysis. In the specific implementation, the data acquisition board may include specific application equipment such as analog input and output modules, digital input and output modules, FPGA boards and high-speed sampling modules. The target test signal is transmitted as an input signal to the data test instrument, so that this signal is the basic signal of the test process, and all subsequent tests, data acquisition and analysis will be based on this original signal.

[0020] The TCL script acts as a "scheduler" or "controller", which is responsible for calling and managing the operations of hardware resources such as Python scripts, test instruments, and signal sources. Automated control can be achieved through TCL scripts, including starting tests, reading device status, adjusting parameters, etc. The Python script is used for complex data analysis, calculation, processing, and result determination. After the TCL script is triggered, the Python script will process and analyze the data obtained during the test and output the test results or reports. Before the actual test begins, the TCL and Python scripts have been written and saved on the host computer. The tester does not need to manually write or modify the script during the test, which ensures the uniformity and consistency of the test process. After receiving the control signal, the signal test instrument will generate a preset test signal and start the test. The Python script interacts with the data test instrument through appropriate instructions to ensure that the test process is executed according to the predetermined requirements. During the test, the data test instrument will generate relevant test data according to the test requirements. These data may include information such as the amplitude, frequency, phase, noise level, etc. of the signal, depending on the specific test objectives. After the test data is generated, the Python script will export the data to the host computer, usually through a file (such as CSV, TXT, etc.) or through a network interface (such as TCP / IP, USB, etc.) to transfer it to the host computer. This process ensures that the test data can be saved and further analyzed. During data analysis, the TCL script performs data analysis by calling the Python script. The Python script performs a detailed analysis of the data collected from the test instrument according to a preset analysis method (such as statistical analysis, mathematical modeling, signal processing, etc.), extracts useful information and generates analysis results. The Python script will generate a final result file based on the analysis results. This file contains the analysis results of the test data, such as whether it meets the test standards, whether it passes the test, and the value of the test data. When the data analysis results in the final result file read meet the preset valid standards, the test is judged to be "valid", that is, the test has achieved the expected goal and the result is successful; when the data in the result file does not meet the valid standards, for example, the test data has anomalies, errors or deviations, the system will judge the test result as "invalid". At this time, the system will return to step S3, that is, restart the test process.

[0021] Furthermore, as a feasible implementation method, the frequency amplitude of the signal source is respectively provided with three different frequency amplitude ranges of high frequency, medium frequency and low frequency, and the target signal type of the signal source is obtained through the signalType variable in the database; each frequency amplitude range of the signal source has at least one corresponding TCL script configuration.

[0022] The output signal of the signal source is divided into three intervals of high frequency, medium frequency and low frequency in frequency. This means that the signal source can generate test signals in different frequency ranges as needed to meet different test requirements. Signals in different frequency intervals may differ in signal transmission, signal quality, interference effects, etc. By distinguishing the frequency amplitude of the signal source, the test can more accurately simulate the working environment under different conditions, thereby improving the comprehensiveness and pertinence of the test. In this embodiment, the target signal type of the signal source is obtained through the signalType variable stored in the database, that is, the system can dynamically select the signal type to be generated according to the external or preset configuration, and can automatically adjust the output signal of the signal source according to the test requirements. The signalType variable can represent different signal attributes, such as different modulation modes (such as AM, FM), waveform types (such as sine wave, square wave) or specific test signal formats. Through database query, the system can automatically select the corresponding signal source configuration to ensure the correctness and diversity of the test signal. Each TCL script configuration may include the adjustment of signal source parameters such as frequency, amplitude, modulation mode, signal acquisition settings, and data analysis process configuration; signals in different frequency ranges may require different test strategies, so each frequency range will have a corresponding script configuration.

[0023] Further, as a feasible implementation method, the parameters configured by the TCL script include the output gain, output impedance and bias voltage when adjusting the output signal source of the data test instrument; the target test signal includes three signal wave types, including sine wave, triangle wave and square wave, and the parameters configured by the TCL script meet the working parameters of the three signal wave types in each frequency amplitude range; The frequency amplitude range of the high-frequency target test signal is set to be between 50MHZ and 5GHZ; The frequency amplitude range of the intermediate frequency target test signal is set to be between 500KHZ and 50MHZ; The frequency amplitude range of the low-frequency target test signal is set to be between 5 Hz and 500 kHz.

[0024] The output gain refers to the amplitude amplification factor of the signal output by the signal source. In the test, the gain determines the strength or amplitude of the signal, and the gain setting ensures that the signal is output within the appropriate amplitude range. When the test system is required to be able to handle larger signals, the gain can increase the amplitude of the signal. For example, for high-frequency testing, the signal may be weakened due to propagation loss or device attenuation, so the gain needs to be increased to ensure sufficient signal strength. By accurately adjusting the gain, it is possible to avoid situations where the signal is too weak or too strong, resulting in the inability to correctly analyze the signal, signal distortion, or equipment damage. In some specific implementations of high-precision measurements, the control of the signal amplitude is crucial to the accuracy of the test results.

[0025] The output impedance is the electrical impedance at the output end of the signal source. The output impedance should be matched with the input impedance of the receiving device (such as a data test instrument or related carrier circuit, etc.) to reduce signal reflection and energy loss. Matching impedance can ensure that the power of the signal source is effectively transferred to the load end. If the output impedance does not match the input impedance of the receiving device, signal reflection will occur, resulting in partial signal loss and even measurement errors. Impedance matching is particularly important in high-frequency signal testing because unmatched impedance will affect the amplitude and shape of the signal and may even cause system failure. By adjusting the output impedance, the maximum power transmission of the signal from the source end to the load end can be ensured and the signal attenuation can be reduced.

[0026] The bias voltage refers to the DC voltage applied in the signal source to adjust the DC level of the signal. During the test process, some signals (such as analog signals, sine waves, triangle waves, etc.) require a specific bias voltage to ensure the correct output and transmission of the signal; the bias voltage is usually used to move the AC signal from the zero level to a suitable working level so that it can effectively reflect the response characteristics of the device during the test process. For some analog signals, especially sine waves, triangle waves, square waves, etc., if there is no suitable bias voltage, the signal may exceed the input range of the device or cannot be correctly identified by the test system. The setting of the bias voltage helps to ensure that the signal is always in the linear working range of the receiving device. By controlling the bias voltage, the distortion of the signal caused by too low or too high a level can be avoided. For example, in the specific implementation of the test, the input signal may require an appropriate bias to ensure its linear response in the receiving device without being clipped or stretched. In the analog signal test, the bias voltage helps to ensure that the signal waveform is stable and can reflect the performance of the device under test in the actual working environment.

[0027] The adjustment of output gain, output impedance and bias voltage in the TCL script configuration enables the signal source to accurately output signals according to different test requirements, avoiding test errors caused by signal amplitude, waveform mismatch or signal distortion. By finely controlling these parameters, the test system can better adapt to the test requirements of high-frequency, medium-frequency and low-frequency signals, ensuring the accuracy and repeatability of the test results.

[0028] Further, as a feasible implementation manner, the setting sizes of the TCL script configuration parameters in the three different frequency amplitude intervals include: The output gain is set as follows: at high frequencies, the output voltage gain of the signal source is set to 1-2 times; at medium frequencies, the output voltage gain of the signal source is set to 5-10 times; and at low frequencies, the output voltage gain of the signal source is set to 10-20 times. The output impedance is set as follows: at high frequencies, the output impedance of the signal source is set to a constant 50Ω, at medium frequencies, the output impedance of the signal source is set to 50-75Ω, and at low frequencies, the output impedance of the signal source is set to 600-1000Ω; The bias voltage is set as follows: the voltage value for the signal source at high frequency is set to 0.1V to 0.2V, the voltage value for the signal source at medium frequency is set to 0.1V to 0.5V, and the voltage value for the signal source at low frequency is set to 1V to 5V.

[0029] Since the gain of the high-frequency signal source is low, it is mainly because the transmission of the signal itself will have a certain attenuation in the high-frequency range, so there is no need for too large a gain. Setting the gain value to 1-2 times can avoid over-amplification of the signal, resulting in signal distortion or unnecessary interference; the gain setting method is used to ensure that the high-frequency signal maintains a good waveform and prevents noise or nonlinear distortion caused by excessive gain, which is suitable for high-frequency signal testing such as radio frequency and electromagnetic compatibility. The intermediate frequency signal is relatively stable compared to the high-frequency signal, so the gain can be appropriately increased to ensure that the amplitude of the signal is moderate, especially when there may be a certain loss between the signal source and the test equipment; by setting a moderate gain, it can be ensured that the signal has sufficient strength in the intermediate frequency range, while avoiding excessive amplification of the signal, thereby ensuring the clarity of the signal and the accuracy of the test results. Low-frequency signals are often affected by electrical noise, so a larger gain is required to ensure the strength of the signal; setting the gain to 10-20 times can compensate for the attenuation of the signal, ensuring that the low-frequency signal can be effectively transmitted and not overwhelmed by noise. Higher gain helps to obtain clear and stable signals in the low-frequency range, so that the low-frequency signal can maintain sufficient strength during the test and avoid noise interference. In RF and high-frequency signal testing, setting the output impedance to 50Ω is a widely used standard impedance value to ensure effective signal transmission and avoid reflection. In the intermediate frequency range, the impedance of the signal source can be slightly loosely adjusted between 50Ω and 75Ω to adapt to different devices and loads. This range can flexibly adapt to the requirements of a variety of intermediate frequency devices. Within this range, the transmission quality of the signal will not be significantly affected, and it can support a variety of intermediate frequency devices and test configurations to ensure stable signal transmission. Low-frequency signals are often used in audio equipment, power systems, etc., which usually have higher input impedance. Therefore, the output impedance of the signal source needs to be higher to match the requirements of these devices; setting a high impedance setting in the low-frequency signal segment helps reduce reflection and distortion of low-frequency signals, especially in long-distance transmission or parallel testing of multiple devices, which can effectively ensure the quality of the signal and test accuracy.

[0030] Regarding the bias voltage setting, because in high-frequency signal testing, the DC bias of the signal needs to be kept low to avoid excessive influence on the shape of the signal, setting a low bias voltage ensures the integrity of the signal waveform and prevents distortion caused by excessive bias. The bias voltage range of 0.1V to 0.2V helps to ensure the accuracy of the signal, especially when the amplitude of the high-frequency signal is small, avoiding signal offset or distortion caused by excessive bias voltage. In the intermediate frequency signal, the bias voltage can be appropriately increased to ensure that the signal will not be lost or cannot be properly processed due to low voltage during transmission. Therefore, setting it to 0.1V to 0.5V has a proper increase in the upper limit of the voltage. This bias range can provide sufficient DC level to support signal transmission and avoid excessive fluctuation or distortion of the signal, which is suitable for testing and analysis of various intermediate frequency signals. The bias voltage of low-frequency signals is higher, especially in audio and low-frequency power systems. Higher bias voltages can ensure the stability and transmission effect of signals in these systems; higher bias voltages can ensure that the amplitude of low-frequency signals is moderate, avoid "clipping" or excessive attenuation of signals, and ensure the accuracy of the test system. Through detailed settings of output gain, output impedance and bias voltage for different frequency ranges, it is ensured that the signal source can accurately output appropriate test signals in the high frequency, medium frequency and low frequency ranges. These refined configurations can maximize the stability and accuracy of signal transmission and avoid signal distortion or test errors.

[0031] Further, as a feasible implementation method, the content of the test judgment mechanism of the TCL script includes: using the TCL script to call the Python script to analyze the test data, all the status codes generated, selecting the status code to simulate the frequency response test of the target test signal, randomly outputting a power measurement value in the frequency response test, writing the power measurement value into the TCL script to generate a return value, when the return value is 0, it indicates that the test is successful, when the return value is not 0, it indicates that the test is not completed or the test fails; the process of selecting the status code to simulate the frequency response test includes: setting the power measurement range of the power measurement value for the TCL script, performing the frequency response test on the target test signal one by one with all the status codes, When the power measurement value generated by the test is lower than the power critical range, the return value generated in the TCL script of the output power measurement value is set to 1, and the selected status code is determined to be invalid; When the power measurement value generated by the test is within the power measurement range, the return value generated in the TCL script for the output power measurement value is set to 2, and it is determined that the test process is still in progress; When the power measurement value generated by the test exceeds the power critical range, the return value generated in the TCL script of the output power measurement value is set to 0, and it is determined that the selected status code is valid and the test process is completed.

[0032] The TCL script acts as the main control script and handles complex test data analysis by calling the Python script. The Python script performs actual test data calculations and generates status codes, and the TCL script determines whether the test process is going smoothly, whether the test needs to continue, or when to terminate the test based on these status codes. Each status code represents a specific condition or test stage in the test process. These status codes not only reflect the test results, but also play a key control role in the TCL script and determine the next step of the test process. In the frequency response test, the Python script simulates the output of a power measurement value. This power measurement value is a response to the test signal, and its size will determine the state and results of the test. In a specific implementation, the power measurement range can be set according to the test objectives and accuracy requirements to be achieved. When the power measurement value exceeds the preset power critical range, the system considers that the test has been completed and the results are valid, so the return value is set to 0, indicating that the test is successful. At this time, the TCL script terminates the test process and records the results. When the power measurement value is lower than the power critical range, the test result is considered invalid, so the return value is set to 1, indicating that the test failed, or the power value is too low to determine the test result. At this time, the TCL script will mark the status code invalid and can trigger a retest or abort the test. When the power measurement value is within the preset power range, the test process is considered to be still in progress. The return value of 2 indicates that the test has not yet ended. The system will continue to execute the test until the test is completed. By associating the return value with the power measurement value, the TCL script can automatically determine the result of each test and control the test process. After each test, the TCL script will automatically decide whether to end the test or whether it needs to be restarted based on the different power values. As a specific implementation, the power measurement range can be set as follows: in the high-frequency signal segment, because the power of the RF signal is generally low and precise measurement is required, the range is set to -30dBm to +10dBm; in the intermediate-frequency signal segment, the power range can be appropriately expanded to accommodate more test applications, and the range is set to -20dBm to +20dBm; in the low-frequency signal segment, because the test application may have a larger power output, such as a power system or other test scenarios requiring a stronger power signal, the range is set to 0dBm to +50dBm.

[0033] In particular, a tolerance threshold is set at the lower boundary of the power measurement range. When the power measurement value generated by the selected status code is lower than the power critical range and within the tolerance threshold, the return value generated by the output power measurement value in the TCL script is set to 2, and it is determined that the test process is still in progress.

[0034] The tolerance threshold refers to the fluctuation range of the power measurement value allowed during the test, which specifies the acceptable error range between the measured value and the ideal standard value. In actual testing, factors such as signal and system noise may cause small fluctuations in the power measurement value. Such fluctuations do not necessarily mean that the test has failed. Therefore, the tolerance threshold is set to tolerate these small fluctuations and prevent misjudgment. It is usually set to an ideal value or range to determine whether the signal strength meets the requirements. When the power measurement value is lower than the critical range, it is usually considered that the test has failed or is invalid. In specific applications, the tolerance threshold can be set according to the accuracy and error range of the test equipment. For example, if the error range of the equipment is ±2 dBm, then the tolerance threshold can be set to ±2 dBm, that is, when the power measurement value is within this range, the system does not consider it to be an erroneous measurement; or based on the analysis of past test data, the common power fluctuation range in the actual test process can be determined, thereby setting a reasonable tolerance threshold. The setting of the tolerance threshold improves the fault tolerance, stability and reliability of the test, helps to avoid premature termination of the test or frequent retesting, and ensures a more accurate test process.

[0035] Furthermore, as a feasible implementation method, the process of using TCL script to call Python script to analyze test data includes: using VIVADO's own ILA data format to obtain the export command in the host computer, using the export command to export the test data in VIVADO, and then using the TCL script to call the Python script to analyze the test data; the TCL script stores the test data as a CSV file when exporting, calls the Python script to analyze the CSV file, generates an intermediate result file after the analysis is completed, uses the TCL script to read the intermediate result file and generates the final result file with the data analysis results in the intermediate result file; uses the parallel asynchronous processing method in the TCL script to call the Python script to perform test data analysis.

[0036] The VIVADO is an FPGA development tool that provides many functions for design, debugging and verification, including an integrated logic analyzer ILA. ILA can capture FPGA internal signals in real time, perform data acquisition and analysis, and help developers debug and optimize designs. The TCL script can automatically call the commands provided by VIVADO, obtain the exported data, and pass it to the Python script for further processing. Through this automated process, manual intervention can be reduced to ensure the consistency and accuracy of each test data export. The CSV file contains the signal data collected during the FPGA test process, usually the time series, logic state, etc. of the signal. The Python script is responsible for parsing this data and performing further analysis, such as the amplitude, frequency, and waveform analysis of the signal. Python's data processing capabilities can efficiently process this data and perform various mathematical operations and visualization operations. Since the amount of test data is usually large and the calculations involved in data analysis may be complex, traditional synchronous processing methods may result in a long processing time. Therefore, the introduction of parallel asynchronous processing technology can significantly improve the efficiency of the data analysis process. Through automated TCL scripts and efficient Python script data analysis methods, combined with VIVADO ILA export, CSV data storage, and parallel asynchronous processing, the efficiency and accuracy of test data processing are improved. The entire process not only improves the automation level of the test process, but also shortens the test time while ensuring accurate analysis, making FPGA testing in complex test scenarios more efficient.

[0037] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. An efficient automatic testing method based on TCL and Python scripts, characterized in that: The method includes: Step S1: setting a host computer for controlling the test, and setting a data test instrument, a signal source and a data acquisition board which are respectively connected to the host computer signals, wherein the host computer and the data acquisition board are connected via a JTAG port; Step S2: the signal source signal is connected to a data acquisition board, the signal output by the data acquisition board is set as a target test signal, and the target test signal is transmitted to a data test instrument as an original signal for a signal test process; Step S3: Preset a TCL script and a Python script on the host computer, use the TCL script to call the Python script to control the data test instrument to start the signal test process, and export the test data generated by the signal test process to the host computer; Step S4: Using the TCL script to call the Python script on the host computer to analyze the test data, presetting the test judgment mechanism in the TCL script, and generating a final result file based on the data analysis results of the Python script for the test data; Step S5: Use the test judgment mechanism to read the data analysis result from the final result file. When the test result is judged to be valid, the test process is judged to be completed and the test process is ended. When the test result is judged to be invalid, return to step S3 to retest.

2. According to claim 1, a highly efficient automatic testing method based on TCL and Python scripts is characterized in that: The frequency amplitude of the signal source is respectively provided with three different frequency amplitude intervals of high frequency, medium frequency and low frequency, and the target signal type of the signal source is obtained through the signalType variable in the database; each frequency amplitude interval of the signal source has at least one corresponding TCL script configuration.

3. The efficient automatic testing method based on TCL and Python script according to claim 2, characterized in that: The parameters configured by the TCL script include the output gain, output impedance and bias voltage when adjusting the output signal source of the data test instrument; the target test signal includes three signal wave types, including sine wave, triangle wave and square wave, and the parameters configured by the TCL script meet the working parameters of the three signal wave types in each frequency amplitude interval; The frequency amplitude range of the high-frequency target test signal is set to be between 50MHZ and 5GHZ; The frequency amplitude range of the intermediate frequency target test signal is set to be between 500KHZ and 50MHZ; The frequency amplitude range of the low-frequency target test signal is set to be between 5 Hz and 500 kHz.

4. An efficient automatic testing method based on TCL and Python script according to any one of claims 2-3, characterized in that: The setting sizes of the TCL script configuration parameters in the three different frequency amplitude intervals include: The output gain is set as follows: at high frequencies, the output voltage gain of the signal source is set to 1-2 times; at medium frequencies, the output voltage gain of the signal source is set to 5-10 times; and at low frequencies, the output voltage gain of the signal source is set to 10-20 times. The output impedance is set as follows: at high frequencies, the output impedance of the signal source is set to a constant 50Ω, at medium frequencies, the output impedance of the signal source is set to 50-75Ω, and at low frequencies, the output impedance of the signal source is set to 600-1000Ω; The bias voltage is set as follows: the voltage value for the signal source at high frequency is set to 0.1V to 0.2V, the voltage value for the signal source at medium frequency is set to 0.1V to 0.5V, and the voltage value for the signal source at low frequency is set to 1V to 5V.

5. The efficient automatic testing method based on TCL and Python script according to claim 1, characterized in that: The content of the test judgment mechanism of the TCL script includes: using the TCL script to call the Python script to analyze the test data and all the status codes generated, selecting the status code to simulate the frequency response test of the target test signal, randomly outputting a power measurement value in the frequency response test, and writing the power measurement value into the TCL script to generate a return value. When the return value is 0, it indicates that the test is successful. When the return value is not 0, it indicates that the test is not completed or the test has failed.

6. The efficient automatic testing method based on TCL and Python script according to claim 5, characterized in that: The process of selecting the state code to simulate the frequency response test includes: setting the power measurement range of the power measurement value for the TCL script, performing the frequency response test on the target test signal one by one for all the state codes, When the power measurement value generated by the test is lower than the power critical range, the return value generated in the TCL script of the output power measurement value is set to 1, and the selected status code is determined to be invalid; When the power measurement value generated by the test is within the power measurement range, the return value generated in the TCL script for the output power measurement value is set to 2, and it is determined that the test process is still in progress; When the power measurement value generated by the test exceeds the power critical range, the return value generated in the TCL script of the output power measurement value is set to 0, and it is determined that the selected status code is valid and the test process is completed.

7. The efficient automatic testing method based on TCL and Python script according to claim 6, characterized in that: The lower boundary of the power measurement range is set with a tolerance threshold. When the power measurement value generated by the selected status code is lower than the power critical range and within the tolerance threshold, the return value generated by the output power measurement value in the TCL script is set to 2, and it is determined that the test process is still in progress.

8. The efficient automatic testing method based on TCL and Python script according to claim 1, characterized in that: The process of using TCL script to call Python script to analyze test data includes: using ILA data format provided by VIVADO to obtain export command in the host computer, exporting the test data in VIVADO using the export command, and then using TCL script to call Python script to analyze the test data.

9. The efficient automatic testing method based on TCL and Python script according to claim 8, characterized in that: The TCL script exports the test data and stores it in a CSV file, calls the Python script to analyze the CSV file, generates an intermediate result file after the analysis is completed, uses the TCL script to read the intermediate result file, and generates a final result file based on the data analysis results in the intermediate result file.

10. The efficient automatic testing method based on TCL and Python script according to claim 8, characterized in that: Use parallel asynchronous processing methods in TCL scripts to call Python scripts to perform test data analysis.

Citation Information

Cited By

  • Eye pattern automatic measurement method and system, computer equipment and storage medium

    CN122549319A