Filtering method, device and equipment of convolution-based FIR (Finite Impulse Response) digital filter and medium

By using a convolution-based FIR digital filtering method, and leveraging a one-dimensional convolution kernel and LineBuf padding operation, the computational complexity and latency issues of FIR digital filters under high real-time performance and resource constraints are resolved, achieving high-speed computation with low resource consumption.

CN121036724APending Publication Date: 2025-11-28SHENZHEN UNIVERSITY OF ADVANCED TECHNOLOGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511058343.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-30
Publication Date
2025-11-28

AI Technical Summary

Technical Problem

Existing FIR digital filters suffer from high computational complexity, high energy consumption, high hardware resource consumption, and latency issues due to high real-time requirements and high computational resource constraints, making it difficult to meet real-time processing needs.

Method used

A convolution-based FIR digital filtering method is adopted. By obtaining a one-dimensional convolution kernel and activation data, a LineBuf padding operation is used to overcome the boundary effect, and a MAC array is used for convolution calculation. A staged loading LineBuf module is designed to reduce resource overhead.

Benefits of technology

It achieves high-speed computing with low resource consumption, reduces hardware overhead and computing latency, and is suitable for the real-time processing needs of embedded systems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121036724A_ABST
    Figure CN121036724A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of FIR digital filters, and discloses a filtering method, device and equipment of a convolution-based FIR digital filter and a medium, and the method comprises the steps: obtaining a one-dimensional convolution kernel and activation data corresponding to an N-order FIR digital filter; through LineBuf, filling operation is carried out on the activated data to overcome the boundary effect, and filled sub-data is obtained; and performing convolution operation based on the convolution kernel and the subdata through the MAC array to obtain a filtering result. The method is based on the convolution method and designs the LineBuf module loaded in stages, and benefits from the advantage, and a large amount of resource overhead can be reduced under the degree of parallelism. Besides, benefited from the advantages of the convolution method, the calculation parallelism degree is improved under the condition that the register overhead is not greatly increased, delay caused by software processing data filling is avoided through the LineBuf module, and high-speed calculation can be carried out under the condition of low resources. And meanwhile, the neural network accelerator and a common neural network accelerator are fused and share one MAC array, so that the hardware overhead is further reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of FIR digital filter, and particularly relates to a filtering method and device of FIR digital filter based on convolution, equipment and medium. BACKGROUND

[0002] FIR (Finite Impulse Response) digital filter is one of the most widely used feature extraction algorithms in the field of digital signal processing. Its excellent linear phase characteristics and stability make it perform well in various signal processing tasks, covering audio processing, image processing, communication systems, and biomedical signal analysis, etc. With the rapid development of intelligent driving, radar signal processing, real-time physiological signal detection, and other frontier technologies, higher real-time and efficiency requirements are put forward for signal processing algorithms. These application scenarios usually need to complete high-speed and accurate data processing under the limitation of limited computing resources and strict power consumption. For example, real-time environmental perception and decision-making in intelligent driving systems, high-resolution target detection in radar systems, and real-time health status analysis in physiological monitoring devices, etc. all pose severe challenges to the performance of FIR digital filter.

[0003] Currently, FIR filter is usually implemented in real-time demand and resource-limited devices using xilinx IP core or in a serial iterative manner to realize the filtering function. Although this reduces resource consumption to some extent, the delay of these implementation methods increases significantly as the filter order increases. Some FIR filters implemented using parallel computing methods have significantly improved computing speed, but also require the development of a separate module, which in turn leads to huge resource consumption.

[0004] In the current FIR filter design that meets the high real-time and high-speed data processing requirements, the following problems are generally faced: (1) High computational complexity: The computational complexity of traditional FIR filters increases linearly with the increase of filter order, resulting in significant increase in computing resources consumption under high-order filtering demand, making it difficult to meet the requirements of real-time processing. (2) High energy consumption: High-frequency computing operations and large amounts of data transmission not only increase the energy consumption of the system, but also threaten the battery life of portable and embedded devices, limiting their promotion in low-power applications. (3) High hardware resource occupation: In order to achieve high-speed filtering, special hardware accelerators or a large number of parallel processing units are usually required, which is difficult to implement in resource-limited embedded systems, resulting in significant increase in design complexity and cost. (4) Delay problem: In some applications that are extremely sensitive to delay, such as real-time control systems and high-speed communication systems, the processing delay of traditional FIR filters may affect the overall performance and response speed of the system.

[0005] In summary, the current FIR digital filter hardware module has high delay or large resource consumption. SUMMARY

[0006] The main purpose of the present application is to provide a convolution-based FIR digital filter filtering method, device, equipment and computer readable storage medium, aiming at solving the technical problems of the current FIR digital filter hardware module with high delay or large resource consumption.

[0007] To achieve the above-mentioned purpose, the present application provides a convolution-based FIR digital filter filtering method, which comprises the following steps:

[0008] Obtain a one-dimensional convolution kernel corresponding to an N-order FIR digital filter and activation data, wherein the convolution kernel is a one-dimensional convolution kernel with a filter parameter of an N-order FIR digital filter expanded into a convolution kernel with a height of 1, a width of N, an input channel and an output channel of 1, and the original data is an activation data with an input length of M expanded into an input with a height of 1, a width of M and an input channel number of 1;

[0009] Fill the activation data through LineBuf to overcome the boundary effect and obtain the filled sub-data;

[0010] Convolve the convolution kernel and the sub-data through the MAC array to obtain the filtering result.

[0011] Further, the sub-data includes first sub-data, and the step of filling the activation data through LineBuf to overcome the boundary effect and obtain the filled sub-data comprises:

[0012] If LineBuf is the first time to load the activation data, LineBuf reserves the leftmost N / 2 padding space as the first padding space;

[0013] Left padding is performed on the first activation data to copy the first data in the first activation data and store it in the first padding space, wherein the first activation data refers to the activation data loaded for the first time in LineBuf;

[0014] Invalid input data is added based on the left-padded first activation data to obtain the first sub-data.

[0015] Further, the sub-data includes second sub-data, and the step of filling the activation data through LineBuf to overcome the boundary effect and obtain the filled sub-data comprises:

[0016] If the LineBuf is the last time to load the active data, the LineBuf reserves the rightmost N / 2 padding space as the second padding space;

[0017] The second active data is right-padded to copy the last data of the second active data and store it in the second padding space, wherein the second active data refers to the last time to load the active data in the LineBuf;

[0018] Invalid input data is added based on the second active data after right padding to obtain the second sub-data.

[0019] Further, the step of adding invalid input data based on the first active data after left padding to obtain the first sub-data further comprises:

[0020] Invalid input data is added at the tail of the first active data after left padding, and the first active data after adding invalid input data in the LineBuf is taken as the first sub-data.

[0021] Further, the step of adding invalid input data based on the second active data after right padding to obtain the second sub-data further comprises:

[0022] Invalid input data is added at the head of the second active data after right padding, and the second active data after adding invalid input data in the LineBuf is taken as the second sub-data.

[0023] Further, the sub-data comprises a third sub-data, and the step of performing padding operation on the active data by the LineBuf to obtain the padded sub-data to overcome the boundary effect further comprises:

[0024] For the active data entering the LineBuf, if it is not the first time to load or not the last time to load, invalid input data is added at the head and tail of the third active data loaded in the current LineBuf, wherein the third active data refers to the active data loaded by the LineBuf except for the first time to load or the last time to load;

[0025] The third active data after adding invalid input data is taken as the third sub-data, wherein the third active data after adding invalid input data has the same data length as the first sub-data.

[0026] In addition, to achieve the above object, the application further provides a filtering device of a convolution-based FIR digital filter, which comprises:

[0027] The acquisition module is used for acquiring a one-dimensional convolution kernel corresponding to an N-order FIR digital filter and activation data, wherein the convolution kernel is a one-dimensional convolution kernel obtained by unfolding filter parameters of an N-order FIR digital filter into a one-dimensional convolution kernel with a convolution kernel height of 1, a convolution kernel width of N, an input channel of 1 and an output channel of 1, and the original data is activation data obtained by unfolding an input length of M into an input with a height of 1, a width of M and an input channel number of 1.

[0028] The padding operation module is used for performing a padding operation on the activation data through the LineBuf to overcome the boundary effect and obtain sub-data after padding.

[0029] The filter module is used for performing a convolution operation on the convolution kernel and the sub-data through the MAC array to obtain a filter result.

[0030] In addition, to achieve the above object, the application further provides a filter device of a convolution-based FIR digital filter, which comprises a memory, a processor and a filter program of the convolution-based FIR digital filter stored in the memory and executable on the processor, and the filter program of the convolution-based FIR digital filter realizes the steps of the filter method of the convolution-based FIR digital filter when executed by the processor.

