CN115577660A - Multi-rate filter automatic design method based on python and matlab - Google Patents
Multi-rate filter automatic design method based on python and matlab Download PDFInfo
- Publication number
- CN115577660A CN115577660A CN202211343254.4A CN202211343254A CN115577660A CN 115577660 A CN115577660 A CN 115577660A CN 202211343254 A CN202211343254 A CN 202211343254A CN 115577660 A CN115577660 A CN 115577660A
- Authority
- CN
- China
- Prior art keywords
- filter
- function
- script
- python
- matlab
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F30/00—Computer-aided design [CAD]
- G06F30/30—Circuit design
- G06F30/32—Circuit design at the digital level
Landscapes
- Engineering & Computer Science (AREA)
- Computer Hardware Design (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Evolutionary Computation (AREA)
- Geometry (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Complex Calculations (AREA)
Abstract
The invention discloses a multi-rate filter automatic design method based on python and matlab, and belongs to the field of digital signal processing. Running a python script, popping up a design graphical interface of the half-band filter, inputting parameters, reading the parameters by the python script, and outputting configuration information of the half-band filter; designing a multi-stage half-band extraction or interpolation filter according to the parameter information, and outputting a tap coefficient of each stage of half-band filter; calling a matlab function and executing a button to output a corresponding half-band filter amplitude-frequency response curve according to the parameter information; reading coefficients and configuration information of the half-band filter, and generating an RTL code of the half-band filter; switching to a CIC filter design interface, inputting parameters, and acquiring and storing parameters by a python script; and generating an amplitude-frequency response curve of the CIC filter and generating an RTL code of the CIC filter according to the input parameters. The method uses python and matlab combined programming, reduces cross-platform operation of developers, is convenient for operation and learning, automatically generates RTL codes, reduces the workload of design and reduces the error rate.
Description
Technical Field
The invention relates to the technical field of digital signal processing, in particular to a multi-rate filter automatic design method based on python and matlab.
Background
In digital signal processing, a signal processing system often needs different sampling frequencies to adapt to the cascade connection between different systems, which is beneficial to the processing, encoding, transmission and storage of signals and saves the calculation workload. The purpose of multirate signal processing is to change the frequency of the original signal, which involves reducing the sampling frequency by decimation and increasing the operating frequency by interpolation.
Commonly used multirate filters are multirate FIR filters, CIC (Cascaded Integrator Comb) filters and HB (Halfband) filters. Since the filter usually needs to operate at a high operating frequency, the requirement of a large number of multipliers causes a problem of high resource consumption and high power consumption. Compared with a multi-rate FIR filter, the HB filter has nearly half of tap coefficients of 0, so that the use of multipliers can be reduced, the consumption of hardware resources is greatly reduced, and the HB filter is very suitable for realizing double extraction or interpolation; the CIC filter has a simple structure, does not have a multiplier, only has an adder, an integrator and a register, is very effective in saving hardware resources, and is suitable for working under the condition of high sampling rate. Therefore, HB filters and CIC filters have wide application in multirate signal processing.
At present, hardware design HB and CIC filters mostly adopt an artificial coding method, the structure type and the coefficient of the filter need to be determined on a matlab platform according to parameter indexes, then RTL codes are compiled, the design process is complex and long in period, a large amount of repetitive work is carried out, errors are easy to occur, and the progress of engineering is influenced.
Disclosure of Invention
The invention aims to provide a multi-rate filter automatic design method based on python and matlab, and aims to solve the problems that the multi-rate filter is complicated in design process, long in design period and prone to errors.
In order to solve the technical problem, the invention provides a multirate filter automatic design method based on python and matlab, which comprises the following steps:
step 6, generating an amplitude-frequency response curve of the CIC filter according to the input parameters;
and 7, generating an RTL code of the CIC filter according to the input parameters.
In one embodiment, the step 1 comprises:
step 1.1, realizing joint programming of python and matlab through an API (application programming interface), importing the python and matlab into a matlab tool library, and realizing calling of python on a matlab function;
the python script mainly comprises top, hbfir, py; the operating python script is top, hbfir. Py and cic. Py are two subclasses under top, and a default graphical interface popped up after the top script operates and is a design interface of a half-band filter;
step 1.2, importing a tkater tool library in an hbf & py script, designing a graphical interface by utilizing components such as Label and Entry, and inputting parameters including an initial sampling rate Fs, a pass band frequency Fpass, a pass band ripple Dpass, a fixed point bit width B and an output sampling rate Fo; the values of the parameters are obtained using the get () function.
In one embodiment, the step 2 comprises:
step 2.1, defining k = int (Fo/Fs), wherein k >1 is an interpolation mode, k =0 is a decimation mode, supports 2-16 times of decimation or interpolation, determines the filter stage number according to the ratio of the output sampling rate Fo to the initial sampling rate Fs, and outputs the parameter value of each stage of filter;
in the interpolation mode, the default nth-stage filter sampling rate is 2n times of the initial sampling rate Fs, n =1,2,3,4, and the rest parameters inherit the initial parameters; in the extraction mode, the default nth-stage filter sampling rate is 1/2n times of the initial sampling rate Fs, n =1,2,3,4, and the rest parameters inherit the initial parameters; the user can change the parameters of each stage of filter according to the actual requirements;
constructing an output area by utilizing tkiner tool library text, label and Entry components, and printing filter parameters of each level to the output area;
and 2.2, acquiring parameters of each stage of filter by a python script, calling a matlab function firhalfband () to generate tap coefficients of each stage of filter, and processing and storing data.
In one embodiment, said step 2.2 comprises:
2.2.1, the generated coefficient is initially a symmetrical coefficient of a complete order, the data type is matlab.double, and a float type coefficient is obtained in a slicing mode and stored in a list;
in the 2.2.2 interpolation mode, removing 0 item from a coefficient de-duplication item in the list; in an extraction mode, only duplicate items of the coefficients in the list are removed, the coefficients are quantized into integers according to the fixed point bit width, and the filter coefficients of each stage are respectively stored in a para _ in/para _ in _ itp or a para _ in _ dcm/coe _ hbfirx.txt and are printed in a text box of an output area;
2.2.3, obtaining the working mode, obtaining the filter structures of each stage, obtaining the values of max _ itp/max _ dcm, data _ width, hbfirx _ coe _ width and hbfirx _ length, and storing the values in para _ in/para _ in _ itp or para _ in _ dcm/para _ input.txt files.
In one embodiment, the step 3 comprises:
step 3.1, firstly designing a matlab script function, including matlab script mag.m, defining a function mag (Fs, fpass, dpass) for generating a single-stage filter amplitude-frequency response curve; a script mag _ qua.m, which defines a function mag _ qua (Fs, b, b _ qua) used for generating a fixed-point amplitude-frequency response curve; script cascade.m, defining function cascade () (x =2,3,4) for generating two-stage, three-stage and four-stage cascaded half-band filter amplitude-frequency response curves respectively;
3.2, acquiring parameters required by the matlab function from the python script, respectively defining python function logic 1 (), and calling the matlab function mag (); defining a function logic 2 (), and calling a matlab function mag _ qua (); defining functions cascade2 (), cascade3 (), and cascade4 (), and calling the matlab functions cascade2 (), cascade3 (), and cascade4 (), respectively;
3.3, the button "unsetting single-stage amplitude-frequency response map" calls the function logic 1 () through command = logic 1, the button "unsetting amplitude-frequency response comparison map" calls the function logic 2 () through command = logic 2, the button "hbfir1, 2-cascade amplitude-frequency response map" calls the function cascade2 () through command = cascade2, the button "hbfir1,2,3-cascade amplitude-frequency response map" calls the function cascade3 () through command = cascade3, and the button "hbfir1,2,3-cascade amplitude-frequency response map" calls the function cascade4 () through command = cascade 4;
and 3.4, executing a button, and generating a corresponding half-band filter amplitude-frequency response curve in an output amplitude-frequency response curve area.
In one embodiment, the step 4 comprises:
step 4.1, designing a filter code automatic generation script, wherein the two modes comprise an extraction mode and an interpolation mode, and an environment configuration script, a parameter calculation script, a multistage filter cascade script, a clock generation script and a top-level design script are arranged;
step 4.2, importing a function for automatically generating a filter code into a python script, defining a function itp2 () to call the function in the script, and calling a function itp () by a button 'generate HB _ RTL code' through command = itp;
step 4.3, execute button, namely generate RTL code of half band filter under corresponding path.
In one embodiment, the step 5 comprises:
step 5.1, defining python function change () for switching to a CIC filter design interface on a half-band filter interface and clearing information of the half-band filter interface, calling a change () function through command = change by a button 'switching CIC filter', and executing a button to jump to the CIC filter design interface;
and 5.2, importing a tkater tool library into the cic. Py script, designing a graphical interface by utilizing Label and Entry components, inputting parameters including interpolation or decimation multiples, delay factors, sampling frequency, stop band attenuation, input and output bit width and mode selection, and acquiring values of the parameters by utilizing a get () function.
In one embodiment, said step 5.2 comprises:
step 5.2.1, the mode selection is determined by building a list text box listbox by a tkinet tool library, and when a specification (extraction) or interpolation mode is selected, a corresponding index value is returned for python function identification;
and 5.2.2, determining the stage number of the CIC filter by the stop band attenuation, dividing the input stop band attenuation value by the stop band attenuation value of the single-stage CIC filter, and rounding up to obtain the final stage number of the CIC filter.
In one embodiment, the step 6 comprises:
step 6.1, creating matlab script CIC _ pic.m according to amplitude-frequency response function of CIC filterDefining a function CIC _ pic (D, N, M), where D is a delay factor, typically 1,N is a decimation or interpolation multiple, M is a concatenation number, and W is a digital frequency, which is an argument of the function, for generating an amplitude-frequency response curve of the CIC filter;
step 6.2, defining a function gen _ pic () in the python script and calling the matlab function cic _ pic () defined previously, the button "generate amplitude-frequency response curve" calls the function gen _ cic (), through command = gen _ pic;
and 6.3, constructing an amplitude-frequency response curve output area by using the text of the tkater tool library, executing a button to generate an amplitude-frequency response curve, acquiring parameter information, and generating the amplitude-frequency response curve of the CIC filter in the text.
In one embodiment, the step 7 comprises:
and 7.1, designing a CIC filter code automatic generation script, wherein the CIC filter code automatic generation script comprises an extraction mode or an interpolation mode and comprises an environment configuration script, a clock generation module script, an integrator generation module script, a comb filter generation module script and a top-layer design script.
Step 7.2, importing a function for automatically generating CIC filter codes into the python script, defining a function run _ RTL () to call the function in the script, and calling the function run _ RTL (), wherein the button 'automatically generating RTL' calls the function run _ RTL (), through command = run _ RTL;
and 7.3, executing the button and generating the RTL code of the CIC filter under the corresponding path.
In the multi-rate filter automatic design method based on python and matlab provided by the invention, a top-level python design script top.py is operated, a half-band filter design interface is popped up by default by defining two subclasses hbf ir.py and cic.py, and the mutual switching with a CIC design interface can be realized through a button. By calling the matlab native function and the self-designed matlab function, the coefficients of the half-band filter are more conveniently output and stored for data processing, RTL codes of the filter are automatically generated for functions, various amplitude-frequency response curves of the filter are output, and the structure of the filter is more visually displayed. The invention uses the python and matlab combined programming, can reduce the cross-platform operation of developers, has more visual and concise design of a graphical interface, is convenient for operation and learning, greatly reduces the workload of design by automatically generating the RTL code, and reduces the error rate. In conclusion, the invention is more convenient for developers to use, greatly improves the working efficiency and shortens the engineering research and development period.
Drawings
Fig. 1 shows an automated design flow of a half-band filter and a CIC filter.
Fig. 2 half band filter design graphical interface.
FIG. 3 para _in _itp/coe _ hbfir. Txt coefficient file content.
FIG. 4 para _in _itp/para _ input. Txt file contents.
Fig. 5 CIC filter designs a graphical interface.
Fig. 6 half-band filter simulation waveforms.
Fig. 7 CIC filter simulation waveforms.
Detailed Description
The following describes a multirate filter automatic design method based on python and matlab according to the present invention in further detail with reference to the accompanying drawings and specific embodiments. The advantages and features of the present invention will become more apparent from the following description. It is to be noted that the drawings are in a very simplified form and are not to precise scale, which is provided for the purpose of facilitating and clearly illustrating embodiments of the present invention.
The invention provides a multi-rate filter automatic design method based on python and matlab, which comprises the following steps:
According to a comparison table of matlab products and python versions provided by the matlab official, python3.4 and matlab _ r2015b are selected, and a matlab engine API for python is installed. And importing the matlab tool library through import matlab to realize the call of the python to the matlab function. python scripts mainly include top. Py is the running python script; py and cic are two subclasses under top, a default graphical interface is popped up after the top script runs and is a half-band filter design interface, and the design flow is shown in fig. 1.
In the design interface of the half-band filter shown in fig. 2, according to the requirement of the input area, the content shown in fig. 2 is input, and the initial sampling rate/(MHz): 100, passband frequency/(MHz): 20, passband ripple: 0.001, fixed point bit width/(bit): output sample rate/(MHz): 800.
and 2, automatically designing a multi-stage half-band extraction or interpolation filter according to the parameter information, outputting a tap coefficient of each stage of half-band filter, processing the coefficient, and storing the required data information for convenient subsequent use. The execution button 'calculates filter parameters at each stage', the background return index '0' represents an interpolation mode, and the interpolation mode is output in a text box of an output area:
"maximum interpolation multiple is: 8
The required filter order is: 3"
And outputs the parameter values for filter 1,2,3, the contents of which are shown in the output area of fig. 2.
The python script takes each level of filter parameters, calls the matlab function firhalfband () to generate tap coefficients for the filter 1,2,3, and performs data processing saving, and performs button generation coefficients and saving by passing the defined function firx _ coe to the button "filter x coefficients" (x =1,2,3).
The generated coefficients are initially symmetrical coefficients of a complete order, and the data type is matlab. In the interpolation mode, the coefficients in the list need to be deduplicated to remove 0 items, each level of filter coefficients are respectively stored under para _ in/para _ in _ itp (interpolation)/coe _ hbfirx.txt (x =0,1,2), and the file content is as shown in fig. 3 and printed in the text box of the output area of fig. 2.
According to the interpolation operation mode, the values of max _ itp (interpolation), data _ width, hbfirx _ coe _ width, hbfirx _ length (x =0,1,2) are obtained and saved under the para _ in/para _ in _ itp (interpolation)/para _ input.txt file, the content of which is shown in fig. 4.
And 3, calling a self-designed matlab function and executing a button to output a corresponding amplitude-frequency response curve of the half-band filter according to the parameter information, and displaying the structural type of the half-band filter more intuitively.
Calling a self-defined matlab function mag (Fs, fpass, dpass) to generate a single-stage filter amplitude-frequency response curve; calling a self-defined matlab function mag _ qua (Fs, b, b _ qua) for generating a fixed-point amplitude-frequency response curve; calling a self-defined matlab function cascadex () (x =2,3) to respectively generate amplitude-frequency response curves of two-stage and three-stage cascaded half-band filters.
The execution button 'un-fixed point single-stage amplitude-frequency response graph' generates a corresponding half-band filter amplitude-frequency response curve in the amplitude-frequency response curve area shown in figure 2.
And 4, reading the coefficient and the configuration information of the half-band filter, executing a button, and automatically generating the RTL code of the half-band filter.
And calling a filter code to automatically generate a script, wherein the script mainly comprises an environment configuration script, a parameter calculation script, a multistage filter cascade script, a clock generation script and a top-level design script. The function for automatically generating the filter code is imported into the python script, the function itp2 () is defined to call the function in the script, and the execution button "generate HB _ RTL code" calls the function itp () through command = itp. The RTL code of the half-band filter is generated under RTL/itp/RTL/path, which includes verilog files such as clk _ div.v, clk _ mux.v, clk _ gate.v, hbfirx _ adder.v, hbfirx _ delay.v, hbfirx _ mult.v, hbfirx _ sum.v, hbfirx _ single _ chan.v, hbfirx _ top _ itp.v (x =0,1,2), cascade _ firs _ itp.v, cascade _ hbfirs _ top.v, and the like. Simulation verification is carried out on the generated half-band filter RTL code, and simulation waveforms are shown in FIG. 6.
And 5, switching an execution button 'switching CIC filter' to a CIC filter design interface, inputting required parameters, and acquiring and storing the parameters by the python script.
Inputting the parameter content shown in fig. 5 into a design interface of the CIC filter, and extracting/interpolating multiple: 2, delay factor: 1, sampling frequency/(MHz): 500, stop band attenuation/(dB): 65, input bit width: 22, output bit width: 22. the values of the parameters are obtained using the get () function. Mode selection is determined by tkinet composing a singleton box listbox, and the index value "0" returned by selection of the resolution mode is used for python function identification. The stop-band attenuation determines the number of stages of the CIC filter, and the stop-band attenuation of a single-stage CIC filter is about 14dB, so the input stop-band attenuation is divided by the stop-band attenuation of the single-stage CIC filter and rounded up to obtain the number of stages of the final CIC filter, as shown in fig. 5, the input stop-band attenuation is 65dB, the required number of stages N =65/14 of the CIC filter is rounded up to N =5. The required information is stored in the list index, resulting in a list index = [ "0",500, 65,2,1, 22, 22] for use by the python script.
And 6, generating an amplitude-frequency response curve of the CIC filter according to the input parameters.
According to magnitude-frequency response function of CIC filterCustom matlab function cic _ pic (D, N, M), where D is a delay factor, typically 1; n is an extraction or interpolation multiple, M is a cascade number and is used for generating an amplitude-frequency response curve of the CIC filter; w is the digital frequency and is the argument of the function. In this embodiment, the delay factor D is 1, the decimation factor N is 2, and the number of cascades M is 5. The python script defines a function gen _ pic (), calls the defined matlab function cic _ pic (), and the button "generate amplitude-frequency response curve" calls the function gen _ cic () through command = gen _ pic. And (3) constructing an amplitude-frequency response curve output area by using the tkater component text, executing a button to generate an amplitude-frequency response curve, acquiring parameter information, and generating a CIC filter amplitude-frequency response curve with the decimation multiple of 2 and the cascade number of 5 in a text box of the amplitude-frequency response curve area text shown in FIG. 5.
And 7, generating an RTL code of the CIC filter according to the input parameters.
And calling CIC filter codes to automatically generate scripts, wherein the CIC filter codes mainly comprise an environment configuration script, a clock generation module script, an integrator generation module script, a comb filter generation module script and a top-layer design script. The function for automatically generating CIC filter codes is introduced into a python script, a function run _ RTL () is defined to call the function in the script, and the button 'automatically generate RTL' calls the function run _ RTL () through command = run _ RTL.
And executing a button to obtain list index information, and generating RTL codes of the CIC extraction filter under path RTL/CIC/dec _ CIC/wherein the RTL codes comprise verilog files such as clk _ gen.v, comb.v, resolution.v, integrator.v, top _ CIC _ dec.v and truncation.v. Simulation verification is performed on the generated CIC filter RTL code, and the obtained waveform result is shown in FIG. 7.
The above description is only for the purpose of describing the preferred embodiments of the present invention, and is not intended to limit the scope of the present invention, and any variations and modifications made by those skilled in the art based on the above disclosure are within the scope of the appended claims.
Claims (10)
1. A multi-rate filter automatic design method based on python and matlab is characterized by comprising the following steps:
step 1, running a python script, popping up a design graphical interface of the half-band filter, inputting parameters in an input area, reading the parameters by the python script, and outputting configuration information of the half-band filter;
step 2, automatically designing a multi-stage half-band extraction or interpolation filter according to the parameter information, outputting a tap coefficient of each stage of half-band filter, and performing data processing on the coefficient;
step 3, calling a self-designed matlab function and executing a button to output a corresponding amplitude-frequency response curve of the half-band filter according to the parameter information so as to visually display the structure type of the half-band filter;
step 4, reading coefficients and configuration information of the half-band filter, and generating an RTL code of the half-band filter;
step 5, switching to a CIC filter design interface, inputting required parameters, and acquiring and storing parameters by a python script;
step 6, generating an amplitude-frequency response curve of the CIC filter according to the input parameters;
and 7, generating an RTL code of the CIC filter according to the input parameters.
2. The method of claim 1, wherein step 1 comprises:
step 1.1, realizing joint programming of python and matlab through an API (application programming interface), importing the python and matlab into a matlab tool library, and realizing calling of python on a matlab function;
the python script mainly comprises top, hbfir, py; the operating python script is top, hbfir. Py and cic. Py are two subclasses under top, and a default graphical interface popped up after the top script operates and is a design interface of a half-band filter;
step 1.2, importing a tkater tool library in an hbf & py script, designing a graphical interface by utilizing components such as Label and Entry, and inputting parameters including an initial sampling rate Fs, a pass band frequency Fpass, a pass band ripple Dpass, a fixed point bit width B and an output sampling rate Fo; the values of the parameters are obtained using the get () function.
3. The method of claim 2, wherein the step 2 comprises:
step 2.1, defining k = int (Fo/Fs), wherein k >1 is an interpolation mode, k =0 is a decimation mode, supports 2-16 times of decimation or interpolation, determines the filter stage number according to the ratio of the output sampling rate Fo to the initial sampling rate Fs, and outputs the parameter value of each stage of filter;
in the interpolation mode, the default nth-stage filter sampling rate is 2n times of the initial sampling rate Fs, n =1,2,3,4, and the rest parameters inherit the initial parameters; in the extraction mode, the default nth-stage filter sampling rate is 1/2n times of the initial sampling rate Fs, n =1,2,3,4, and the rest parameters inherit the initial parameters; the user can change the parameters of each stage of filter according to the actual requirements;
constructing an output area by utilizing tkiner tool library text, label and Entry components, and printing filter parameters of each level to the output area;
and 2.2, acquiring parameters of each stage of filter by a python script, calling a matlab function firhalfband () to generate tap coefficients of each stage of filter, and processing and storing data.
4. A multi-rate filter auto-design method based on python and matlab as claimed in claim 3, wherein said step 2.2 comprises:
2.2.1, the generated coefficient is initially a symmetrical coefficient of a complete order, the data type is matlab.double, and a float type coefficient is obtained in a slicing mode and stored in a list;
in the 2.2.2 interpolation mode, removing 0 item from a coefficient de-duplication item in the list; in an extraction mode, only duplicate items of the coefficients in the list are removed, the coefficients are quantized into integers according to the fixed point bit width, and the filter coefficients of each stage are respectively stored in a para _ in/para _ in _ itp or a para _ in _ dcm/coe _ hbfirx.txt and are printed in a text box of an output area;
2.2.3, obtaining the working mode, obtaining the filter structures of each stage, obtaining the values of max _ itp/max _ dcm, data _ width, hbfirx _ coe _ width and hbfirx _ length, and storing the values in para _ in/para _ in _ itp or para _ in _ dcm/para _ input.txt files.
5. The method of claim 4, wherein step 3 comprises:
step 3.1, firstly designing a matlab script function, including matlab script mag.m, defining a function mag (Fs, fpass, dpass) for generating a single-stage filter amplitude-frequency response curve; a script mag _ qua.m, which defines a function mag _ qua (Fs, b, b _ qua) used for generating a fixed-point amplitude-frequency response curve; script cascade.m, defining function cascade () (x =2,3,4) for generating two-stage, three-stage and four-stage cascaded half-band filter amplitude-frequency response curves respectively;
3.2, acquiring parameters required by the matlab function from the python script, respectively defining python function logic 1 (), and calling the matlab function mag (); defining a function logic 2 (), and calling a matlab function mag _ qua (); defining functions cascade2 (), cascade3 (), and cascade4 (), and calling the matlab functions cascade2 (), cascade3 (), and cascade4 (), respectively;
3.3, the button "unsetting single-stage amplitude-frequency response map" calls the function logic 1 () through command = logic 1, the button "unsetting amplitude-frequency response comparison map" calls the function logic 2 () through command = logic 2, the button "hbfir1, 2-cascade amplitude-frequency response map" calls the function cascade2 () through command = cascade2, the button "hbfir1,2,3-cascade amplitude-frequency response map" calls the function cascade3 () through command = cascade3, and the button "hbfir1,2,3-cascade amplitude-frequency response map" calls the function cascade4 () through command = cascade 4;
and 3.4, executing a button, and generating a corresponding half-band filter amplitude-frequency response curve in an output amplitude-frequency response curve area.
6. The multi-rate filter auto-design method based on python and matlab according to claim 5, wherein the step 4 comprises:
step 4.1, designing a filter code automatic generation script, wherein the filter code automatic generation script comprises an extraction mode or an interpolation mode and comprises an environment configuration script, a parameter calculation script, a multi-stage filter cascade script, a clock generation script and a top-level design script;
step 4.2, importing a function for automatically generating a filter code into a python script, defining a function itp2 () to call the function in the script, and calling a function itp () by a button 'generate HB _ RTL code' through command = itp;
step 4.3, execute button, i.e. generate RTL code of half band filter under corresponding path.
7. The method of claim 6, wherein step 5 comprises:
step 5.1, python function change () is defined, the function is used for switching to a CIC filter design interface on a semi-band filter interface and removing information of the semi-band filter interface, a button 'switching CIC filter' calls a change () function through command = change, and the button is executed to jump to the CIC filter design interface;
and 5.2, importing a tkater tool library into the cic. Py script, designing a graphical interface by utilizing Label and Entry components, inputting parameters including interpolation or decimation multiples, delay factors, sampling frequency, stop band attenuation, input and output bit width and mode selection, and acquiring values of the parameters by utilizing a get () function.
8. The method of claim 7, wherein step 5.2 comprises:
step 5.2.1, the mode selection is determined by building a list text box listbox by a tkinet tool library, and when a specification (extraction) or interpolation mode is selected, a corresponding index value is returned for python function identification;
and 5.2.2, determining the order of the CIC filter by the stop-band attenuation, dividing the input stop-band attenuation value by the stop-band attenuation value of the single-stage CIC filter, and rounding up to obtain the final order of the CIC filter.
9. The method of claim 8, wherein step 6 comprises:
step 6.1, creating matlab script CIC _ pic.m according to the amplitude-frequency response function of the CIC filterDefining a function CIC _ pic (D, N, M), where D is a delay factor, typically 1,N is a decimation or interpolation multiple, M is a number of cascades, and W is a digital frequency, which is an argument of the function, for generating an amplitude-frequency response curve of the CIC filter;
step 6.2, define the function gen _ pic () in python script and call the matlab function cic _ pic () defined earlier, the button "generate amplitude-frequency response curve" calls the function gen _ cic () by command = gen _ pic;
and 6.3, constructing an amplitude-frequency response curve output area by using the text of the tkater tool library, executing a button to generate an amplitude-frequency response curve, acquiring parameter information, and generating the amplitude-frequency response curve of the CIC filter in the text.
10. The method of claim 9, wherein step 7 comprises:
and 7.1, designing a CIC filter code automatic generation script, wherein the CIC filter code automatic generation script comprises an extraction mode or an interpolation mode, and the CIC filter code automatic generation script comprises an environment configuration script, a clock generation module script, an integrator generation module script, a comb filter generation module script and a top-layer design script.
Step 7.2, importing a function for automatically generating CIC filter codes into the python script, defining a function run _ RTL () to call the function in the script, and calling the function run _ RTL (), wherein the button 'automatically generating RTL' calls the function run _ RTL (), through command = run _ RTL;
and 7.3, executing the button and generating the RTL code of the CIC filter under the corresponding path.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211343254.4A CN115577660A (en) | 2022-10-31 | 2022-10-31 | Multi-rate filter automatic design method based on python and matlab |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211343254.4A CN115577660A (en) | 2022-10-31 | 2022-10-31 | Multi-rate filter automatic design method based on python and matlab |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115577660A true CN115577660A (en) | 2023-01-06 |
Family
ID=84586926
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211343254.4A Pending CN115577660A (en) | 2022-10-31 | 2022-10-31 | Multi-rate filter automatic design method based on python and matlab |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115577660A (en) |
-
2022
- 2022-10-31 CN CN202211343254.4A patent/CN115577660A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Lu et al. | Optimal design of frequency-response-masking filters using semidefinite programming | |
CN103269212B (en) | Low cost low-power consumption Multilevel FIR filter implementation method able to programme | |
Aktan et al. | An algorithm for the design of low-power hardware-efficient FIR filters | |
CN110492867B (en) | Interpolation filter system realized by digital circuit | |
CN111988018B (en) | Automatic generation method for RTL model of half-band interpolation filter | |
CN115577660A (en) | Multi-rate filter automatic design method based on python and matlab | |
Kumar et al. | Area-, Power-, and Delay-Optimized 2D FIR Filter Architecture for Image Processing Applications | |
CN110957996A (en) | Multiplier-free FRM filter bank optimization design method based on ABC algorithm | |
CN101233686A (en) | Digital filter | |
US6151613A (en) | Digital filter and method for a MASH delta-sigma modulator | |
Cheemalakonda et al. | Area efficient 2D FIR filter architecture for image processing applications | |
Shamaly et al. | A transformation for necessary optimality conditions for systems with polynomial nonlinearities | |
CN102420611B (en) | Sampling rate conversion method and device of digital signal | |
CN116015248A (en) | CIC-HB cascading digital filter and verification method thereof | |
Saini et al. | Area Optimization of FIR Filter and its Implementation on FPGA | |
CN115017849A (en) | RTL automatic generation system and method for cascaded half-band filter | |
CN114362722A (en) | Up-sampling method and device for performing high-power interpolation on discrete signal | |
Kamaraj et al. | Pipelined FIR filter implementation using FPGA | |
RU62469U1 (en) | ADAPTIVE WAVELET CONVERSION CALCULATION DEVICE | |
Nussbaumer | Relative evaluation of various number theoretic transforms for digital filtering applications | |
CN202059380U (en) | Digital decimation filter | |
Baraniecki et al. | Oversampling ΣΔ analog-to-digital converters modeling based on VHDL | |
Dhobi et al. | Fpga implementation of fir filter using various algorithms: a retrospective | |
CN112187215B (en) | Cascaded half-band interpolation filter structure | |
Roh et al. | Fully synthesised decimation filter for delta-sigma A/D converters |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |