Fir filter for programmable decimation

Abstract: A FIR filter for programmable decimation by powers of two has an input coupled to receive an input signal and an output coupled to the input. The FIR filter uses context registers, where the number of contexts per context register is equal to the maximum desired decimation power m . An output context register coupled to provide the output simultaneously contains all of the decimation output results, the desired decimation result being selected as one of the output contexts. A cascade of timing circuits in response to an initial clock signal and an initial valid signal at one-half the frequency of the initial clock signal provide timing signals for storing the decimation results as separate contexts in each context register. At any time any desired decimation result is available for output.

Description: BACKGROUND OF THE INVENTION The present invention relates to finite impulse response (FIR) filters, and more particularly to a FIR filter for programmable decimation by powers of two. A decimate-by-two FIR filter has the following ideal characteristics: A(ω) ≈ 1 0 ≤ ω ≤ π/4 0 ≤ A(ω) ≤ 1 π/4 < ω < π/2 A(ω) ≈ 0 π/2 ≤ ω ≤ π In practice a Parks-McClellan equi-ripple design algorithm, using the Remez exchange algorithm with Chebyshev design theory, has a smooth and monotonic response in the transition region of Equation (2). With this response every other output from the filter may be discarded without aliasing problems, and the transition band becomes the rejected band for any following decimation stage, allowing for cascading. Therefore decimation by 2 m may be performed with m filter stages coupled in series. Such a direct approach to decimating by 2 m where m is large results in a huge amount of hardware. Furthermore later decimation stages have lower structural usage, defined as operations per gate per clock event. What is desired is a FIR filter for programmable decimation by powers of two that reduces the amount of hardware required while maximizing the operations per gate per clock event. SUMMARY OF THE INVENTION Accordingly the present invention provides a FIR filter for programmable decimation by powers of two that uses context registers with the output from the filter being fed back to the input. An input signal is sampled at one-half an input clock rate and progressively decimated, with each decimation result stored in a separate register within each context register. An output context register contains the result for each level of decimation by two, and the desired decimation output is selected for output according to a selected output signal. A cascade of timing circuits provide appropriate timing signals for the FIR filter, one timing circuit for each level of decimation corresponding to the number of separate registers in each context register. In this way any decimation is available for output, and multiple devices may access the FIR filter to get different decimation factors for the same input signal. The objects, advantages and other novel features of the present invention are apparent from the following detailed description when read in conjunction with the appended claims and attached drawing. DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWING Fig. 1 is a table view illustrating timing for a FIR filter for programmable decimation by powers of two according to the present invention. Fig. 2 is a block diagram view of a FIR filter for programmable decimation by powers of two according to the present invention. Fig. 3 is a block diagram view of a representative timing circuit for the FIR filter of Fig. 2. Fig. 4 a block diagram view of a representative context register for use in the FIR filter of Fig. 2. DETAILED DESCRIPTION OF THE INVENTION The following precepts are the basis for the FIR filter design for programmable decimation by powers of two: 1. The data rate in and out of a filter may be less than the system clock by the use of input and output valid signals that control register state changes within the design. Such state changes may be implemented with synchronous input-enable registers, allowing fully synchronous designs. 2. For a decimating filter the output data rate is half the input rate. 3. For any finite integer m this geometric sum is known: Σ i=1->m (1/2 i ) = 1 - (1/2 m ) < 1 4. The present and new state of any register-oriented hardware system depends only upon the state of its registers and inputs, analogous to "contexts" in software. If the FIR filter is designed to receive an initial input rate of f s /2 where f s is the clock rate, then the output rate is f s /4 which is the input rate for the next filter, etc. Now the above equation gives the sum of the input rates, f s /2+ f s /4+ f s /8..., for m such filters as less than f s so the entire bandwidth of all the inputs to all m filters fits within the clock rate f s for any number of decimation stages m . Every register within a filter design is replaced with an m -register file to allow m filter contexts, and control of the input of the filter comes from either the external input stream at f s /2 or less or from the output of the filter in its previous context, in both cases with the data-valid from the appropriate source or context, such that only the first decimation context receives data from the filter system input. Such a filter decimates by any factor up to 2 m merely by marking which output valid context to send out from the filter system. Indeed such a design decimates by any power of two up to 2 m simultaneously by generating separate valid signals marking the required data for each system receiving the filter output stream. This approach is more hardware economical than cascading decimating filters because only the registers are duplicated m times, not the logic between them which includes multipliers and adders. This results in a hardware saving of about a factor of two. The constraint on using arbitrarily large values of m is the amount of register storage required for m contexts. Another advantage is that changing the decimation factors is merely a matter of generating proper valid signals, so the filter coefficients may be fixed, such as by using shift-add structures, allowing for even more economical designs. The trick is controlling the timing of such a system. To understand this conceptually a recursive argument is used by imagining filtering from the perspective of the pth decimation context, 0≤ p < m . Two control signals are defined between each stage rather than a single valid signal such that: CLK_EN[ p ] marks the "clock context" in which the p th stage operates, i.e., other clock edge events don't exist in its little universe VALID[ p ] marks the input data as valid The Table of Fig. 1 illustrates a control sequence where each column is sampled at intervals of 2 p clock periods in time, i.e., at every clock for p =0. "!" denotes logical inversion, and " toggle [p]" is a register for context p whose state changes as: if CLK_EN[p] then toggle[p] <- !toggle[p]. From the Table of Fig. 1 the derived outputs are identical to the inputs if the columns when CLK_EN[p+1] equals zero are ignored, so that the new pattern is identical to the old but with the enabled clock events now separated by 2 p+1 clocks instead of 2 p for the inputs. If for the first stage, p =0, CLK_EN[0] is true on all clocks and VALID[0] is enabled at f s /2 rate, and if the timing control being true for p implies that it is also true for p +1 as long as p < m , then inductively the entire system works. For this "context switch" scheme to work, all state changes for a given context p occur when VALID[p]=1. Otherwise if additional state changes occur, there are time conflicts for different context access to register state. Also the corresponding VALID[p+1] signal output appears at a time which is not coincident with VALID[p], which requires that there is an output register OUT[p] whose input stage changes only if VALID[p]=1 and which presents the output for that context if VALID[p+1]=1. This requirement is met with a register file that has separate register write arid read selection at any given clock period. All other context registers within the FIR filter share a common read and write address selection. The FIR convolution V t = Σ i=0->(n-1) h i x t-i is for an n -tap FIR filter with a sampled input sequence x t as a function of time and n filter coefficients {h i }, 0≤i<n. This sum may be separated into two sums, one over even values of i and the other for the remaining odd values: V t = Σ j=0->((n+1)/2-1) h 2j x t-2j + Σ k=0->(n/2-1) h 2k+1 x t-2k-1 where the first sum over j is for a change of variable i=2j and the second sum over k is for a change of variable i=2k+1. For decimation by two the outputs V t for either t odd or t even are discarded. Changing the variables so that t=2T for integer T produces the output for even time t as: V 2T = Σ j=0->((n+1)/2-t) h 2j x 2(T-j) + Σ k=0->(n/2-1) h 2k+1 x 2(T-k)-1 where the first sum is a convolution of the even time series in {x}, (the same as the output V 2T ) with the even index coefficients of {h}, and the second sum is a convolution of the odd time series in {x} with the odd index coefficients of {h}. Therefore the first filter needs only to change its state at even time, and the second at odd time. Each FIR filter has about half of the coefficients of the original convolution (for odd n the length of the first filter is one more than the length of the second). To implement these filters in pipelined form rather than the direct forms given above, using induction or z-transforms for an n -tap filter, the following relations define a structure with an equivalent transfer function to the basic FIR convolution equation above: V t = R[t,n-2] + h 0 x[t] R[t,j] <- R[t-1,i-1] + h n-1-i x[t-1] R[t,i] = 0 for i<0 where "<-" denotes a register assignment and R[t,i] is the ith register contents at time t . Adding an additional pipeline register to the output produces: OUT t <- V t-1 so that OUT t = R[t,n-1]. If n 1 = floor((n+1)/2) n 2 = floor(n/2) where "floor" is a function that returns the integer portion of the result, then from Equations 8, 9 and 10: OUT 2T = R[2T,n 1 -1] + R[2T-1,n 2 -1] where for t =2T, T being an integer, R[2T,j] <- R[2(T-1),j-1] + h n-1-2j x[2(T-1)] R[2T-1,k] <- R[2(T-1)-1,k-1] + h n-2k x[2(T-1)-1] These equations describe separate pipelined transversal filters, although there are now 2T delays between adjacent taps and the state of each recursion depends only upon odd and even t terms respectively. The delays may be implemented by a single register for each context p , each on alternating VALID[p] inputs, so that if at t=0 toggle [p]=0, then for the p th context the clock enables are: clk_enable_A[p] = VALID[p] & toggle[p] clk_enable_B[p] = VALID[p] & !toggle[p] where the terms on the right are described with reference to the Table of Fig. 1. Now the terms in 2T and 2T-1 in the above equations change on alternate VALID[p]=1 events because of the toggle [p] term, and the right-hand term for OUT 2T is one time period t behind the left term, i.e., it has a time index one less than 2T, so the right-hand term is delayed by another register delay enabled on clk_enable_A[p], as with the left-hand term R[2T,n 1 -1], to get: Z(2T] <- R[2T-1,n 2 -1] so that: OUT 2T = R[2T,n 1 -1] + Z[2T] Finally by substitution into the above equation into the left added term and moving the add before the final enable-coincident registers R[2T,n 1 -1] and Z[2T]: OUT 2T <- (R[2(T-1),n 1 -2] + h 0 x[2(T-1)]) + R[2T-1,n 2 -1] where the parenthesis denotes addition precedence order as defined implicitly in the equations. For higher speed pipelining a short path from h 0 x[2(T-1)] to OUT 2T is achieved by rearranging as follows: OUT 2T <- [R[2(T-1),n 1 -2] + R[2T-1,n 2 -1]) + h 0 x[2(T-1)] Referring now to Fig. 2 a diagram of a four-tap final FIR filter structure based upon the above equations is shown. An input signal INPUT[0] is applied to one input of a 2 to 1 multiplexer 12, the output of which is input to a plurality of multipliers 14. Each multiplier 14 multiplies the selected output from the multiplexer 12 by a respective filter coefficient h0, h1, ... h3. The outputs from the odd multipliers 14 1 and 14 3 are combined by a first adder 16 after the output from multiplier 14 3 has been delayed by a first context register 18. The output from the first adder 16 is delayed by a second context register 20. The first and second context registers 18, 20 are enabled by a CLK_ENABLE_B[p] signal. The output from the second context register 20 provides the R[2T-1,n 2 -1] term of Equation 23. The output from multiplier 14 2 delayed by a third context register 22 provides the R[2(T-1),n 1 -2] term of Equation 23, which is added to the output from the second context register 20 by a second adder 24. Finally the h 0 x[2[T-1)] term of Equation 23 is provided by the output from multiplier 14 0 , which in turn is added to the output from the second adder 24 by a third adder 26. The output from the third adder 26 is input to an output context register 28 that has separate input and output enable ports. A CLK_ENABLE_A[p] signal enables the third context register 22 and the input enable port of the output context register 28. The output from the output context register 28 is the output signal OUT 2T of Equation 23. The selection of the particular decimation output from the output context register 28 is determined by a multiplexer 27 which selects one of the VALID[p+1] lines to read out the desired context from the context register corresponding to a desired decimation factor 2 p . Programmability may also be achieved in other ways, as are readily apparent to those skilled in the art. The other inputs to the FIR filter are those necessary for timing, namely, VALID[p] and CLK_EN[p]. Timing circuits 29 are cascaded, one timing circuit for each of the m contexts. The VALID[0] signal input to the first timing circuit 29 0 provides the select signal to the multiplexer 12 to select the input INPUT[0]. Otherwise the output signal OUT 2T is fed back through the multiplexer 12 for another divide by two iteration. For a given timing circuit 29 p , as shown in Fig. 3, a toggle [p] register 30 is enabled by the VALID[p] signal, and is configured so that for every VALID[p] pulse it switches state. The input to the toggle [p] register 30 and the VALID[p] signal are combined by a first AND gate 32 to produce the CLK_ENABLE_B[p] signal occurring at one-half of the VALID[p] signal rate. The output from the toggle [p] register 30 which is of opposite phase to the input is combined with the VALID[p] signal by a second AND gate 34 to produce the CLK_ENABLE_A[p] signal. The VALID[p] signal is inverted by an inverter circuit 36 and then combined with the CLK_EN[p] signal by a third AND gate 38 to produce a CLK_EN[p+1] signal as an output to the next timing circuit 29 p+1 . The CLK_EN[p+1] signal is combined with the output from the toggle [p] register 30 by a fourth AND gate 40 to produce a VALID[p+1] signal as an output. The VALID[p+1] signal is out of phase with the CLK_ENABLE_A[p] signal, and is applied to the output enable port of the output context register 28 so that the register stores data and transfers out data on a non-interferring basis. The VALID[p+1] signal also is input to the next timing circuit 29 p+1 . Each context register 18, 20, 22, 28 has m internal registers 42, one for each context. Each of the ENABLE[p] bus signals form an address that enables just one of the registers 42 at a time for storing data. The outputs of the registers 42 are input to respective AND gates 44 which, for context registers 18 , 20 , 22 , are enabled also by the ENABLE[p] bus signal. The outputs from the AND gates 44 are input to an OR gate 46 that provides the selected register 42 output for that context register 18 , 20 , 22 . For the output context register 28 the AND gates 44 are enabled by the VALID[p+1] bus, as shown by the dotted line, so that the data is stored and read out on a non-interfering basis. By appropriately selecting the desired context, or p value, for the OUT 2T , the desired decimation-by-two output is provided. Since all of the decimation by powers of two results are available in the output context register 28 at any given time, the same FIR filter output may be accessed by different end users to achieve any desired decimation by powers of two up to 1/2 m . Thus the present invention provides a FIR filter for programmable decimation by powers of two that uses context registers and just one set of multipliers and adders with cascaded timing circuits, the output of which is fed back to the input, to produce simultaneously all decimation by powers of two results up to 1/2 m from which a desired decimation result may be programmably selected.