[0031] To achieve the above object, the application further provides a computer program product, which comprises a computer program, and the computer program realizes the steps of the filter of the convolution-based FIR digital filter when executed by a processor.

[0032] In addition, to achieve the above object, the application further provides a computer readable storage medium, which stores a filter program of a convolution-based FIR digital filter, and the filter program of the convolution-based FIR digital filter realizes the steps of the filter method of the convolution-based FIR digital filter when executed by a processor.

[0033] The application obtains a one-dimensional convolution kernel corresponding to an N-order FIR digital filter and activation data, wherein the convolution kernel is a filter parameter of an N-order FIR digital filter, which is unfolded into a one-dimensional convolution kernel with a convolution kernel height of 1, a convolution kernel width of N, an input channel of 1 and an output channel of 1, and the original data is input length M, which is unfolded into an activation data with an input height of 1, an input width of M and an input channel number of 1, then the activation data is filled by LineBuf to overcome the boundary effect, and the filled sub-data is obtained, finally, the convolution operation is performed on the convolution kernel and the sub-data by the MAC array, and the filtering result is obtained. The application is designed based on the convolution method and the LineBuf module is designed in stages, which can reduce a large amount of resource consumption under the parallel degree due to the advantage. In addition, due to the advantage of the convolution method, the calculation parallel degree is improved without increasing the register consumption, and the LineBuf module avoids the delay caused by the software processing data filling, so that high-speed calculation can be performed under low resources. At the same time, the MAC array is shared with the ordinary neural network accelerator to further reduce the hardware consumption. BRIEF DESCRIPTION OF DRAWINGS

[0034] Figure 1 FIG. 1 is a structural schematic diagram of a filtering device of a convolution-based FIR digital filter in a hardware running environment of an embodiment of the application;

[0035] Figure 2 FIG. 2 is a flowchart of a filtering method of a convolution-based FIR digital filter according to an embodiment of the application;

[0036] Figure 3 FIG. 3 is a principle diagram of a LineBuf module of a filtering method of a convolution-based FIR digital filter according to an embodiment of the application;

[0037] Figure 4 FIG. 4 is a storage principle schematic diagram of a LineBuf of a filtering method of a convolution-based FIR digital filter according to an embodiment of the application;

[0038] Figure 5 FIG. 5 is a convolution implementation FIR filtering method schematic diagram of a filtering method of a convolution-based FIR digital filter according to an embodiment of the application;

[0039] Figure 6 FIG. 6 is a hardware architecture diagram based on a convolution method of a filtering method of a convolution-based FIR digital filter according to an embodiment of the application;

[0040] Figure 7 FIG. 7 is a filter running flowchart of a filtering method of a convolution-based FIR digital filter according to an embodiment of the application;

[0041] Figure 8Fig. 1 is a schematic diagram of a hardware running environment of an FIR digital filter of an embodiment of a filtering method of the FIR digital filter based on convolution of the present application;

[0042] Figure 9 Fig. 2 is a schematic diagram of functional modules of an embodiment of a filtering device of the FIR digital filter based on convolution of the present application.

[0043] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION

[0044] It should be understood that the specific embodiments described herein are merely intended to explain the present application and are not intended to limit the present application.

[0045] As shown in Fig. 1, the filtering device of the FIR digital filter based on convolution in the hardware running environment of the embodiment of the present application can include a processor 1001, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Figure 1 Figure 1 As shown in Fig. 1, the filtering device of the FIR digital filter based on convolution in the hardware running environment of the embodiment of the present application can include a processor 1001, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002.

[0046] The filtering device of the FIR digital filter based on convolution of the embodiment of the present application can be an FPGA, or a mobile terminal device with display function such as a smart phone, a tablet computer, a portable computer, etc.

[0047] As shown in Fig. 1, the filtering device of the FIR digital filter based on convolution in the hardware running environment of the embodiment of the present application can include a processor 1001, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Figure 1

[0048] ​​Optionally, the filtering device based on the FIR digital filter of convolution can also include a camera, RF (Radio Frequency) circuit, sensors, audio circuit, WiFi module, etc. Among them, the sensors such as light sensors, motion sensors and other sensors. Specifically, the light sensor can include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display screen according to the brightness of the ambient light, and the proximity sensor can turn off the display screen and / or backlight when the filtering device based on the FIR digital filter of convolution is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the size of acceleration in each direction (usually three axes), and when stationary, it can detect the size and direction of gravity, which can be used for identifying the posture of the filtering device based on the FIR digital filter of convolution (such as landscape / portrait screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. Of course, the filtering device based on the FIR digital filter of convolution can also be configured with a gyroscope, barometer, hygrometer, thermometer, infrared sensor and other sensors, which will not be repeated here.

[0049] Those skilled in the art can understand that Figure 1 The terminal structure shown in the figure does not constitute a limitation on the terminal, and can include more or fewer components than the figure, or combine certain components, or different component arrangements.

[0050] As Figure 1 As shown, the memory 1005 as a computer storage medium can include an operating system, a network communication module, a user interface module, and a filtering program based on the FIR digital filter of convolution.

[0051] In Figure 1 In the terminal shown in the figure, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user end) and communicate data with the client; and the processor 1001 can be used to call the filtering program based on the FIR digital filter of convolution stored in the memory 1005.

[0052] In this embodiment, the filtering device based on the FIR digital filter of convolution includes a memory 1005, a processor 1001, and a filtering program based on the FIR digital filter of convolution stored in the memory 1005 and executable on the processor 1001, wherein the processor 1001 calls the filtering program based on the FIR digital filter of convolution stored in the memory 1005, and executes the steps of the filtering method based on the FIR digital filter of convolution in each of the following embodiments.

[0053] The application further provides a filtering method of the convolution-based FIR digital filter. Figure 2 , Figure 2 FIG. 1 is a flowchart of a first embodiment of the method of the application.

[0054] In this embodiment, the filtering method of the convolution-based FIR digital filter comprises the following steps:

[0055] In step S101, a one-dimensional convolution kernel corresponding to an N-order FIR digital filter and activation data are obtained, wherein the convolution kernel is a one-dimensional convolution kernel obtained by unfolding filter parameters of an N-order FIR digital filter into a one-dimensional convolution kernel with a convolution kernel height of 1, a convolution kernel width of N, and input and output channels both being 1, and the original data is activation data obtained by unfolding an original data with an input length of M into an input with a height of 1, a width of M, and an input channel number of 1.

[0056] In this embodiment, for any N-order FIR digital filter, its filter parameters can be unfolded into a one-dimensional convolution kernel with a convolution kernel height (Ky) of 1, a convolution kernel width (Kx) of N+1, and input and output channels (CHin and CHout) both being 1. An original data with an input length of M is unfolded into activation data with an input height (Hin) of 1, an input width (Win) of M, and an input channel (CHin) number of 1.

[0057] In step S102, the activation data is subjected to a padding operation by LineBuf to overcome boundary effects, so as to obtain padded sub-data.

[0058] LineBuf is a key component for temporarily storing row data in a computer system, FPGA image processing, and an operating system.

[0059] As an example, since boundary effects exist in filtering of any signal, i.e., the filtering effect of the head and tail signals is poor, boundary processing is needed for the signal, i.e., the first data of the signal is copied N / 2 times at the head of the signal, and the last data of the signal is copied N / 2 times at the tail of the signal, which is equivalent to a horizontal padding (Px) of N / 2, wherein when mod1, left padding Pleft is Px and right padding Pright is 0; when mod2, left and right padding are both 0; and when mod3, Pleft is 0 and Pright is Px. Vertical padding (Py) is 0. Convolution operation is performed on the padded sub-data with a step (Sx, Sy) of 1.

[0060] It needs to be explained that the on-chip cache and control of activation operation are implemented using a LineBuf. Activation data exists left padding and right padding operation, but since the on-chip cache usually cannot store the entire activation data at a time, in order to avoid the time overhead of software execution pre-padding in real-time environment, hardware padding operation is performed in 3 storage states. As shown in the LineBuf module schematic diagram of Figure 3 LineBuf has three modes mod1, mod2 and mod3 corresponding to LineBuf controller selection 3'b100, 3'b010 and 3'b001 mode respectively. Mod1 mode is used in the first loading, LineBuf reserves the leftmost N / 2 padding space to copy the first data of activation; mod3 mode is used in the last loading, LineBuf reserves the rightmost N / 2 padding space to copy the last data of activation. Mod1 and mod3 are only used once during data loading, and mod2 mode is executed during the remaining time, that is, no padding mode. LineBuf module is a multi-mode fixed size module, so there is no additional resource consumption due to multiple loading modes. The output is controlled by the activation controller and can be normally output.

