FPGA-based IP core module debugging method

Through the support vector machine model and static analysis technology, data flow and control flow information of IP core modules are extracted, and automated debugging on the FPGA platform is realized, which solves the problems of low debugging efficiency and difficulty in positioning in the existing technology, and improves the debugging Accuracy and efficiency.

CN118940137AActive Publication Date: 2024-11-12青岛青软晶尊微电子科技有限公司

Patent Information

Application Number
CN202411064918.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-05
Publication Date
2024-11-12
Estimated Expiration
2044-08-05

AI Technical Summary

Technical Problem

The existing FPGA debugging methods are difficult to effectively observe the internal state and control flow of the IP core, resulting in difficulty in locating complex exceptions, low debugging efficiency, and lack of automation means and exception handling mechanisms, making it difficult to quickly iterate development.

Method used

The support vector machine model is used to extract and classify data flow abnormal features, combine static analysis to obtain control flow and data flow information, and improve the real-time and accuracy of abnormal positioning through data-driven fault triggering conditions and state triggering conditions, and realize automated debugging. .

Benefits of technology

It improves the efficiency and accuracy of IP core module debugging, can quickly identify exception patterns, accurately locate exception code locations, and reduces debugging complexity and manual intervention needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118940137A_ABST
    Figure CN118940137A_ABST
Patent Text Reader

Abstract

The invention discloses an FPGA (Field Programmable Gate Array)-based IP (Intellectual Property) core module debugging method, which relates to the technical field of digital integrated circuits and comprises the following steps: acquiring data streams generated under different abnormal conditions of an IP core module as simulation test cases; utilizing a support vector machine (SVM) model arranged on the FPGA chip to obtain a characteristic mode in the data stream as an abnormal mode; according to the acquired abnormal mode, setting a fault triggering condition for acquiring the corresponding abnormal mode; according to the state change of a finite state machine (FSM) in the IP core module, setting state triggering conditions in different states; debugging the IP core module according to the set trigger condition and the state trigger condition; performing static analysis on the code of the IP core module by adopting a program control flow diagram analysis algorithm arranged on the FPGA chip; and debugging the IP core module through correlation analysis according to the debugging result and the static analysis result. Aiming at the problem of low debugging efficiency of the IP core module in the prior art, the debugging efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of digital integrated circuits, and in particular to a method for debugging an IP core module based on FPGA. Background Art

[0002] In recent years, with the continuous advancement of semiconductor technology and the continuous growth of chip design complexity, System on Chip (SoC) has become the mainstream trend of integrated circuit design. By integrating multiple functional modules such as processors, memory, and peripheral interfaces into a single chip, SoC can significantly improve system performance, reduce power consumption and cost. However, SoC design also faces many challenges, among which the debugging and verification of IP core (Intellectual Property Core) modules is one of the most critical and time-consuming links.

[0003] IP core is the basic building block of SoC, providing standardized functional interfaces and reusable design modules, which can greatly shorten the design cycle of SoC. However, errors and defects in the IP core itself may also cause functional abnormalities and performance degradation of the entire SoC. Traditional IP core debugging methods mainly rely on manually designed test cases and target board debugging, which have problems such as insufficient test coverage, difficult positioning, and low efficiency. With the increasing complexity of IP core functions and the continuous increase in parameter scale, traditional methods can no longer meet the needs of rapid iterative development.

[0004] Hardware-assisted verification based on FPGA (Field Programmable Gate Array) has become an important means of debugging IP cores. By mapping the IP core to the FPGA platform, a higher running speed and a more realistic execution environment can be obtained than software simulation, which helps to accelerate error stimulation and shorten debugging time. However, existing FPGA debugging methods mainly focus on data path comparison and timing analysis, lack effective means of observing the internal state and control flow of the IP core, and it is difficult to locate the root cause of complex anomalies.

[0005] In addition, the debugging process of IP cores usually requires manual construction of test environments and monitoring logic, lacking sufficient automation means and exception handling mechanisms, which easily introduces additional workload and debugging blind spots. At the same time, for hidden errors and extreme conditions in IP core codes, existing methods find it difficult to establish the association between data anomalies and code errors, resulting in insufficient pertinence and effectiveness of debugging. Summary of the invention

[0006] In view of the problem of low debugging efficiency of IP core modules in the prior art, the present application provides an FPGA-based IP core module debugging method, which uses a support vector machine model to extract and classify abnormal features of data streams, obtains control flow and data flow information of IP core modules through a static analysis program, and combines data-driven fault trigger conditions and status trigger conditions, etc., to improve the real-time and accuracy of abnormality location, thereby improving debugging efficiency.

[0007] The purpose of this application is achieved through the following technical solutions.

[0008] The embodiment of the present specification provides an IP core module debugging method based on FPGA, characterized in that it includes the following steps: obtaining data streams generated under different abnormal conditions of the IP core module as simulation test cases, inputting the data streams into a support vector machine SVM model set on the FPGA chip through a data interface circuit set on the FPGA chip, the data interface circuit is used to realize the conversion and synchronization of external data and internal data of the FPGA chip; using the support vector machine SVM model, extracting features of the input data stream, extracting time domain, frequency domain and time-frequency domain features of the data stream based on wavelet transform and Fourier transform through a feature extraction circuit set on the FPGA chip, and forming a feature vector with the extracted features; inputting the feature vector into the support vector machine SVM model for classification, obtaining a feature pattern in the data stream as an abnormal pattern, and the abnormal pattern represents the abnormal type of the data stream; according to the acquired abnormal pattern, setting and obtaining a corresponding fault trigger condition through a trigger condition generation circuit set on the FPGA chip, the trigger condition includes a threshold condition of the abnormal feature and an abnormal duration condition, and storing the trigger condition in a storage unit of the FPGA chip through a storage interface circuit set on the FPGA chip.

[0009] The state change information of the finite state machine FSM inside the IP core module is obtained, and according to the state change information, the state trigger conditions under different states are set through the state trigger condition generation circuit set on the FPGA chip, and the state trigger conditions include state transfer conditions and state duration conditions, and the state trigger conditions are stored in the storage unit of the FPGA chip through the storage interface circuit; according to the trigger conditions and state trigger conditions stored in the storage unit of the FPGA chip, the input data and output data of the IP core module are monitored in real time, and the input data and output data of the IP core module are collected in real time through the data monitoring circuit set on the FPGA chip, and their features are extracted and compared with the trigger conditions and state trigger conditions; when the trigger condition is detected or the state trigger condition is triggered, the preset debugging operation is automatically executed through the debugging logic circuit set on the FPGA chip, the internal data and state information of the IP core module in the abnormality are obtained, and a debugging result report is generated.

[0010] A program control flow graph parsing algorithm arranged on an FPGA chip is used to perform static analysis on the code of the IP core module. A code parsing circuit arranged on the FPGA chip is used to perform syntax and semantic analysis on the RTL-level or gate-level description code of the IP core module, and the control flow and data flow information therein is extracted, and a program control flow graph model is constructed to obtain a static analysis result. According to the debugging result and the static analysis result, the data and state when the exception occurs in the debugging result are associated with the control flow graph in the static analysis result through an association analysis algorithm and an association analysis circuit arranged on the FPGA chip, and the code segment related to the exception in the IP core module is found, and correction suggestions are automatically generated, and the correction suggestions are displayed on the display unit of the FPGA chip, so as to assist the user in marking and modifying the abnormal code segment, and complete the debugging of the IP core module.

[0011] Among them, IP core module refers to a reusable design unit implemented on an FPGA chip, which encapsulates specific functions and can be integrated into a larger system design like the core components of a large integrated circuit IC. Abnormal conditions refer to conditions that cause errors in the operation of the IP core module, including core algorithm errors, data out-of-bounds, dead loops, etc., which cause the module to produce incorrect output or stop running. Simulation test cases are input data sequences used to verify the correctness of the design. Here, it specifically refers to debugging the IP core module, inputting simulation data under different abnormal conditions and obtaining its output data stream to obtain test cases containing abnormal information.

[0012] Among them, data stream refers to a series of digital signal sequences generated in chronological order when the IP core module processes the data of the simulation test case. It reflects the operating status and output results of the IP core module under different abnormal conditions. FPGA chip is a field programmable gate array chip that can implement custom logic circuits inside the chip. Support vector machine is a supervised learning model used for classification and regression analysis. Feature pattern refers to the distribution or combination of feature values ​​in the data stream that reflects a specific abnormal situation, which can uniquely identify a certain type of abnormality.

[0013] Specifically, a support vector machine (SVM) model is set on the FPGA chip, the HLS tool is used to design the hardware description of the SVM model, and the model algorithm description is converted into Verilog code at the Register Transfer Level (RTL) level. The main modules include: Input module: receives data stream and caches input features. Kernel module: implements the kernel function calculation of SVM. Decision module: judges the classification result according to the kernel function output. The Verilog code is synthesized to generate a gate-level netlist configurable by FPGA using FPGA development tools. The netlist of the SVM model is loaded into the specified programmable logic block on the FPGA chip through JTAG or other configuration interfaces. The top-level design of the SVM model is instantiated on the FPGA and connected to the data stream interface. The input module receives the data stream and pushes it to the kernel module. The kernel module calculates the kernel function value. The decision module judges the abnormal mode classification result according to the kernel function output. The classification result is output to the result analysis module to complete the abnormal mode detection. The correctness of the model on the FPGA is ensured through collaborative design and simulation verification.

[0014] Among them, the trigger condition refers to a set of rules or criteria for detecting the occurrence of abnormal patterns. When the trigger condition is met, it means that the abnormal pattern has occurred. In the present application, the corresponding fault trigger condition is set according to the abnormal pattern extracted from the data stream. The trigger condition may include a threshold criterion for abnormal data, a data feature relationship criterion, etc. When the real-time data stream meets the set trigger condition, it can be considered that the corresponding abnormal pattern has occurred. By judging the trigger condition, the abnormal situation of the IP core module can be detected in real time for module status monitoring.

[0015] Among them, the finite state machine (FSM) is a mathematical model used to model a finite number of states and the transitions and actions between these states. State change refers to the transition of the FSM from one state to the next. The state trigger condition refers to the conditional criterion that causes the FSM state change. When the condition is met, the state switching is triggered. In this application, it refers to the FSM model that establishes the internal algorithm logic of the IP core module. For different state changes that may occur in the IP core module FSM, corresponding state trigger conditions are set. The state trigger conditions may include the value of the Signals inside the module, the value of the state register, etc. The state trigger conditions are set according to the state change law of the FSM.

[0016] Specifically, debug the IP core module according to the set trigger conditions and state trigger conditions. After obtaining the abnormal mode, set the corresponding fault trigger conditions, such as the judgment criteria for data out of bounds. Analyze the state machine of the IP core module and set the state trigger conditions for the transition between states, such as the value of the state register. Integrate a logic analyzer on the FPGA to monitor the real-time operation signal of the IP core module. When it is detected that the set trigger conditions are met, record the departure time, module status and other information. Locate the corresponding code, check the variable value and register status at that time, and analyze the cause of the abnormality. If the trigger condition is inconsistent with the state change, it is necessary to check the state machine logic. Repeat the debugging several times to collect the trigger condition information under various abnormal conditions. According to the information obtained from the debugging, locate the root cause of the abnormality, perform modification and verification, and improve the IP core module design. Until all kinds of abnormal conditions can be correctly detected by the trigger conditions, and the operation logic of the IP core module is correct. Finally, a complete debugging report is formed.

[0017] Among them, the program control flow graph parsing algorithm is an algorithm for structured analysis of program source code, which can construct the control flow relationship in the source code, that is, the execution order and conditional relationship between the basic blocks of the program. Static analysis is a non-execution analysis of computer software, which checks the code before the program runs to find out the problem points or verify the correctness. In this application, the algorithm is implemented on the FPGA chip to improve the analysis efficiency; the basic blocks of the IP core module code are obtained through lexical and grammatical analysis; the program control flow graph is constructed to represent the execution flow relationship between the basic blocks; the code is statically analyzed without execution, the core operation logic is analyzed, and the critical path is found.

[0018] Specifically, a program control flow graph parsing algorithm is set on the FPGA chip, and the hardware description of the program control flow graph parsing algorithm is designed on the FPGA chip using Verilog or VHDL language. The main modules include: lexical analysis module: lexical tokenize and identifier parsing of the source code; syntax analysis module: constructing the abstract syntax tree AST of the code and checking the syntax; control flow analysis module: extracting basic blocks from the AST and constructing control flow relations; data flow analysis module: analyzing the definition and use of variables in the code and establishing data flow relations. The designed Verilog or VHDL code is synthesized into a gate-level netlist configurable by the FPGA using the FPGA development tool. The generated netlist data is loaded and configured onto the corresponding programmable logic block of the FPGA chip using the corresponding configuration interface on the FPGA development board. The top-level module of the parsing algorithm is instantiated on the FPGA chip, and a data path is established between the module and the IP core interface. The source code of the IP core module is transmitted to the parsing algorithm module through the set interface for processing. The parsing algorithm module outputs the parsing result and sends it to the result analysis module to complete the static analysis of the IP core code.

[0019] Among them, correlation analysis refers to a technical means of comprehensively considering the correlation between two or more analysis results and conducting an overall analysis to find the root cause of the problem. In this application, this solution includes two technical means: dynamic debugging and static analysis. Dynamic debugging can find the location where the exception actually occurs. Static analysis can directly locate the logical errors of the code. Specifically, according to the debugging results and static analysis results, correlation analysis is performed to collect the abnormal information obtained by dynamic debugging and static analysis, including trigger location, abnormal data, key variables, key code paths, etc. The abnormal location obtained by dynamic debugging is marked on the program control flow graph. Compare the results of dynamic debugging and static analysis to find the abnormal points related to the two. By associating these related abnormal points, the cause of the exception can be located, such as algorithm error, variable out of bounds, etc. Debug according to the correlation analysis results, and make corrections in the source code for each determined abnormal cause, such as adding boundary checks, modifying algorithm logic, etc.

[0020] Furthermore, a support vector machine (SVM) model is used to extract features from the input data stream, and a feature pattern in the data stream is obtained as an abnormal pattern, including: inputting the input data stream into a dual wavelet transform denoising circuit arranged on an FPGA chip, the dual wavelet transform denoising circuit uses wavelet transform to perform forward and reverse transforms on the input data stream, removes noise components in the data stream by thresholding the wavelet coefficients, obtains a denoised data stream, and outputs the denoised data stream to the feature extraction circuit;

[0021] The denoised data stream is input into a feature extraction circuit arranged on an FPGA chip, and the feature extraction circuit includes a time domain feature extraction unit, a frequency domain feature extraction unit and a time-frequency feature extraction unit; wherein the time domain feature extraction unit divides the data stream by a sliding window method, calculates the statistical characteristics of the data in each window, including the mean, variance, skewness and kurtosis, and obtains the time domain characteristics of the data stream; the frequency domain feature extraction unit performs spectrum analysis on the data stream by using a fast Fourier transform FFT, calculates the power spectrum and spectrum entropy of the data stream, and obtains the frequency domain characteristics of the data stream; the time-frequency feature extraction unit performs time-frequency analysis on the data stream by using a wavelet packet transform, calculates the energy distribution of the data stream at different scales and time positions, and obtains The method comprises the following steps: extracting time-domain features, frequency-domain features and time-frequency features to form a high-dimensional feature vector, and outputting the high-dimensional feature vector to a dimensionality reduction processing circuit; inputting the high-dimensional feature vector to a dimensionality reduction processing circuit arranged on an FPGA chip, and the dimensionality reduction processing circuit performs dimensionality reduction processing on the high-dimensional feature vector by adopting a local preservation projection (LPP) algorithm, constructing a neighbor graph of the high-dimensional feature vector, calculating the distance between the vertices on the graph, constructing a Laplace matrix according to the distance, solving the eigenvector corresponding to the minimum eigenvalue of the Laplace matrix as the projection direction, mapping the high-dimensional feature vector to a low-dimensional space, obtaining a low-dimensional feature vector after dimensionality reduction, and outputting the low-dimensional feature vector to a SVM training circuit.

[0022] The low-dimensional feature vector is used as input to establish a support vector machine (SVM) model. The low-dimensional feature vector is used as a training sample to train the SVM model. The dual problem of the SVM model is solved by the sequential minimum optimization (SMO) algorithm to obtain the optimal hyperplane parameters of the SVM model, including: extracting the key path in the operation logic as the feature path according to the operation logic structure of the IP core module and the abnormal mode association table; wherein the key path refers to the path segment covering the key node of the abnormal mode; performing data flow analysis on each feature path, extracting the variable definition-use chain on the feature path, and constructing a path data flow graph; the path data flow graph Nodes represent variables and operations, and directed edges represent data dependencies from variables to operations and from operations to variables. Preferably, when constructing a path data flow graph, a data flow-sensitive cut-point is introduced to improve the sparsity of the graph structure and reduce the computational complexity of subsequent graph embedding. A graph convolutional neural network algorithm is used to map the path data flow graph to a low-dimensional real number space to generate a low-dimensional real-valued feature vector of the path. Each dimension of the low-dimensional real-valued feature vector represents the weight coefficient of the path on the corresponding feature dimension. The graph convolutional neural network learns the local and global structural features of the node by iteratively aggregating the neighborhood information of the node, and obtains a path with high discriminability. Path embedding representation; Based on low-dimensional real-valued feature vectors, a support vector machine SVM model is constructed; The input of the SVM model is the low-dimensional real-valued feature vector of the feature path, and the output is the abnormal judgment result of the feature path; The kernel function is introduced to map the low-dimensional real-valued feature vector to the high-dimensional space to improve the nonlinear classification ability of the SVM model; The sequential minimum optimization SMO algorithm is used to solve the dual problem of the SVM model and obtain the support vector, threshold and classification weight parameters of the SVM model; The SMO algorithm selects the violated pair heuristically, optimizes and updates it, and iteratively solves the optimal hyperplane parameters; The sample confusion degree is introduced Indicators, adaptively adjust the iteration termination conditions of the SMO algorithm, and balance the training accuracy and efficiency; during debugging and running, for the IP core module to be analyzed, dynamically extract the key path in its operating logic, and generate a low-dimensional real-valued feature vector of the key path through path data flow analysis and graph convolutional neural network; adopt incremental calculation method to reuse the feature vector of the previous key path to reduce repeated calculation; input the low-dimensional real-valued feature vector of the key path into the trained SVM model to obtain the abnormal judgment result and abnormal type of the path; adopt the path combination strategy to integrate the judgment results of multiple key paths to improve the accuracy and coverage of the overall diagnosis.

[0023] Furthermore, the dual wavelet transform denoising circuit includes a coiflet wavelet filter and a bior wavelet filter connected in series; the input data stream is input into the coiflet wavelet filter, the coiflet wavelet filter uses the coiflet wavelet basis to perform multi-level wavelet decomposition on the input data stream, and extracts the low-frequency approximate coefficients and high-frequency detail coefficients of the data stream at different scales by high-pass and low-pass filtering the data stream; the extracted high-frequency detail coefficients are input into a threshold processing unit set in the coiflet wavelet filter, the threshold processing unit uses a preset threshold to perform hard threshold processing on the high-frequency detail coefficients, and sets the high-frequency detail coefficients less than the threshold to zero to remove high-frequency noise; wherein the high-frequency coefficients represent the high-frequency components in the data stream, reflecting the detailed information and the rapidly changing parts of the data. In the wavelet transform, the high-frequency coefficients of the data stream are extracted by a high-pass filter. The high-frequency coefficients usually contain high-frequency interference such as noise and spike pulses, but may also contain some important transient features. In denoising applications, by thresholding or weighting the high-frequency coefficients, the noise components in the data can be effectively suppressed while retaining key detail information. Low-frequency coefficients represent low-frequency components in the data stream, reflecting the trend information and slowly changing parts of the data. In wavelet transform, low-frequency coefficients of the data stream are extracted through a low-pass filter. Low-frequency coefficients usually contain the main energy and basic characteristics of the data, representing the general trend and average level of the data. In denoising applications, low-frequency coefficients are usually retained as the basis for data reconstruction to ensure that the denoised data still maintains the original trend characteristics.

[0024] The high-frequency detail coefficients and low-frequency approximate coefficients after threshold processing are input together to the wavelet reconstruction unit set in the coiflet wavelet filter. The wavelet reconstruction unit uses the coiflet wavelet basis to perform multi-level wavelet reconstruction on the high-frequency detail coefficients and low-frequency approximate coefficients after threshold processing. By upsampling and convolving the wavelet coefficients at different scales, the data stream after forward transformation is obtained, and the data stream after forward transformation is output to the bior wavelet filter; the data stream after forward transformation is input to the bior wavelet filter, and the bior wavelet filter uses the bior wavelet basis to perform multi-level wavelet decomposition on the data stream after forward transformation. By performing high-pass and low-pass filtering on the data stream, the low-frequency approximate coefficients of the data stream after forward transformation at different scales are extracted. The extracted high-frequency detail coefficient is input into an anti-threshold processing unit arranged in the bior wavelet filter, and the anti-threshold processing unit performs soft threshold processing on the high-frequency detail coefficient with a preset threshold, and subtracts the threshold from the high-frequency detail coefficient greater than the threshold to remove the high-frequency pseudo details introduced in the forward transform; the high-frequency detail coefficient after the anti-threshold processing is input into a wavelet reconstruction unit arranged in the bior wavelet filter together with the low-frequency approximate coefficient, and the wavelet reconstruction unit performs multi-level wavelet reconstruction on the high-frequency detail coefficient and the low-frequency approximate coefficient after the anti-threshold processing with the bior wavelet basis, and obtains a denoised data stream by up-sampling and convolution of the wavelet coefficients at different scales, and outputs the denoised data stream to a subsequent feature extraction circuit.

[0025] Further, in the feature extraction circuit, the denoised data stream is first input into the Bayesian estimation circuit. The Bayesian estimation circuit uses the Bayesian estimation algorithm to estimate the statistical characteristics of the data stream, specifically by constructing a probability model of the data stream, introducing the sliding window width as a parameter to be estimated into the posterior probability distribution, and then by maximizing the logarithmic posterior probability, using the numerical optimization algorithm to solve the optimal sliding window width, and output the optimal sliding window width to the time domain statistical feature extraction circuit. The time domain statistical feature extraction circuit receives the denoised data stream and the optimal sliding window width, and uses the sliding average method to perform windowing on the data stream. Specifically, by setting a sliding window with a length equal to the optimal width, the data stream is evenly windowed, and the window slides and intercepts the data in turn. For each sampling point in the data window, its mean, variance and kurtosis coefficient are calculated. The mean reflects the average amplitude of the signal in the window, the variance reflects the degree of fluctuation of the signal, and the kurtosis coefficient reflects the peak degree of the signal. The mean, variance and kurtosis coefficient calculated in each window are output as the time domain statistical features of the data stream.

[0026] The denoised data stream is simultaneously input into the frequency domain feature extraction circuit. The frequency domain feature extraction circuit uses a fast Fourier transform (FFT) algorithm based on the Pinault sequence to perform spectrum analysis on the data stream. The traditional FFT algorithm needs to store and access the spectrum coefficients according to the bit reversal permutation, resulting in a large number of memory accesses. The FFT algorithm based on the Pinault sequence uses the pseudo-randomness of the Pinault sequence to rearrange the input data and operation coefficients of the FFT, reduce the bit reversal operation, thereby reducing the number of memory accesses and improving the operation speed. The spectrum coefficients are obtained by FFT transformation of the data stream, and the power spectrum density and spectrum entropy of the data stream are calculated. The power spectrum density reflects the power distribution of the signal at different frequencies, and the spectrum entropy reflects the degree of disorder of the spectrum. The calculated power spectrum density and spectrum entropy are output as the frequency domain features of the data stream.

[0027] The denoised data stream is simultaneously input into the time-frequency feature extraction circuit. The time-frequency feature extraction circuit uses the orthogonal matching pursuit algorithm to adaptively decompose the data stream into wavelet packets and adaptively select the best matching wavelet packet basis. Specifically, by constructing wavelet packet bases of different scales and frequency bands, the projection coefficient of the data stream on each wavelet packet basis is calculated. The size of the projection coefficient reflects the matching degree between the data stream and the wavelet packet basis. The wavelet packet basis with the largest projection coefficient is selected as the best matching basis, and the corresponding wavelet packet node is output as the optimal wavelet packet node.

[0028] The optimal wavelet packet node is input to the sparse wavelet transform circuit. The sparse wavelet transform circuit performs sparse representation of the wavelet coefficients of the optimal wavelet packet node. Specifically, by finding the absolute value of the wavelet coefficients, setting a sparsity threshold, setting the wavelet coefficients less than the threshold to zero, and retaining the wavelet coefficients greater than the threshold, the sparseness of the wavelet coefficients is achieved. The optimal wavelet packet node is reconstructed using the sparse wavelet coefficients, and the energy distribution of the reconstructed nodes at different scales is calculated as the wavelet packet energy spectrum; the correlation between adjacent wavelet packet nodes at different scales is calculated as the inter-packet coherence. The wavelet packet energy spectrum and inter-packet coherence are output as the time-frequency features of the data stream. Finally, the mean, variance and kurtosis coefficient output by the time domain statistical feature extraction circuit, the power spectrum density and spectrum entropy output by the frequency domain feature extraction circuit, and the wavelet packet energy spectrum and inter-packet coherence output by the time-frequency feature extraction circuit are combined into a high-dimensional feature vector, which is output to the dimensionality reduction processing circuit for subsequent feature dimensionality reduction.

[0029] Furthermore, the dimension reduction processing circuit performs dimension reduction processing on the high-dimensional feature vector to obtain the step of low-dimensional feature vector, including: inputting the high-dimensional feature vector output by the feature extraction circuit into the distance matrix calculation module, the distance matrix calculation module calculates the Euclidean distance between any two high-dimensional feature vectors, constructs the distance matrix of the high-dimensional feature vector, and outputs the distance matrix to the K nearest neighbor graph construction module; inputting the distance matrix into the K nearest neighbor graph construction module, the K nearest neighbor graph construction module searches for its K nearest neighbor vectors for each high-dimensional feature vector based on the distance matrix, constructs the K nearest neighbor structure of the high-dimensional feature vector, and outputs the K nearest neighbor structure to the Laplace matrix construction module; wherein K is a preset positive integer; inputting the K nearest neighbor structure into the Laplace matrix construction module, the Laplace matrix construction module traverses the K nearest neighbor structure of each high-dimensional feature vector, if the two high-dimensional feature vectors are K nearest neighbors of each other, then fill in 1 in the Laplace matrix element at the corresponding position, otherwise fill in 0, construct the Laplace matrix of the high-dimensional feature vector, and output the Laplace matrix to the generalized eigenvalue solution module.

[0030] The Laplace matrix is ​​input into the generalized eigenvalue solving module, and the generalized eigenvalue solving module adopts the Rayleigh quotient iteration algorithm to solve the generalized eigenvalue problem of the Laplace matrix, and obtains the generalized eigenvector corresponding to the minimum non-zero generalized eigenvalue equal to the number of preset dimension reduction target dimensions. The obtained generalized eigenvector is used as the projection vector of the local preservation projection algorithm to form a projection matrix, and the projection matrix is ​​output to the low-dimensional feature mapping module; the high-dimensional feature vector and the projection matrix are input into the low-dimensional feature mapping module, and the low-dimensional feature mapping module uses the projection matrix to perform linear transformation on the high-dimensional feature vector, maps the high-dimensional feature vector to the low-dimensional feature space, obtains the low-dimensional feature vector after dimensionality reduction, and outputs the low-dimensional feature vector to the fault diagnosis circuit.

[0031] Specifically, calculate the distance matrix between high-dimensional feature vectors, collect the extracted high-dimensional feature vectors, and assume that there are m vectors, each of which has a length of n. Define an mxm distance matrix D. Traverse all feature vector pairs to calculate the distance: for i = 1 to m: for j = 1 to m: if i == j: D[i, j] = 0; otherwise: D[i, j] = Calculate the distance between vector i and vector j. There are many distance calculation methods, and the commonly used ones include: Euclidean distance: the square root of the sum of the squares of the differences between the corresponding components of two vectors, Manhattan distance: the sum of the absolute values ​​of the differences between the corresponding components of two vectors, and cosine distance: the cosine value of the angle between two vectors. Select the appropriate distance calculation method according to the feature type and purpose. After the above steps, an mxm distance matrix D is obtained, which reflects the distance relationship between each feature vector. The distance matrix can be used for subsequent clustering, dimensionality reduction and other algorithms.

[0032] Among them, K nearest neighbor structure: for each sample point, find the set of K other sample points closest to it, and these K nearest sample points constitute the K nearest neighbor structure of the sample point. In this application, the K nearest neighbor structure is constructed according to the distance matrix, and the distance matrix D of the sample set is calculated, where D[i, j] represents the distance between samples i and j. For each sample i, find the K other samples closest to it: sort D[i,:] and take out the sample indexes corresponding to the smallest K distance values. These K sample indexes are the K nearest neighbor structure of sample i. Repeat the above process, traverse the sample set, and obtain the K nearest neighbor structure of each sample. Integrating the K nearest neighbor structures of all samples is the K nearest neighbor structure of the entire sample set. The K value is generally a small integer, and common values ​​include 5, 10, etc.

[0033] Among them, Laplace matrix: a matrix that reflects the connection relationship between sample points, and the elements are weighted values ​​of the similarity or distance between sample points. In this application, a Laplace matrix is ​​constructed based on the K nearest neighbor structure, and a K nearest neighbor structure of each sample point is constructed to obtain the nearest neighbor sample index. Initialize an N*N Laplace matrix L, where N is the total number of samples. For each pair of nearest neighbor sample points i and j, update the Laplace matrix: d is the distance between i and j, σ is the Gaussian kernel width, L[i,j] = L[j,i], and the diagonal element L[i,i] = -sum(L[i,:]), resulting in the Laplacian matrix L, which encodes the local similarity between samples. L can be used for dimensionality reduction and can also reflect the global structure of the sample set.

[0034] Among them, Rayleigh quotient: the objective function used to optimize the projection vector, defined as the ratio of the projection vector to the vector after the Laplace matrix product. In this application, the Laplace matrix L is constructed according to the K nearest neighbor structure of the sample. Initialize the random projection vector v. Calculate the Rayleigh quotient: v T represents the transpose of v, L is the Laplacian matrix, v is the projection vector, and v is iteratively optimized to maximize the Rayleigh quotient R(v). When the Rayleigh quotient converges, the optimal projection vector v is obtained. v is orthogonal to the low-dimensional manifold structure of the data sample. The sample is mapped onto v to obtain the dimensionality reduction result. Repeat the process to find multiple projection vectors to complete the dimensionality reduction.

[0035] Specifically, repeatedly solve the projection vector and construct the projection matrix. Initialization: set the target dimension reduction number n, that is, n projection vectors need to be obtained. Solve the first projection vector v1: construct the sample Laplacian matrix L, randomly initialize v1, and maximize the Rayleigh quotient R(v1) to obtain the optimal v1. Solve the second projection vector v2: construct the constrained Laplacian matrix L' except the direction of v1 according to v1, randomly initialize v2, and maximize the Rayleigh quotient R(v2) to obtain the optimal v2. Solve the i-th projection vector v in turn. i , dimension is n: according to [v1,v2,......,v n ]Construct the constrained Laplacian matrix and randomly initialize v i , optimize to obtain the optimal v i . Get n orthogonal projection vectors [v1,v2,......,v n ], construct the projection vector into a projection matrix P = [v1, v2, ..., v n ], dimensionality reduction can be achieved by multiplying the P matrix by the sample data.

[0036] Specifically, the high-dimensional feature vector is reduced in dimension using the constructed projection matrix, and the extracted high-dimensional feature vectors are collected to form a sample matrix X, where each row is a sample. Through iterative optimization, n projection vectors [v1,v2,......,v n ]. Use the projection vector to construct the projection matrix P = [v1, v2, ..., v n ]. The size of the projection matrix P is n×m, where n is the target dimensionality reduction number and m is the original high dimensionality. Multiply the sample matrix X by the projection matrix P to achieve projection transformation: Y=PX, where Y is the sample matrix after dimensionality reduction, and its size is n×number of samples. Sample each row vector: y=Px, and you can get the dimensionality reduction result y corresponding to the high-dimensional sample x. Perform the above operations on all high-dimensional samples in sequence. Finally, the sample set Y after dimensionality reduction is obtained, and its dimension is reduced from m to n. The sample set after dimensionality reduction retains the local manifold structure of the original data.

[0037] Furthermore, the Laplace matrix adopts a positive definite matrix; the projection matrix adopts an orthogonal matrix. The Laplace matrix output by the Laplace matrix construction module is input to the positive definite matrix conversion module, the positive definite matrix conversion module performs diagonal correction on the Laplace matrix, converts the Laplace matrix into a positive definite matrix, and outputs the positive definite Laplace matrix to the generalized eigenvalue solution module; wherein, the positive definite matrix conversion method is: add a positive number greater than the absolute value of the minimum eigenvalue of the Laplace matrix element by element to obtain the positive definite Laplace matrix; the projection vector matrix output by the generalized eigenvalue solution module is input to the orthogonalization processing module, and the orthogonalization processing module is used. The module uses the Schmidt orthogonalization method to orthogonalize the projection vector, obtain the orthogonalized projection matrix, and output the orthogonal projection matrix to the low-dimensional feature mapping module; wherein, the steps of the Schmidt orthogonalization are: take the first column vector of the projection matrix as the first vector of the orthogonal basis; for each subsequent column vector of the projection matrix, use the Gram-Schmidt orthogonalization formula to subtract the projection on the obtained orthogonal basis vector to obtain a new orthogonal vector; repeat until all column vectors of the projection matrix are orthogonalized to generate an orthogonal projection matrix.

[0038] Furthermore, the support vector machine SVM model adopts the C-SVM model; the kernel function of the C-SVM model adopts the Gaussian kernel function; the expression of the Gaussian kernel function is as follows: Among them, x and x i is the sample feature vector input to the kernel function, representing the test sample and support vector in the support vector machine respectively; ||xx i || represents the test sample x and the support vector x i The Euclidean distance between i ) represents the value based on x and x i Variable kernel width; Among them, σ0 is the initial kernel width of the Gaussian kernel function, and its value is predetermined before training; α is the kernel width adjustment parameter, which controls the amplitude of the kernel width change, and its value range is a positive real number; β is the kernel width adjustment parameter, which controls the rate of kernel width change, and its value range is a positive real number.

[0039] Among them, the C-SVM model is an improved support vector machine model, and a regularization parameter C is introduced in the optimization objective. In this application, C-SVM adds a regularization term to the loss function to balance the model complexity and the training set error. By adjusting the value of parameter C, the sensitivity of the model to outliers can be controlled. When C tends to infinity, C-SVM degenerates into the original SVM model. Selecting an appropriate C value can improve the generalization ability of the model and avoid overfitting. In this scheme, the optimal C is selected through cross-validation to obtain a C-SVM model with strong generalization ability. The optimized C-SVM model is then used for fault detection and classification.

[0040] Among them, Gaussian kernel function: a popular SVM kernel function, which measures similarity by calculating the Gaussian function value of the distance between samples. In this application, the expression of Gaussian kernel function is as follows: Introduced based on samples x and x i The variable kernel width σ(x,x i ), rather than a fixed σ. σ(x,x i ) can vary depending on the density of x and xilocal. Using a variable kernel width σ(x,x i ) instead of a fixed global kernel width. Make the kernel function more sensitive to sample points of different patterns. Adapt to the density changes of sample distribution in different regions. Improve the flexibility of kernel function mapping space. Improve SVM's modeling ability for complex distribution samples. Variable kernel width reduces the risk of overfitting. Improved Gaussian kernel function improves SVM's adaptability to complex sample distribution and enhances the classification performance of the model by introducing variable kernel width. x is the test sample, x i is the support vector, which is input into the kernel function K for kernel mapping. ||xx i ||Calculate the Euclidean distance between two samples. σ(x,x i ) is based on x and x i To calculate the variable kernel width. The kernel function expression is: The variable kernel width σ(x,x i ), instead of a fixed σ. When x and x i The farther the distance, the greater the i ) will increase. The farther the distance, the faster the exponential term decreases and the smaller the kernel function value. This achieves that the support vectors closer to the test sample x contribute more. This improves the sensitivity of the kernel mapping to the local sample distribution. Finally, the kernel matrix is ​​input into the SVM to improve the ability to model complex samples.

[0041] Specifically, σ(x,x i ) with a variable kernel width, σ0 is the initial kernel width, which is a global constant value set in advance. α is the parameter for adjusting the kernel width, which controls the change amplitude and takes a positive real number. The larger α is, the greater the kernel width changes. β is the rate parameter for the kernel width change, which takes a positive real number. The larger β is, the faster the kernel width changes with distance. ||xx i || is the Euclidean distance between the test sample x and the support vector xi. The kernel width σ(x,x i ) is calculated as follows: When the distance between x and xi increases, the numerator increases and the kernel width σ(x,x i ) will be larger. This achieves the effect of automatically adjusting the kernel width according to the sample distance. By choosing appropriate α and β, the degree of change of the kernel width can be controlled.

[0042] Furthermore, in the fault diagnosis circuit, the program control flow graph parsing algorithm is used to perform static analysis on the code of the IP core module, and the code corresponding to the operation logic and abnormal mode of the IP core module is obtained to provide support for fault diagnosis at the source code level. Static code analysis includes: first, the source code of the IP core module is input into the lexical and grammatical analysis module. The lexical and grammatical analysis module uses lexical analysis and grammatical analysis techniques to traverse the character stream of the source code, and converts the source code into the form of token sequence and abstract syntax tree (AST) according to predefined lexical rules and grammatical rules. On this basis, the basic blocks in the source code are extracted, and each basic block represents a continuous instruction sequence with a single entry and a single exit. The division of the basic blocks is based on the control flow of the program. A basic block does not contain jump instructions, and the boundaries of the basic blocks are determined by jump instructions (such as conditional branches, loops, etc.). The lexical and grammatical analysis module outputs the extracted basic blocks as input for control flow graph construction.

[0043] Then, the basic blocks are input into the control flow graph construction module. The control flow graph construction module uses the control flow analysis algorithm to construct the control flow graph (CFG) of the IP core module according to the jump relationship and conditional judgment statements between the basic blocks. The control flow graph is a directed graph used to represent the control flow structure of the program, in which the nodes represent the basic blocks and the directed edges represent the execution order and conditional judgment relationship between the basic blocks. By analyzing the jump targets and conditional judgment statements of the basic blocks, the successor blocks of the basic blocks can be determined, and directed edges can be added between the corresponding nodes. The control flow graph construction module outputs the constructed control flow graph, which reflects the static execution process of the IP core module.

[0044] Then, the control flow graph is input into the loop identification module. The loop identification module uses the Tarjan algorithm to traverse the control flow graph and identify the loop structure in the program. Preferably, the loop identification algorithm Tarjan is used to traverse the control flow graph, identify the strongly connected components with the same starting node and end node, mark the node set corresponding to the strongly connected component as a loop, obtain the location information of the loop in the source code, and generate a labeled control flow graph with loop information, including: setting the starting node of the loop identification algorithm as the entry node of the control flow graph, starting from the starting node, and using a depth-first search strategy to traverse all nodes and edges of the control flow graph; during the traversal process, record the access timestamp and traceback value of the current node; wherein the access timestamp indicates the time when the node is first accessed, and the traceback value indicates the node with the earliest access timestamp that the current node can trace back to; if a child node of the current node has been visited, compare the traceback value of the current node with the access timestamp of the child node, if the time of the child node If the timestamp of the accessed node is smaller than the traceback value of the current node, the traceback value of the current node is updated to the timestamp of the child node; if all the child nodes of the current node have been visited, and the access timestamp and traceback value of the current node are equal, a strongly connected component is generated with the current node as the root node, and the strongly connected component is pushed into the loop stack; after identifying all the strongly connected components, each strongly connected component in the loop stack is traversed, the node set contained in each strongly connected component is extracted, and the starting line number and the ending line number of the basic block corresponding to the node set in the source code are used as the location information of the loop to construct a loop information table; according to the loop information table, each node in the control flow graph is annotated, and if the node belongs to a loop, a loop attribute mark is added to the node, and the marking content includes the number and location information of the loop to which it belongs, and an annotated control flow graph with loop information is generated.

[0045] The annotated control flow graph is input into the data flow analysis module. The data flow analysis module adopts the reaching definition data flow analysis algorithm to solve the data flow on the control flow graph and obtain the variable definitions and usage at different positions of the program. Preferably, the annotated control flow graph is topologically sorted to obtain the linear execution order of all basic blocks; according to the linear execution order, starting from the entry node of the control flow graph, the symbolic execution technology is used to traverse each path of the control flow graph; during the symbolic execution process, each instruction in the basic block is semantically analyzed, the instruction opcode, source operand and destination operand are extracted, and the program state is updated according to the instruction semantics; wherein the program state includes the symbolic value of the variable, the path condition and the instruction pointer; when the symbolic execution passes through the branch node in the control flow graph, the path condition is constraint solved according to the branch condition, the reachable path is determined, and the symbolic execution is continued on the reachable path; when the symbolic execution reaches the exit node of the control flow graph, a complete path is generated. The symbolic execution path is constructed based on the instruction sequence and program status update on the path to build a data flow fact table; the data flow fact table records the definition and usage of each variable at different program points; each item in the data flow fact table is traversed, and a data dependency graph of the variables is constructed based on the definition-usage chain; the nodes of the data dependency graph represent variables, the directed edges represent the data dependency between variables, and the direction of the edge is the direction of data transmission; the data dependency graph is topologically sorted to generate the calculation order of the variables; the operation logic structure of the IP core module is generated by combining the instruction sequence and the calculation order of the variables; the operation logic structure is represented in the form of a directed acyclic graph, in which the nodes represent instructions, and the directed edges represent the execution order and data dependency between instructions.