Claims: An apparatus for programmable powers of two decimation comprising: a decimation FIR filter having an input for receiving an input signal to be decimated by powers of two and an output, the output being fed back to the input and the decimation FIR filter having context registers (18,20,22) such that an output context register (28) coupled to provide the output simultaneously contains all decimation by two results up to 1/2 m , where m is the number of contexts for each context register; and means for timing the decimation FIR filter for each power of two decimation having as inputs an initial clock signal and an initial valid signal at one-half the frequency of the initial clock signal and providing as outputs timing signals to the decimation FIR filter selectively enabling the context registers, a desired decimation result for output being determined by selecting an appropriate output decimation factor 2 p where 0≤p≤m. The apparatus as recited in claim 1 wherein the decimation FIR filter comprises: an n -tap FIR filter using, firstly, the context registers having odd taps summed together to provide an odd decimated result and secondly the context registers having even taps summed together to provide an even decimated result; means for summing (24,26) the odd and even decimated results to provide the output via the output context register; and means for selecting (12) for coupling to the input of the n -tap FIR filter either the input signal or the output from the output context register in response to the initial valid signal. The apparatus as recited in claim 2 wherein the timing means comprises a plurality of timing circuits (29) coupled in cascade, each having a clock enable input and a valid input, the valid input being one-half the frequency of the clock enable input, and having a clock enable output at one-half the frequency of the clock enable input and a valid output at one-half the frequency of the valid input, the clock enable output and valid output being respective clock enable and valid inputs to the next timing circuit in the cascade, each timing circuit providing a pair of out-of-phase enabling signals (M) for the context registers, one of the enabling signals for the context registers used for the odd decimated results and the other for the context registers used for the even decimated results, the enabling signals and valid outputs being the timing signals. The apparatus as recited in claim 3 wherein each timing circuit comprises: a toggle register (30) having an input and a pair of outputs of opposing polarity (Q, Q ), one of the outputs being coupled to the input, the outputs changing state for each change of state of the respective valid input; means for generating (32) one of the enabling signals from the valid input and the input of the toggle register and for generating (34) the other of the enabling signals from the valid input and the output of the toggle register not coupled to the input; and means for generating (40) the valid output and (38) the clock enable output as a function of the valid input, the clock enable input and the output of the toggle register not coupled to the input.

Inventors: KEITH R SLAVIN, KEITH, R. SLAVIN
Applicants: TEKTRONIX INC, TEKTRONIX, INC.
Application year: 1998
Main classification: H03H17
IPC codes: H03H17