[0061] Further, in order to simplify the read logic, LineBuf needs to process the amount of valid data stored each time. According to the principle of one-dimensional convolution, the output length is CHout*Hout*Wout, where CHout and Hout are always 1 in the mentioned filter, that is, Wout determines the output length. Since padding is required in mod1, the actual input length is less than mod2. According to Wout = ((Win + (Pleft + Pright) - Kx) / Sx + 1), it can be concluded that the total length of the activation used for convolution is (Win + (Pleft + Pright). In order to achieve consistent output length, the total length of the activation used for convolution must also be consistent.

[0062] Therefore, there are invalid input parts of the same length in mod1 and mod2, and the size of this part is We = 2*T*Tr, where T is the input parallel degree, and Tr is the remainder obtained by dividing the total length of LineBuf by N / 2 and then dividing by the input parallel degree T. In order to ensure the consistency of the read and write logic of LineBuf, the invalid input of mod1 is directly hung at the end, and the invalid input of mod2 is hung at the beginning and the end, each with We / 2. Since the total length of the activation data is indefinite, and the last cache has right padding, the input length of mod3 does not have to be consistent with mod1 and mod2, that is, only We / 2 invalid inputs need to be hung at the beginning. These invalid inputs are only invalid for the current batch of convolution, and the actual data will be left shifted before the next activation loading to fill the next LineBuf data, without losing calculation.

[0063] More specifically, if We is 2 and T is 2, then the last invalid number of modl is 2, and the first and last invalid numbers of mod2 are each one, wherein the last T output of modl, i.e., 2 inputs, is left-shifted to the leftmost end of LineBuf before the next loading, and since the first input in the last T has been calculated in the last calculation, the first data after the left shift is invalid for the next LineBuf. As shown in the schematic diagram of LineBuf storage principle. Figure 4 Other cases are similar, and most cases in modl are not filled, i.e., We of modl is actually 1, but in order to fill We to 2, the last position is left empty instead of invalid input data.

[0064] In an embodiment, the sub-data includes first sub-data, and the step of filling the active data through the LineBuf to overcome the boundary effect to obtain the filled sub-data includes: if the LineBuf is loaded with the active data for the first time, the LineBuf reserves a leftmost N / 2 filling space as a first filling space; left-filling the first active data to copy the first data in the first active data and store it in the first filling space, wherein the first active data refers to the active data loaded in the LineBuf for the first time; adding invalid input data based on the left-filled first active data to obtain the first sub-data. Specifically, invalid input data is added to the tail of the left-filled first active data, and the first active data after the addition of invalid input data in the LineBuf is taken as the first sub-data. Here, "the LineBuf reserves a leftmost N / 2 filling space" means that N / 2 positions are reserved as filling space at the beginning (left) of the LineBuf. Here, "leftmost" refers to the starting position of the buffer.

[0065] In an embodiment, the sub-data includes second sub-data, and the step of filling the active data through the LineBuf to overcome the boundary effect to obtain the filled sub-data includes: if the LineBuf is loaded with the active data for the last time, the LineBuf reserves a rightmost N / 2 filling space as a second filling space; right-filling the second active data to copy the last data of the second active data and store it in the second filling space, wherein the second active data refers to the active data loaded in the LineBuf for the last time; adding invalid input data based on the right-filled second active data to obtain the second sub-data. Specifically, invalid input data is added to the head of the right-filled second active data, and the second active data after the addition of invalid input data in the LineBuf is taken as the second sub-data.

[0066] In an embodiment, the sub-data includes third sub-data, and the step of filling the activation data by the LineBuf to overcome the boundary effect to obtain the filled sub-data further includes: for the activation data entering the LineBuf, if it is not the first loading or the last loading, adding invalid input data at the head and tail of the third activation data loaded in the current LineBuf, wherein the third activation data refers to the activation data loaded by the LineBuf except for the first loading or the last loading; and the third activation data after adding the invalid input data is used as the third sub-data, wherein the third sub-data after adding the invalid input data has the same data length as the first sub-data.

[0067] In step S103, the MAC array is used to perform convolution operation based on the convolution kernel and the sub-data to obtain a filtering result.

[0068] The MAC array can efficiently perform a large number of multiplication and accumulation operations in parallel to accelerate the convolution operation process.

[0069] In the embodiment, the output width (Wout) is M according to the formula Wout = ((Win + (Pleft + Pright) - Kx) / Sx + 1), and the output height (Hout) is 1 according to the formula Hout = ((Hin + 2*Py - Ky) / Sy + 1). Therefore, the final calculation result has a length of 1*1*M, which is consistent with the result of direct FIR filtering, as shown in the convolution implementation FIR filtering method diagram. Figure 5

[0070] In an embodiment, as shown in Figure 6 The filter is controlled by a state control unit. After receiving a processor instruction, the state control unit controls the input distributor to select the current signal to enter the weight buffer or the LineBuf. After the data is ready, the state control unit controls the weight controller and the activation controller to select a part of data in the weight buffer and the LineBuf to enter the MAC array for calculation, and continues to control the weight controller and the activation controller to select data to be sent for calculation according to the feedback of the MAC array until all the calculation is completed.

[0071] Specifically, as shown in Figure 7 ​As shown in the figure. The processor sends a filter start instruction, and the filter module starts to obtain filter parameters and original activation data from the off-chip memory, and judges whether the currently loaded filter parameters (i.e. weight data) are secondary loaded data due to insufficient on-chip storage. If yes, skip the LineBuf judgment step and continue the MAC calculation step, if not, the LineBuf judges the current loaded activation as the data of the first stage, if it is the first stage, it performs padding operation, if it is the third stage, it performs right padding operation, and the second stage is normal data loading without padding. After the data is ready, the data is taken from the weight cache and LineBuf and sent to the MAC array for calculation. After one round of calculation, it is judged whether the weight data needs to be loaded twice, if yes, the weight is reloaded on-chip, if not, it is judged whether the activation data needs to be loaded twice, if yes, the activation is reloaded to LineBuf, if not, the calculation is completed and output. As an example, as shown in the figure, the hardware system structure of the application can include a processor, a FIR filter, and an off-chip memory. Figure 8

[0072] Compared with the prior art, the application has the following advantages:

[0073] (1) Less overall resource occupation, suitable for embedded system

[0074] Compared with the current filter hardware that also performs parallel calculation, a large number of registers are used to store intermediate cache data, resulting in a sharp increase in resource consumption; and the design is based on the convolution method and designs a LineBuf module with stage loading, which benefits from this advantage and reduces a large amount of resource consumption under the same parallel degree.

[0075] (2) Realize high-speed FIR digital filtering under low resource occupation

[0076] Benefiting from the advantages of the convolution method, the calculation parallelism is improved without a large increase in register consumption, and the LineBuf module eliminates the delay caused by software processing data padding, so that high-speed calculation can be performed under lower resources.

[0077] (3) FIR digital filter hardware architecture based on convolution method

[0078] The hardware design based on convolution can be integrated with a common neural network accelerator to share a MAC array, so as to further reduce hardware overhead, and only the LineBuf and its control module need to be added to perform filtering operation. This may provide a new design idea for some integrated models.

[0079] ​The application uses vivado to perform RTL design and simulation, and uses the 7035 FPGA development board of Xilinx to perform board-level verification.

[0080] It is also necessary to point out that (1) the application reconstructs the traditional FIR algorithm, by stretching the filter parameters into a 1-dimensional convolution kernel, and the original data to be calculated into a 1-dimensional activation, wherein the left and right sides of the activation are filled with the corresponding boundary data to cope with the boundary effect of signal filtering, and a 1-dimensional convolution operation with a step of 1 is performed to realize the FIR filtering function; (2) in hardware, LineBuf (activation buffer) is used to store 1-dimensional activation data, and boundary padding is performed by the LineBuf module without preprocessing the activation data before sending it into the filter. LineBuf is divided into mod1 (left padding), mod2 (no padding) and mod3 (right padding) modes. (3) in hardware, an input distributor is used to identify the input data and distribute it to the weight buffer or LineBuf. Then, the weight controller and the activation controller are used to schedule the two buffers into the MAC (multiply-accumulate unit) array to perform convolution operation.

[0081] The application also provides a filtering device of a convolution-based FIR digital filter, referring to Figure 9 , the filtering device of the convolution-based FIR digital filter comprises:

[0082] The acquisition module 10 is used to acquire a 1-dimensional convolution kernel corresponding to an N-order FIR digital filter and activation data, wherein the convolution kernel is a 1-dimensional convolution kernel obtained by unfolding the filter parameters of an N-order FIR digital filter into a convolution kernel with a height of 1 and a width of N, and the input channel and the output channel are both 1; and the original data is activation data obtained by unfolding an input with a length of M into an input with a height of 1 and a width of M, and the input channel number is 1;

[0083] The padding operation module 20 is used to perform padding operation on the activation data through LineBuf to overcome the boundary effect and obtain the padded sub-data.

[0084] The filtering module 30 is used to perform convolution operation on the convolution kernel and the sub-data through the MAC array to obtain the filtering result.

[0085] Further, the sub-data includes first sub-data, and the padding operation module 20 is used to:

[0086] If the LineBuf is the first time to load the activation data, the LineBuf reserves the leftmost N / 2 padding space as the first padding space.

[0087] Left padding is performed on the first activation data to copy the first data in the first activation data and store it in the first padding space, wherein the first activation data refers to the activation data loaded for the first time in the LineBuf;

[0088] Invalid input data is added based on the first activation data after left padding to obtain the first sub-data.

[0089] Further, the sub-data includes second sub-data, and the padding operation module 20 is configured to:

[0090] If the LineBuf is the activation data loaded for the last time, the LineBuf reserves the rightmost N / 2 padding space as the second padding space.

[0091] Right padding is performed on the second activation data to copy the last data of the second activation data and store it in the second padding space, wherein the second activation data refers to the activation data loaded for the last time in the LineBuf.

[0092] Invalid input data is added based on the second activation data after right padding to obtain the second sub-data.

[0093] Further, the padding operation module 20 is configured to:

[0094] Invalid input data is added at the tail of the first activation data after left padding, and the first activation data after adding invalid input data in the LineBuf is taken as the first sub-data.

[0095] Further, the padding operation module 20 is configured to:

[0096] Invalid input data is added at the head of the second activation data after right padding, and the second activation data after adding invalid input data in the LineBuf is taken as the second sub-data.

[0097] Further, the sub-data includes third sub-data, and the padding operation module 20 is configured to:

[0098] For the activation data entering the LineBuf, if it is not loaded for the first time or not loaded for the last time, invalid input data is added at the head and tail of the third activation data loaded in the current LineBuf, wherein the third activation data refers to the activation data loaded in the LineBuf except for the first time or the last time.

[0099] The third activation data after adding invalid input data is taken as the third sub-data, wherein the third sub-data after adding invalid input data has the same data length as the first sub-data.

[0100] The method performed by each of the above program units can refer to each embodiment of the filtering method of the convolution-based FIR digital filter of the present application, and will not be described herein.

[0101] In addition, an embodiment of the present application further provides a filtering device of a convolution-based FIR digital filter, which comprises a memory, a processor and a filtering program of a convolution-based FIR digital filter stored in the memory and executable on the processor, and the filtering program of the convolution-based FIR digital filter implements the steps of the filtering method of the convolution-based FIR digital filter when executed by the processor.

[0102] In addition, an embodiment of the present application further provides a computer readable storage medium, which stores a filtering program of a convolution-based FIR digital filter, and the filtering program of the convolution-based FIR digital filter implements the steps of the filtering method of the convolution-based FIR digital filter when executed by a processor.

[0103] It should be noted that, in this document, the terms "comprising", "containing", or any other variant thereof are intended to cover non-exclusive inclusion, so that processes, methods, articles or systems including a series of elements not only include those elements, but also include other elements not explicitly listed, or further include elements inherent to such processes, methods, articles or systems. Without more limitations, the element defined by the statement "comprising a" does not exclude the presence of other identical elements in the process, method, article or system including the element.

[0104] The above-mentioned serial numbers of embodiments of the present application are only for description, and do not represent the advantages or disadvantages of the embodiments.

[0105] From the above description of the embodiments, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be realized by means of software and necessary general hardware platforms, and of course can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, an optical disk) and includes a plurality of instructions for making a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device) execute the methods described in each embodiment of the present application.