[0046] Finally, the operation logic of the IP core module and the code corresponding to the exception pattern are input into the association analysis module. The association analysis module uses a pattern matching algorithm to search for code snippets matching the exception pattern in the operation logic and establish an association relationship between the two. The exception pattern usually represents some specific code structure or data flow pattern, such as null pointer reference, buffer overflow, deadlock, etc. By matching these exception patterns in the operation logic, the potential fault location and cause are identified, and the matching results are mapped to the source code location. The results of the association analysis connect the source code and the fault behavior, providing direct support for fault diagnosis. Preferably, the operation logic of the IP core module is converted into a static single assignment form (SSA) to generate an SSA intermediate representation; the SSA intermediate representation includes the definition and usage of each variable, as well as the data flow relationship between instructions; according to the type of the exception pattern, a matching template corresponding to it is constructed; the matching template adopts the form of a regular expression to describe the characteristic structure of the exception pattern in the SSA intermediate representation; an abstract syntax tree matching algorithm is used to search for a subtree structure matching the matching template on the SSA intermediate representation; for a successfully matched subtree structure, key nodes in the subtree are extracted, and the key nodes include variable definition nodes, control flow decision nodes, and the like. points and exception triggering nodes; according to the mapping relationship between the SSA intermediate representation and the source code, the key nodes are mapped back to the source code to obtain the key statements corresponding to the exception mode, which include variable definition statements, branch judgment statements and exception triggering statements; an association table between the running logic and the code corresponding to the exception mode is constructed, and each item in the association table consists of the exception mode number, the key node set and the key statement set; when diagnosing faults at the source code level, the association table is queried according to the exception mode number to locate the key statements corresponding to the exception mode, and the cause of the fault is inferred according to the actual value of the key statement when the system behavior is abnormal, and a fault diagnosis report is generated.

[0047] Furthermore, in the fault diagnosis circuit, according to the abnormal pattern obtained from the correlation analysis module, the corresponding fault trigger condition is set to capture the fault signal in the operation process of the IP core module in real time. The trigger condition setting includes: first, the correlation analysis module transmits the extracted abnormal pattern to the trigger condition generation module through the data bus. The abnormal pattern data is organized in a structured form, including multiple fields such as abnormal type, abnormal parameters, threshold conditions, etc. The trigger condition generation module reads the abnormal pattern data from the input interface and stores it in the internal buffer, waiting for subsequent processing.

[0048] The trigger condition generation module parses and classifies the abnormal pattern data in the buffer one by one. It extracts classification information from the abnormal type field of each abnormal pattern data, and divides the abnormality into two types: characteristic value exceeding limit abnormality and signal deviation exceeding limit abnormality according to the predefined classification rules. The classification rule of characteristic value exceeding limit abnormality is: the abnormal type field is marked as "characteristic value exceeding limit", and the abnormal parameter field contains the characteristic parameter name and threshold condition. This abnormality indicates that a performance parameter or statistical parameter value of the IP core module exceeds the preset safety range, such as low throughput, high latency, and excessive error rate. The classification rule of signal deviation exceeding limit abnormality is: the abnormal type field is marked as "signal deviation exceeding limit", and the abnormal parameter field contains the signal name, nominal value, and deviation upper limit. This abnormality indicates that the amplitude of the input and output signal or internal node signal of the IP core module deviates too much from the nominal value and exceeds the maximum allowable error, such as level drift, interference noise, distortion, etc.

[0049] After completing the classification of abnormal patterns, the trigger condition generation module further performs semantic analysis on the two types of abnormal pattern data. For the feature value out-of-limit abnormality, it extracts the feature parameter name and threshold condition from the abnormal parameter field, and constructs a judgment expression in the form of "feature parameter value < lower limit threshold" or "feature parameter value > upper limit threshold" as the fault trigger condition. For the signal deviation out-of-limit abnormality, it extracts the signal name, nominal value and deviation upper limit from the abnormal parameter field, and constructs a judgment expression in the form of "|actual signal value - nominal value|> maximum deviation" as the fault trigger condition.

[0050] Finally, the trigger condition generation module summarizes the fault trigger conditions generated by the two types of abnormal modes, combines them through logical OR operations, and forms a complete trigger condition judgment logic. When the IP core module is running, the real-time collected characteristic parameter values ​​and signal amplitudes are sent to the trigger condition judgment logic for real-time evaluation. Once any trigger condition is met, the fault trigger signal is output to start the acquisition and recording of the fault signal.

[0051] Generation of fault trigger conditions for feature value over-limit anomalies, feature extraction: First, according to the functional characteristics and performance requirements of the IP core module, determine the key feature parameters that reflect its operating status, such as throughput, latency, resource utilization, etc. In the design phase of the IP core module, insert a feature extraction module on the key data path to count and calculate these feature parameter values ​​in real time. The feature extraction module can be built based on circuit units such as hardware counters and shift registers, and obtain the instantaneous value or average value of the feature parameter online through operations such as accumulation, comparison, and shifting.

[0052] Threshold setting: For each characteristic parameter, set the upper and lower limits of its safety threshold according to the design indicators and application scenarios of the IP core module. The setting of the safety threshold needs to comprehensively consider the performance margin of the IP core module, environmental disturbance and other factors, and avoid being too loose to cause abnormal misdetection, and avoid being too strict to cause misdiagnosis. The threshold can be statically configured or dynamically adjusted according to the operation history and trend of the IP core module. Comparison judgment: Compare the real-time characteristic parameter value obtained by the feature extraction module with the preset threshold to determine whether it exceeds the limit. The specific judgment logic is: if the characteristic parameter value is higher than the upper threshold or lower than the lower threshold, it is considered that the characteristic value exceeds the limit and an abnormal detection signal is output; otherwise, the characteristic parameter is considered normal and no abnormal detection signal is output. The abnormal detection signal can be a single-bit Boolean value, which represents the abnormal state of the characteristic parameter. Abnormal reporting: When any characteristic parameter exceeds the limit, the abnormal detection signal is reported to the trigger condition generation module of the fault diagnosis circuit. The trigger condition generation module summarizes the abnormal state of each characteristic parameter and comprehensively determines whether to trigger the fault signal collection. For example, when multiple characteristic parameters exceed the limit at the same time, or a single characteristic parameter exceeds the limit multiple times in succession, it can be used as a condition to trigger fault signal collection.

[0053] Generation of fault trigger conditions for signal deviation exceeding the limit, benchmark modeling: First, statistical modeling is performed on the input, output and internal key node signals of the IP core module to obtain the amplitude distribution characteristics under the nominal working state. Modeling can be based on simulation data or chip sample test data, and statistical features such as the mean, variance, maximum value, and minimum value of the signal can be extracted through methods such as histogram and normal distribution fitting as a reference for fault diagnosis. Deviation calculation: When the IP core module is running, the amplitude data of the input, output and internal signals are collected in real time to calculate their deviation relative to the nominal value. The deviation can be measured by relative error, that is, |(actual signal value-nominal value) / nominal value|. In order to reduce the calculation overhead, simplified deviation indicators such as absolute error and mean square error can also be used. Deviation calculation can be implemented using a digital signal processing unit or an embedded soft core. Deviation judgment: The calculated signal deviation value is compared with the preset maximum allowable deviation threshold to determine whether it exceeds the limit. The specific judgment logic is: if the absolute value of the signal deviation is greater than the maximum allowable deviation, it is considered that the signal deviation exceeds the limit and an abnormal detection signal is output; otherwise, the signal deviation is considered normal and no abnormal detection signal is output. The abnormal detection signal can be a single-bit Boolean value, which represents the abnormal state of the signal.

[0054] Abnormal reporting: Similar to the abnormality of feature value exceeding the limit, when any signal has an abnormal deviation exceeding the limit, the abnormal detection signal is reported to the trigger condition generation module. The trigger condition generation module summarizes the abnormal status of each signal and determines whether to trigger the fault signal collection. For example, when the deviation of multiple signals exceeds the limit at the same time, or the deviation of the key signal exceeds the limit for a certain period of time, it can be used as a condition to trigger the fault signal collection. Finally, the trigger condition generation module logically combines the constructed feature value exceeding the limit trigger condition and the signal deviation exceeding the limit trigger condition to form the final fault trigger condition. The logical combination adopts the "or" relationship, that is, as long as any one of the trigger conditions is met, the fault trigger signal is output. The fault trigger signal is used as the input of the fault signal acquisition module to start the collection and recording of the fault signal of the IP core module until the fault disappears, completing the diagnosis and collection process from the abnormal mode to the fault signal.

[0055] Further, the state trigger condition includes a signal fluctuation trigger condition and an error code trigger condition. Specifically, the abnormal mode output by the association analysis module is input into the trigger condition generation module, and the type of the state trigger condition is determined to be a signal fluctuation trigger condition or an error code trigger condition according to the state type information in the abnormal mode; for the signal fluctuation trigger condition, the name of the key signal causing the abnormality, the sampling time window length and the fluctuation threshold range are extracted from the abnormal mode, and the signal fluctuation trigger condition is constructed, that is, when the amplitude fluctuation range of a key signal in the specified sampling time window exceeds the fluctuation threshold range, the fault signal acquisition is triggered; the sampling time window length is determined according to the control clock cycle and fault response time of the IP core module, and the fluctuation threshold range is determined according to the normal waveform characteristics of the key signal; for the error code trigger condition, the error code type and error code value causing the abnormality are extracted from the abnormal mode, and the error code trigger condition is constructed, that is, when an error code of a specified type and value appears in the state register or flag bit of the IP core module, the fault signal acquisition is triggered; the error code type and error code value are determined according to the design specification of the IP core module and the abnormal state code table.

[0056] The signal fluctuation trigger conditions and error code trigger conditions are summarized into the fault trigger logic circuit, and combined through the "OR" logic relationship to form the state trigger conditions; the state trigger conditions are combined with the characteristic value exceeding limit trigger conditions and the signal deviation exceeding limit trigger conditions through the "AND" logic relationship to form a complete fault trigger condition; the trigger condition generation module outputs the fault trigger condition to the fault signal acquisition module to realize the mapping from abnormal mode to fault acquisition trigger; the fault signal acquisition module monitors the data flow and status information of the IP core module in real time according to the fault trigger conditions. When the fault trigger conditions are met, the recording and preservation of the fault site data is started until the fault disappears, completing a debugging process from abnormal location to fault recording.

[0057] Compared with the prior art, the advantages of this application are:

[0058] By implementing the support vector machine model on the FPGA and using the feature extraction and classification of the data stream, the abnormal mode of the IP core module can be automatically identified, and the fault can be quickly detected and located. Combined with the control flow and data flow information obtained by static program analysis, the code location where the abnormality occurs can be accurately located, which improves the pertinence and effectiveness of debugging.

[0059] The introduction of optimization algorithms such as dual wavelet transform denoising, local preservation projection dimensionality reduction, and Bayesian estimation can effectively remove noise interference in the data stream, extract key feature dimensions, reduce the computational overhead of data processing, and ensure the real-time response capability of fault diagnosis. The improved Gaussian kernel function and SMO optimization algorithm are used to improve the classification generalization ability and convergence speed of the SVM model and reduce the false alarm rate and missed alarm rate.

[0060] Through loop identification algorithm and data flow analysis algorithm, the program structure and execution logic of IP core module are extracted, and the mapping relationship between source code and control flow graph is constructed. Combined with the correlation analysis of abnormal mode and code segment, a two-way tracking mechanism for data-level abnormality and code-level error is established, which can support both black box testing and white box testing, and realize comprehensive coverage and multi-angle diagnosis of IP core module.

[0061] By implementing computationally intensive tasks such as data processing, feature extraction, and anomaly classification in the form of hardware circuits and utilizing the parallel processing capabilities of FPGAs, the efficiency and throughput of fault diagnosis have been greatly improved. By implementing control-intensive tasks such as state machines, trigger conditions, and loop analysis in the form of reconfigurable logic, the adaptability and scalability of diagnostic strategies have been enhanced.

[0062] Combining data-driven abnormal feature extraction with code-driven static program analysis, a multi-dimensional diagnostic method that integrates data flow and control flow is formed. Through software and hardware collaborative design, the diagnostic function module is reusable, customizable and portable, supporting flexible debugging of IP cores of different types and sizes, and improving the adaptability, versatility and scalability of the diagnostic framework. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] This specification will be further described in the form of exemplary embodiments, which will be described in detail by the accompanying drawings. These embodiments are not restrictive, and in these embodiments, the same number represents the same structure, wherein:

[0064] Figure 1 is an exemplary flow chart of an FPGA-based IP core module debugging method according to some embodiments of this specification;

[0065] Figure 2is an exemplary flow chart of obtaining an abnormal mode according to some embodiments of this specification;

[0066] Figure 3 is an exemplary flow chart of obtaining high-dimensional features according to some embodiments of this specification;

[0067] Figure 4 is an exemplary flow chart of dimensionality reduction processing according to some embodiments of this specification;

[0068] Figure 5 is an exemplary flow chart of static analysis according to some embodiments of the present specification. DETAILED DESCRIPTION

[0069] The method and system provided in the embodiments of this specification are described in detail below with reference to the accompanying drawings.

[0070] Figure 1 This is an exemplary flow chart of an FPGA-based IP core module debugging method shown in some embodiments of the present specification. The FPGA-based IP core module debugging method includes: obtaining data streams generated under different abnormal conditions of the IP core module as simulation test cases; using a support vector machine (SVM) model to obtain a feature pattern in the data stream as an abnormal pattern, the abnormal pattern indicating the abnormal type of the data stream; according to the acquired abnormal pattern, setting a fault trigger condition for obtaining the corresponding abnormal pattern; according to the state change of the finite state machine (FSM) inside the IP core module, setting state trigger conditions under different states; debugging the IP core module according to the set trigger conditions and state trigger conditions; using a program control flow graph parsing algorithm to perform static analysis on the code of the IP core module; and debugging the IP core module through correlation analysis based on the debugging results and static analysis results.

[0071] The data acquisition module obtains the simulated data stream generated under different abnormal conditions of the IP core module as the input data of the technical solution. The software module is directly connected to the FPGA simulation platform to collect the data stream output by the IP core. On the FPGA platform, the abnormality of the IP core can be simulated by injecting different signals, such as: setting adder overflow, simulating algorithm abnormality, random disturbance signal, and simulating signal interference. The data acquisition module can obtain the analog data stream corresponding to the output of the IP core for different abnormal modes, such as: mode 1, normal data stream, mode 2, overflow error data stream, mode 3, noisy data stream. The collected multi-mode data stream samples are provided as input data to the technical solution of abnormality detection.

[0072] Figure 2This is an exemplary flow chart for obtaining abnormal patterns according to some embodiments of this specification. The input analog data stream contains noise, and an analog signal with a length of 1000 samples is generated, which contains a sine wave with 2 frequency components. Gaussian white noise is added to the signal, and the noise power is 30% of the signal power. A noisy analog data stream sample is obtained. 5-layer coiflet wavelet decomposition, the first layer, generates a low-frequency approximation coefficient cA1 and a detail coefficient cD1 of length 500, the second layer, cA1 is decomposed to generate cA2 and cD2, with lengths of 250 respectively, and so on, the fifth layer obtains cA5 and cD5. High-frequency detail signal threshold processing, since the noise is mainly at high frequency, set a hard threshold of 15 to filter cD1 to cD5 of 5 layers, and set the detail coefficients with absolute values ​​less than 15 to 0. Keep the low-frequency approximation signal, and keep the low-frequency approximation coefficient cA5 of the fifth layer, which contains the denoised main signal. Wavelet inverse transform reconstruction, inverse transform the coefficients after threshold processing to obtain the denoised signal. The signal has been denoised using the coiflet wavelet forward transform, and its length is 1000. The denoised signal is decomposed into 5 layers using the bior1.5 wavelet to obtain the low-frequency approximation coefficient cA and the high-frequency detail coefficient cD. The low-frequency approximation coefficient cA is kept unchanged, containing the main energy. The high-frequency detail coefficient cD is set to zero. The coefficients after zeroing are inversely transformed using the bior1.5 wavelet. The reconstructed signal after the inverse transformation is obtained, and the noise and error are further reduced through bior wavelet reconstruction, and the denoised and cleaned data is output. Compared with the original signal, the signal-to-noise ratio is improved by 2dB, ensuring the quality of the reconstructed data.

[0073] Figure 3 This is an exemplary flow chart for obtaining high-dimensional features according to some embodiments of the present specification. Denoised signal: an analog signal sequence x[n] with a length of 1000. Select the sliding window length: first take L=50, 100, 150, 200 for division, calculate the signal-to-noise ratio (SNR) under each window length, and use Bayesian estimation to determine that the SNR is the highest when L=200. Time domain feature extraction: divide the signal x[n] into sliding windows of length 200, for example, the first window signal is x1[n], n=1,...,200. Calculate the statistical features of x1[n]: mean u1=0.51, variance σ1=0.23, peak coefficient γ1=1.38. Sliding window sampling, slide the segmented signal in turn, and extract the time domain features of each window.

[0074] Sliding window signal: the signal x[n] has been divided into sliding window signals of length 200, for example, the first window signal is x1[n], n=1, ..., 200. FFT transformation: perform 512-point FFT on x1[n], use the Pinault sequence for oversampling, and obtain its spectrum X1[k], k=1, ..., 512. Frequency domain feature extraction: calculate the power spectrum: P1[k]=|X1[k] 2 , calculate the power spectral density: calculate the average value of P1[k] in different frequency bands respectively, and calculate the spectral entropy:

[0075] H1=-∑P1[k]×logP1[k], sliding calculation, repeat FFT and frequency domain feature extraction for each window signal. Frequency domain feature matrix, finally forming a matrix containing all window frequency domain features. Sliding window signal, wavelet packet decomposition, using orthogonal matching pursuit algorithm, select db5 as wavelet packet, perform 3-layer wavelet packet decomposition on x1[n], and obtain multiple packet signals. Feature extraction, calculate the energy E of each packet signal i . Packet energy ratio: R i =E i / ∑(E i ), reconstruct the features, and divide the proportion of each package into R according to the decomposition structure. i Reconstruct and obtain time-frequency features. Sliding calculation, repeat the time-frequency feature extraction of each window signal, time-frequency feature matrix, and finally form the time-frequency feature matrix of all windows.

[0076] Extract time domain statistical features from the denoised data: an analog signal sequence with a length of 1000, after wavelet denoising. Time domain statistical feature extraction: calculate the mean of the signal: 0.51, calculate the variance of the signal: 0.23, calculate the skewness of the signal: -0.03 (close to symmetrical distribution), calculate the peak value of the signal: 1.38, calculate the root mean square value of the signal: 0.72. Construct feature vector: construct the above statistics into a 5-dimensional vector as the time domain statistical feature of the signal sequence: [0.51, 0.23, -0.03, 1.38, 0.72]. Extract frequency domain features from the denoised data: an analog signal sequence with a length of 1000, after wavelet denoising. Perform a 1024-point fast Fourier transform (FFT) on the signal. Calculate the main frequency components and amplitudes of the signal, such as f1 = 10Hz, A1 = 1.5, calculate the absolute mean of the spectrum: 0.32, calculate the standard deviation of the spectrum: 0.11, calculate the skewness of the spectrum: -1.02. Construct the frequency domain feature vector: [f1, A1, 0.32, 0.11, -1.02]. Extract time-frequency features: A simulation signal sequence with a length of 1000 has been denoised by wavelet. Use the db5 wavelet basis to perform a three-layer wavelet decomposition on the signal. Calculate the energy ratio of each layer of wavelet coefficients to reflect the time-frequency information. The energy ratio of the first layer: 0.7, the energy ratio of the second layer: 0.2, and the energy ratio of the third layer: 0.1. Construct the time-frequency feature vector: [0.7, 0.2, 0.1]. Construct a high-dimensional feature vector. The feature extraction results are as follows: time domain statistical features: [0.51, 0.23, -0.03, 1.38, 0.72], frequency domain features: [f1, A1, 0.32, 0.11, -1.02], time-frequency features: [0.7, 0.2, 0.1]. Construct a high-dimensional feature vector: simply arrange and combine the above three types of features to form a 13-dimensional feature vector: [0.51, 0.23, -0.03, 1.38, 0.72, f1, A1, 0.32, 0.11, -1.02, 0.7, 0.2, 0.1]. The high-dimensional vector contains the time domain, frequency domain and time-frequency information of the signal at the same time, which can fully reflect the characteristics of the signal.