[0106] The above merely describes the preferred embodiments of the present application, and is not intended to limit the patent scope of the present application, and any equivalent structure or equivalent process conversion, or direct or indirect application in other related technical fields, which are made by using the content of the present application specification and drawings, are also included in the patent protection scope of the present application.

Claims

1. A filtering method for an FIR digital filter based on convolution, characterized in that, The filtering method of the convolution-based FIR digital filter includes the following steps: Obtain the one-dimensional convolution kernel and activation data corresponding to the Nth-order FIR digital filter. The convolution kernel is a one-dimensional convolution kernel with a height of 1, a width of N, and 1 input channel and 1 output channel, which is the filter parameters of an Nth-order FIR digital filter expanded into a one-dimensional convolution kernel. The original data is activation data with an input length of M expanded into an input height of 1, an input width of M, and 1 input channel. LineBuf is used to fill the active data to overcome the boundary effect and obtain the filled sub-data. The filtering result is obtained by performing convolution operations based on the convolution kernel and sub-data using a MAC array.

2. The filtering method for a convolution-based FIR digital filter as described in claim 1, characterized in that, The sub-data includes the first sub-data. The step of filling the activated data using LineBuf to overcome the boundary effect and obtain the filled sub-data includes: If LineBuf is loading active data for the first time, then LineBuf reserves the leftmost N / 2 fill space as the first fill space; Left-fill the first active data to copy the first data in the first active data and store it in the first fill space, where the first active data refers to the active data loaded for the first time in LineBuf; The first sub-data is obtained by adding invalid input data based on the first active data after left padding.

3. The filtering method for a convolution-based FIR digital filter as described in claim 1, characterized in that, The sub-data includes a second sub-data. The step of filling the active data using LineBuf to overcome the boundary effect and obtain the filled sub-data includes: If LineBuf is the last time the data is loaded and activated, then LineBuf reserves the rightmost N / 2 fill space as the second fill space; Right-fill the second activation data to copy the last data of the second activation data and store it in the second fill space, where the second activation data refers to the activation data that was last loaded in LineBuf; The second sub-data is obtained by adding invalid input data based on the second active data after right padding.

4. The filtering method for a convolution-based FIR digital filter as described in claim 3, characterized in that, The step of adding invalid input data based on the first active data after left padding to obtain the first sub-data further includes: Invalid input data is added to the end of the first active data after left padding, and the first active data after adding invalid input data to the LineBuf is taken as the first sub-data.

5. The filtering method for a convolution-based FIR digital filter as described in claim 1, characterized in that, The step of adding invalid input data based on the right-filled second active data to obtain the second sub-data further includes: Invalid input data is added to the beginning of the second active data after right padding, and the second active data after adding invalid input data to the LineBuf is used as the second sub-data.

6. The filtering method for a convolution-based FIR digital filter as described in claim 1, characterized in that, The sub-data includes a third sub-data. The step of filling the active data using LineBuf to overcome the boundary effect and obtain the filled sub-data further includes: For activation data entering a LineBuf, if it is not the first or last time it is loaded, invalid input data is added to the beginning and end of the third activation data loaded in the current LineBuf. The third activation data refers to the activation data loaded in the LineBuf other than the first or last time it is loaded. The third active data after adding invalid input data is used as the third sub-data, wherein the third sub-data after adding invalid input data has the same data length as the first sub-data.