[0077] Figure 4 is an exemplary flow chart of dimensionality reduction processing according to some embodiments of this specification. X contains 500 samples, each of which is a 20-dimensional feature vector. The size of X is 500×20. Calculate the distance matrix D: Take two samples x in X i and x j , are 20-dimensional vectors. Their Euclidean distance is: Traverse and calculate the Euclidean distance between each pair of samples in X to form a 500×500 symmetric distance matrix D. i =[1.1, 2.3, 1.7,...,],xj =[0.5, 3.1, 2.2, ...,], Euclidean distance d ij =1.23, calculate all samples in turn to get the distance matrix D. The Euclidean distance matrix D between each sample has been calculated, with a size of 500×500. Determine the number of K nearest neighbors to find for each sample, here set K=5. For sample x i : Find the distance x in the i-th row of D i The index of the 5 most recent samples. These 5 samples are x i Repeat the above steps to search for the 5 nearest neighbors of each sample. Record the K nearest neighbor indexes of all samples together to form a K nearest neighbor structure. The index information of the 5 nearest neighbors of each sample. The K nearest neighbor structure has obtained the 5 nearest neighbor index information of each high-dimensional sample. Laplacian matrix L, L is a 500×500 symmetric matrix. Assignment method: If i and j are connected in the K nearest neighbor structure, then: Lij = 1 / distance d ij (take the value from the distance matrix D), otherwise L ij =0. Sample 2 and sample 5 are connected in the K nearest neighbor structure, and the distance d_25 = 3.2, then L_25 = 1 / 3.2L_52 = 1 / 3.2, symmetric matrix, assign values ​​in sequence to construct a symmetric Laplacian matrix L. Given the Laplacian matrix L, size 500×500, and the distance matrix D, size 500×500. Find the first projection vector y1: The objective function is y1 represents a vector, Represents the transpose of the vector, L and D represent matrices, and the objective function represents the correlation between vector y1 and the matrix, reflecting the representativeness of the information contained in matrix L for vector y1, and is the energy of vector y1 in the subspace defined by matrix L. Subspace refers to the space composed of the eigenvectors corresponding to matrix L. Use the optimization algorithm to solve and obtain y1, whose dimension is 500. Repeat the solution: Solve y2, y3, etc. in the same way until 20 500-dimensional projection vectors are solved. Form a projection matrix: Combine the 20 projection vectors to form a projection matrix M with a size of 500×20, and M is an orthogonal matrix: Normalize y to satisfy M'M=I, output the projection matrix M, and perform subsequent dimensionality reduction calculations. Original high-dimensional matrix: X is a high-dimensional feature matrix of 500×20, projection matrix: the previously constructed LPP projection matrix M is an orthogonal matrix of 500×5. Dimensionality reduction calculation: Z=M T ×X, here: M T is a 5×500 matrix, X is a 500×13 matrix, so the calculated Z is a 5×20 low-dimensional matrix. Matrix properties: L is a 500×500 positive definite symmetric matrix, M is a 500×5 orthogonal matrix (M T×M=I), the result is: Z is the new feature matrix after dimensionality reduction to 5 dimensions, with a size of 5×13.

[0078] The Locality Preserved Projections (LPP) algorithm is used to reduce the dimensionality of high-dimensional features. High-dimensional features: a 13-dimensional feature matrix containing 500 samples, each sample is a 13-dimensional vector. 500 samples, each sample is a 13-dimensional vector, forming a 500×13 feature matrix X. The Euclidean distance between each sample vector in X is calculated to construct the similarity graph W between the samples. Based on graph W, the LPP transformation matrix M is constructed, and the matrix size is 13×3. Original feature matrix X: 500 13-dimensional samples, X is 500×13. Similarity graph W: W is a 500×500 symmetric matrix, W ij Indicates the similarity between samples i and j. Construct LPP matrix: Calculate the Laplacian matrix L = DW, where D is the diagonal matrix. Generate a 13×3 random matrix U. Calculate M = argmin_M||X T M|| 2 , constraint M T ×L×M=I. Through optimization, M is solved, and the dimension is 13×3. Dimension reduction calculation: Y=M T ×X, parameter settings: neighborhood size 5, heat kernel parameter 1.

[0079] The constructed projection matrix is ​​used for dimensionality reduction. The original feature matrix X: X is a 500×13 matrix containing 500 13-dimensional feature vectors. The LPP matrix M: M is obtained by graph construction optimization and has a size of 13×3. Dimensionality reduction calculation: Y=M T ×X, where X is a 500×13 matrix, M T It is a 3×13 matrix, so Y = 500×3. The first sample vector in X is: [1.2, 3.4, 5.7, ...,], 13 dimensions, M T The first row vector is:

[0080] [0.2, 0.3, 0.1, ...,], 3 dimensions. Then the first sample vector in Y is the inner product of the two, and the 3-dimensional [2.1, 1.5, 0.8] is obtained. The result: the 500×3 feature matrix Y after dimensionality reduction is obtained, and each sample is reduced from 13 dimensions to 3 dimensions.

[0081] Train the SVM model, use C-SVM, set the penalty parameter C = 1. Gaussian kernel function, set the initial kernel width σ0 = 0.5, adjust the parameters α = 0.8, β = 0.5. For the sample x and support vector x i , the kernel function expression is: Input the low-dimensional feature subset into the kernel SVM, and obtain the SVM model after iterative optimization and solution. Use the LPP algorithm to reduce the 13-dimensional features of 500 samples to 3 dimensions, and obtain a 500x3 feature matrix X. Use the SVM package of scikit-learn and set the kernel function to the RBF kernel. The main parameters include: kernel = 'rbf', C = 1.0, gamma = 0.1. Take the 3-dimensional feature matrix X as input to train the SVM model. The SVM package uses the SMO algorithm to optimize the training and solve the optimal hyperplane parameters. The SVC module will automatically call the SMO sequence minimum optimization algorithm when fitting, and accelerate the solution of the SVM dual problem through iteration. SMO will solve w and b in the decision function and define the optimal segmentation hyperplane. After training, output the optimized SVC model clf, which contains the parameters obtained by the solution. After training, output the optimized SVM classification model. Use the trained SVM model to detect abnormal patterns in the test data stream and generate a simulated test signal of length 2000, including normal patterns and introduced abnormal patterns. Previously, an RBF kernel SVM model has been trained using the reduced-dimensional data. Input the test signal sequence point by point and use the SVM model to determine whether it belongs to the normal pattern or the abnormal pattern. anomalies = [], for i in range (len (test_data)): if svm_predict (test_data [i]) == -1: anomalies.append (i). The anomalies list records the index of the detected abnormal points.

[0082] The trained RBF kernel SVM model contains information such as support vectors and decision functions. Generate a time series signal of length 2000 as the test stream input. Use the SVM model to detect each sample x[i] in X: Substitute x[i] into the SVM decision function to calculate the classification output y[i]. If y[i] = -1, it is detected as an outlier. The points in X with subscripts [113, 115, 201, 256] are detected as outliers, and their indexes are recorded in a list. Finally, a list of outlier indexes is obtained, which represents the detection results. It is detected that there are abnormal patterns in the two intervals of [100, 350] and [800, 880] in the data stream. [100, 350] corresponds to the signal deviation exceeding the limit, and [800, 880] corresponds to the characteristic value exceeding the limit. If the absolute value of the deviation between the signal and the normal range is greater than 0.2, it is judged as abnormal. If the characteristic value is greater than 0.8, it is judged as abnormal. If the signal fluctuation is significantly increased or an error code appears, it is also judged as abnormal. The above three types of trigger conditions are combined to form the final comprehensive trigger condition. According to the abnormal pattern results, the corresponding trigger condition is set. Existing trigger conditions: A: The absolute value of the signal deviation is greater than 0.2, B: The characteristic value is greater than 0.8, C: Signal fluctuation or error code is detected. Logical combination: Use the logical "or" relationship to combine the trigger conditions: Trigger condition = A or B or C. Judgment rule: If any one of the conditions A, B or C is met, it is judged as abnormal and an alarm is triggered. The individual trigger conditions are combined through the logical "or" relationship to form the final comprehensive trigger condition.

[0083] IP core debugging module, according to the generated trigger conditions, performs exception capture and dynamic debugging on the IP core module. The generated trigger condition expression contains three parts: signal deviation, eigenvalue and status. The implemented IP core function code is used for signal processing. The trigger condition expression is as follows: if (A or B or C): trigger exception, where: A: signal deviation > 0.2, B: eigenvalue > 0.8, C: fluctuation or error detected. Main functional modules of IP core code: def signal filtering ():. def feature extraction (): ..., def pattern recognition (): ...,. Code format, written in Python language. Signal filtering, feature extraction and pattern recognition. Exception capture, insert in the signal filtering function: if signal deviation > 0.2: print ("Capture signal deviation exception"), dynamic debugging, insert in the feature extraction function: print ("Current eigenvalue:", calculate eigenvalue), output_status (). Simulation verification, build a test input signal with noise or distortion. Run the code and observe whether the print output meets expectations. Debug optimization, such as print output formatting to make the log clearer. Add code comments, etc. Output, get the IP core code with debug statements inserted.

[0084] Figure 5 It is an exemplary flow chart of static analysis according to some embodiments of this specification. The IP core source code is a Python code for signal filtering and feature extraction, which contains multiple functions. Traverse the code to obtain basic grammatical elements, such as keywords, variable names, operators, etc. Scan the code to obtain basic grammatical elements such as keywords (import, def, return, etc.), variable names (x, y, feat), operators (=). Build a syntax tree based on lexical elements and analyze grammatical relationships. For example, the filter function body and the feature_extract function body are basic blocks. Based on the previous lexical analysis, a syntax tree of the code is constructed: the function definition is the root node of the tree, the statements in the function body are child nodes, and the execution logic relationship between the statements is represented as the branches of the tree. While building the syntax tree, check the correctness of the syntax. Basic blocks can be directly obtained from the syntax tree: two statements in the filter function body are a basic block, and three statements in the feature_extract function body are a basic block. Each basic block has only one entry and one exit. Statements in the basic block are executed continuously in sequence. The code contains basic blocks A, B, and C. After A is executed, the condition is judged, and B or C is executed according to the judgment result. Nodes: basic blocks A, B, C, edges: A connected to B, A connected to C, conditions: the edge from A to B / C is marked with judgment conditions. Nodes: basic blocks A, B, C, edges: A connected to B, A connected to C, conditions: the edge from A to B / C is marked with judgment conditions. Contains basic blocks A, B, C, where A is connected to B and C after judgment, and C is connected back to A to form a loop. Scan the nodes and edges of the control flow graph to find loop paths with the same starting point and end point. Use highlighting or bold styles to indicate loops, and add text comments next to the loop path to indicate the loop structure. Handle more complex multi-layer nested loops. Data flow analysis, basic block A defines variable x, basic block B uses variable x for calculations, and marks the data dependency of x flowing from A to B. In basic block B, if x meets a certain condition, it is judged as an exception. Match the code logic that uses x in basic block B with the exception pattern. Control flow graph: annotate basic blocks and execution flow, data flow graph: annotate data flow between variable definition and use, text report: explain the correspondence between abnormal mode and code logic. Based on the analysis, code optimization suggestions are given.

Claims