7. A filtering device for an FIR digital filter based on convolution, characterized in that, The filtering device of the convolution-based FIR digital filter includes: The acquisition module is used to acquire the one-dimensional convolution kernel and activation data corresponding to the N-order FIR digital filter. The convolution kernel is a one-dimensional convolution kernel with a height of 1, a width of N, and 1 input channel and 1 output channel, which is the filter parameters of an N-order FIR digital filter expanded into a one-dimensional convolution kernel. The original data is activation data with an input length of M expanded into an input height of 1, an input width of M, and 1 input channel. The fill operation module is used to fill the active data through LineBuf to overcome the boundary effect and obtain the filled sub-data; The filtering module is used to perform convolution operations on the MAC array based on the convolution kernel and sub-data to obtain the filtering result.

8. A filtering device based on a convolution-based FIR digital filter, characterized in that, The filtering device of the convolution-based FIR digital filter includes: a memory, a processor, and a filtering program of the convolution-based FIR digital filter stored in the memory and executable on the processor. When the filtering program of the convolution-based FIR digital filter is executed by the processor, it implements the steps of the filtering method of the convolution-based FIR digital filter as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a filtering program for a convolution-based FIR digital filter, which, when executed by a processor, implements the steps of the filtering method for a convolution-based FIR digital filter as described in any one of claims 1 to 6.