1. A method for debugging an IP core module based on FPGA, comprising: Obtain the data streams generated by different abnormal situations of the IP core module as simulation test cases, and input the data streams into the support vector machine (SVM) model set on the FPGA chip; Using the support vector machine (SVM) model, feature extraction is performed on the input data stream to obtain the feature pattern in the data stream as the abnormal pattern; wherein the abnormal pattern represents the abnormal type of the data stream; According to the acquired abnormal mode, a fault trigger condition corresponding to the abnormal mode is set and acquired, and the fault trigger condition is stored in a storage unit of the FPGA chip; Obtain the state change information of the finite state machine FSM inside the IP core module, set the state trigger conditions under different states according to the state change information, and store the state trigger conditions in the storage unit of the FPGA chip; According to the fault trigger conditions and status trigger conditions stored in the storage unit of the FPGA chip, the input data and output data of the IP core module are monitored. When the fault trigger conditions or status trigger conditions are detected, the IP core module is debugged through the debugging logic circuit set on the FPGA chip to obtain the debugging results; Use the program control flow graph parsing algorithm set on the FPGA chip to perform static analysis on the code of the IP core module and obtain static analysis results; According to the debugging results and static analysis results, the code segments related to the exception in the IP core module are obtained through the association analysis algorithm, and the obtained code segments are marked and modified.

2. The FPGA-based IP core module debugging method according to claim 1, characterized in that: The support vector machine (SVM) model is used to extract features from the input data stream and obtain the characteristic patterns in the data stream as abnormal patterns, including: The input data stream is denoised by a double wavelet transform denoising circuit arranged on the FPGA chip to obtain a denoised data stream; According to the denoised data stream, feature values ​​including time domain features, frequency domain features and time-frequency features are extracted, and the extracted feature values ​​are used to form a high-dimensional feature vector; Taking the high-dimensional feature vector as input, the local preservation projection (LPP) algorithm is used to reduce the dimension of the high-dimensional feature vector to obtain the low-dimensional feature vector after dimension reduction. The low-dimensional feature vector is used as input to establish a support vector machine (SVM) model. The low-dimensional feature vector is used as a training sample to train the SVM model. The dual problem of the SVM model is solved by the sequential minimum optimization (SMO) algorithm to obtain the optimal hyperplane parameters of the SVM model. The trained SVM model is used to classify the feature vectors of the data stream, and the abnormal type of the data stream is determined according to the classification result to obtain the abnormal mode of the data stream.

3. The FPGA-based IP core module debugging method according to claim 2, characterized in that: The dual wavelet transform denoising circuit performs dual wavelet transform denoising on the input data stream, including: The dual wavelet transform denoising circuit includes a coiflet wavelet filter and a bior wavelet filter; The coiflet wavelet filter is used to perform forward wavelet transform on the input data stream. The low-frequency coefficients and high-frequency coefficients of the data stream are extracted by multi-level wavelet decomposition of the data stream. The high-frequency coefficients are threshold processed and the high-frequency coefficients less than the threshold are set to zero. The high-frequency coefficients after threshold processing and the low-frequency coefficients are reconstructed by wavelet to obtain the data stream after forward transform. The bior wavelet filter is used to perform multi-level wavelet decomposition on the data stream after forward transformation to extract the low-frequency coefficients and high-frequency coefficients of the data stream after forward transformation; the high-frequency coefficients are subjected to inverse threshold processing, and the high-frequency coefficients greater than the threshold are set to zero to remove the high-frequency details introduced in the forward transformation; the high-frequency coefficients and low-frequency coefficients after inverse threshold processing are subjected to wavelet reconstruction to obtain the denoised data stream output.

4. The FPGA-based IP core module debugging method according to claim 3, characterized in that: Get high-dimensional feature vectors, including: The Bayesian estimation algorithm is used to estimate the statistical characteristics of the denoised data stream, and the optimal sliding window width is solved by maximizing the posterior probability; According to the optimal sliding window width, the sliding average method is used to perform window processing on the data stream, and the mean, variance and kurtosis coefficient of each data window are calculated. The calculated mean, variance and kurtosis coefficient are output as the time domain statistical characteristics of the data stream; The fast Fourier transform algorithm based on the Pinault sequence is used to perform Fourier transform on the denoised data stream, and the power spectrum density and spectrum entropy of the data stream are calculated. The calculated power spectrum density and spectrum entropy are used as the frequency domain feature output of the data stream; The orthogonal matching pursuit algorithm is used to perform adaptive wavelet packet decomposition on the denoised data stream. The projection coefficients of the data stream on different wavelet packet bases are calculated, and the wavelet packet base with the largest projection coefficient is selected as the best matching base to obtain the optimal wavelet packet node of the data stream. The wavelet coefficients of the optimal wavelet packet node are sparsely represented. By setting the sparsity threshold, the wavelet coefficients smaller than the threshold are set to zero to obtain the sparse wavelet coefficients of the data stream. The sparse wavelet coefficients are reconstructed, and the energy distribution and coherence of the wavelet packet nodes at different scales are calculated. The calculated wavelet packet energy spectrum and inter-packet coherence are output as the time-frequency characteristics of the data stream. The obtained mean, variance, kurtosis coefficient, power spectral density, spectral entropy, wavelet packet energy spectrum and inter-packet coherence constitute a high-dimensional feature vector of the data stream.

5. The FPGA-based IP core module debugging method according to claim 4, characterized in that: The high-dimensional feature vector is used as input, and the local preservation projection LPP algorithm is used to reduce the dimension of the high-dimensional feature vector to obtain the low-dimensional feature vector after dimension reduction, including: By calculating the Euclidean distance between any two high-dimensional feature vectors, a distance matrix between high-dimensional feature vectors is constructed; Based on the distance matrix, search for K nearest neighbor vectors for each high-dimensional feature vector to construct the K nearest neighbor structure of the high-dimensional feature vector; Traverse the K nearest neighbor structure of each high-dimensional feature vector. If two high-dimensional feature vectors are each other's K nearest neighbors, fill in 1 in the Laplacian matrix element at the corresponding position, otherwise fill in 0, and construct the Laplacian matrix of the high-dimensional feature vector. The Rayleigh quotient iteration algorithm is used to solve the generalized eigenvalue problem of the Laplace matrix, and the generalized eigenvector corresponding to the minimum non-zero generalized eigenvalue equal to the preset dimensionality reduction amount is obtained. The obtained generalized eigenvector is used as the projection vector of the local preservation projection algorithm to form a projection matrix; The projection matrix is ​​used to project the high-dimensional feature vector to obtain the low-dimensional feature vector after dimensionality reduction.

6. The FPGA-based IP core module debugging method according to claim 5, characterized in that: The Laplace matrix adopts a positive definite matrix; The projection matrix uses an orthogonal matrix.

7. The FPGA-based IP core module debugging method according to any one of claims 2 to 6, characterized in that: The support vector machine SVM model adopts the C-SVM model; The kernel function of the C-SVM model uses the Gaussian kernel function; The expression of Gaussian kernel function is as follows: Among them, x and x i is the sample feature vector input to the kernel function, representing the test sample and support vector in the support vector machine respectively; tx-x i t represents the test sample x and the support vector x i The Euclidean distance between i ) represents the value based on x and x i Variable kernel width; Among them, σ0 is the initial kernel width of the Gaussian kernel function, and its value is predetermined before training; α is the kernel width adjustment parameter, which controls the amplitude of the kernel width change, and its value range is a positive real number; β is the kernel width adjustment parameter, which controls the rate of kernel width change, and its value range is a positive real number.

8. The FPGA-based IP core module debugging method according to claim 7, characterized in that: Use program control flow graph analysis algorithm to perform static analysis on the IP core module code, including: Using lexical analysis and syntax analysis, traverse the source code of the IP core module to obtain the basic blocks in the source code. Each basic block represents a continuous instruction sequence with a single entry and a single exit. Using the control flow construction algorithm, the control flow graph of the IP core module is constructed according to the jump relationship and conditional judgment statements between the basic blocks. The nodes in the control flow graph represent the basic blocks, and the directed edges represent the execution order and conditional judgment relationship between the basic blocks. The loop identification algorithm Tarjan is used to traverse the control flow graph, identify the strongly connected components with the same starting and ending nodes, mark the node sets corresponding to the strongly connected components as loops, obtain the location information of the loops in the source code, and generate an annotated control flow graph with loop information; Using the arrival-set value data flow analysis algorithm, traverse each path on the annotated control flow graph, and obtain the operation logic of the IP core module based on the semantic information of the instructions and the definition-usage relationship of the variables; the operation logic includes the execution order of instructions, the transmission and calculation order of data; Using a pattern matching algorithm, we search for code snippets that match the exception pattern in the operating logic of the IP core module, and establish an association between the operating logic and the code corresponding to the exception pattern. The association is used for fault diagnosis at the source code level.

9. The FPGA-based IP core module debugging method according to claim 8, characterized in that: According to the acquired abnormal mode, set the fault trigger conditions, including: According to the type of abnormal pattern, it is divided into characteristic value exceeding limit abnormality and signal deviation exceeding limit abnormality; among them, characteristic value exceeding limit abnormality indicates that the characteristic parameter value in the data stream of the IP core module exceeds the preset safety threshold range, and the signal deviation exceeding limit abnormality indicates that the deviation of the signal amplitude in the data stream relative to the nominal value exceeds the preset maximum allowable deviation. For feature value exceeding limit exceptions, extract the feature parameter name and upper and lower limits of the safety threshold that caused the exception from the exception pattern, and construct the feature value exceeding limit triggering condition; For the signal deviation exceeding the limit exception, the signal name, nominal value and maximum allowable deviation that caused the exception are extracted from the exception pattern, and the signal deviation exceeding the limit trigger condition is constructed; The constructed characteristic value exceeding limit trigger condition and signal deviation exceeding limit trigger condition are logically combined to form the final fault trigger condition.

10. The FPGA-based IP core module debugging method according to claim 9, characterized in that: The status trigger conditions include signal fluctuation trigger conditions and error code trigger conditions.

Citation Information

Patent Citations

  • Method for detecting logistics equipment anomaly under imbalance data based on kernel entropy component analysis

    CN107247968A

  • System and method of machine training model of detecting malicious files

    CN109271780A

  • Data processing method and device and related product

    CN114185667A

  • Modular GPU architecture for clients and servers

    CN115951980A

  • FPGA chip debugging method and device based on comprehensive netlist

    CN116629171A

Cited By

  • Controller model determination method, hydrogen flow control method and device

    CN120065806A

  • Voltage-sensitive device damage diagnosis system combined with pulse test

    CN120336923A

  • Low-rank DCT compressed sensing algorithm realized based on FPGA

    CN120956909A

  • RTL code simulation method and device, storage medium, computer program product, server and system

    CN121562524A