Starting from:

$30

DIC- Frequency Analysis System 2  Solved

1         Introduction
In this homework, you are requested to design a system constructed with a Finite Impulse Response filter (FIR filter), a Fast Fourier Transform (FFT) circuit and an Analysis circuit. This system can filter out the noise with FIR Filter and then transform the signals from time domain into frequency domain with FFT circuit. Finally, the main frequency band of the signal can be found out with Analysis circuit, which can be applied as a sensing system. The functionality of the system will be described in detail in the following parts. 

2         Design Specifications
2.1      Block overview
  Fig. 1 – System block overview.

 

2.2      I/O Interface
Name
I/O
Width
Description
clk 
I
1
System clock signal. This system is synchronized with the positive edge of the clock.
rst 
I
1
Active-high asynchronous reset signal.
data_valid 
I
1
When the host is ready to send data, this signal will be set as high.
data 
I
16
Time domain signal from the host.
done 
O
1
When the system complete calculation, this signal should be set as high.
fir_d 
O
16
Output data signal of FIR filter.
fir_valid 
O
1
Data valid signal of FIR filter.
fft_d0 ~ fft_d15 
O
32
Output data signal of FFT.
fft_valid 
O
1
Data valid signal of FFT.
freq 
O
4
Output signal for the main frequency.
 

2.3      Function Description
The system gets input time domain signal from the host, the example is shown in figure 2. Then the noise in the input signal is filter out with FIR filter, the filtered result of signal in figure 2 is shown in figure 3.

  

Fig. 2 – Time domain signals from the host. 

 

  

Fig. 3 – Signals which passed the FIR filter. 

 

 

After the input signal is filtered and is ready to output, pull up the fir_valid signal. And use fir_d signal to transmit one data in each cycle. The filtered signal will then be processed by FFT, and the frequency domain signal can be obtained. (Take figure 4 as example.) Pull up fft_valid signal and use fft_d signal to transmit one set of data (fft_d0 ~ fft_d15) to the Analysis circuit. When the Analysis circuit complete calculation, pull up done signal and output the main frequency band by freq signal. Among the signals fft_d0 ~ fft_d15, fft_d0 represents the frequency band 0, fft_d1 represents the frequency band 1, and so on.

  

Fig. 4 – Spectrum diagram of signals which are processed by FFT. 

 

2.4      Timing Diagram
The timing specification of this design contains four parts: The system timing specification, the input signal timing specification, the FIR output timing specification, and the FFT output timing specification.

2.4.1   System timing specification
The timing diagram in figure 5 shows the system timing specification. After the system is reset, the serial input signals pass FIR filter and output by fir_d serially. Every sixteen output signals from FIR filter will be parallel input to the FFT circuit. The FFT circuit will output the processed signal parallel with signals fft_d0 ~ fft_d15. The Analysis circuit takes these signals and processes them to find the main frequency band. Finally, the main frequency band is output with freq signal. The done signal has to be pulled up at the same time to inform the host that the set of sixteen signals have been processed. The fir_valid, fft_valid, and done signals all maintain as high for 1 cycle for each valid output data. Besides, there is no overlap between any two sets of valid output of FIR filter. For example, the first set of FFT parallel input is constructed with fir_d(0) ~ fir_d(15), and the second set of FFT parallel input will be constructed with fir_d(16) ~ fir_d(31), and so on. In this homework, the host will input 1024 data to the system, so there will be 64 calculation results output by the system.

  

Fig. 5 – Timing diagram of the system. 

 

2.4.2   Input signal timing specification
When the data_valid signal is set as high by the host, the data port will send one data in each cycle. Its timing specification is shown in figure 6. tCYCLE represents the clock width of the system. The width of data signal is 16 bits, which is constructed with a sign bit, 7 bits of integer data, and 8 bits of floating number data. The construction of data is shown in figure 10.

  

                                      Fig. 6 – Timing diagram of the host data transmission.                                       

2.4.3   FIR output timing specification
After the signals are filtered with FIR filter, they will be output to the FFT circuit. When the data is transmitting, the fir_valid signal should be set as high. And the testbench will verify the FIR output synchronously. The output timing of FIR filter is shown in figure 7.

  

Fig. 7 – Timing diagram of FIR output data. 

 

2.4.4   FFT output timing specification
After the FIR output data are processed with FFT circuit, they will be output to the Analysis circuit. When the data is transmitting, the fft_valid signal should be set as high. And the testbench will verify the FFT output synchronously. The output timing of FFT circuit is shown in figure 8.

  

Fig. 8 – Timing diagram of FFT output data. 

 

2.5      Functionality of FIR filter
The FIR filter in the system is a low pass filter with 32 coefficients, and it is responsible for filtering out the high frequency noise. The coefficients of the filter are fixed, and they are shown in table 2. (They are also stored in the file “FIR_coefficient.dat”.) The first valid output will be calculated after the thirtysecond data is input to the FIR filter. Equation 1 shows the calculation process of FIR filter. Figure 9 shows its hardware architecture, and figure 10 shows the format of input data and output fir_d.

 

𝑁−1

                                   𝑦(𝑛 − (𝑁 − 1)) = ∑ ℎ(𝑘) 𝑥(𝑛 − 𝑘)                           (equation 1)

𝑘=0

 

 y(n-(N-1))  

Fig. 9 – Hardware architecture of FIR filter. 

 

  

TABLE. 2 – Coefficients of low pass filter. 

 

 

sign bit
integer
floating number
1 bit
7 bits
8 bits
Fig. 10 – Data format (data, fir_d) 

 

2.6      Functionality of FFT circuit
In this system, you are requested to complete a sixteen-point fast Fourier transform. Its hardware architecture is shown in figure 11. The FFT circuit is used to transform the time domain signals into frequency domain signals for following analysis.

             

 

Fig. 11 – Hardware architecture of 16-point FFT circuit. 

 

Figure 12 is an example of the FFT calculation process. The minus sign in the path of fft_b represents the calculation of subtract Y from X, and Wn is the FFT coefficient. The FFT coefficient contains real part (Wn_real) and imaginary part (Wn_imag). To obtain the results, the complex number operations have to be calculated. Figure 13 shows the result of fft_b after the multiplication.

  

Fig. 12 – Example of FFT calculation. 

 

             

Real part of fft_b
(a - c)*Wn_real + (d - b)*Wn_imag
Imaginary part of fft_b
(a - c)*Wn_imag + (b - d)*Wn_real
Fig. 13 – Multiplication result of fft_b. 

 

The values of FFT coefficients are shown in table 3. The real part coefficients are stored in the file “Real_Value_Ref.dat”, and the imaginary part coefficients are stored in the file “Imag_Value_Ref.dat”. Figure 14 shows the data format of output of FFT circuit (fft_d0 ~ fft_d15).

  

TABLE. 3 – Wn coefficients for FFT process. 

 

 

Signed bit 
Integer of real part 
Floating number of real part 
Sign bit 
Integer of 

imaginary part 
Floating number of 

imaginary part 
1 bit
7 bits
8 bits
1 bit
7 bits
8 bits
Fig. 14 – Data format (fft_d0 ~ fft_d15). 

 

             

Because the output from FIR filter is serial, a serial to parallel circuit has to be designed so that the FFT circuit can meet the timing specification. Figure 15 shows an example of the FFT circuit with the serial to parallel circuit.

  

Fig. 15 – 16-point FFT circuit with the serial to parallel circuit. 

                 

2.7      Functionality of Analysis circuit
After the output of FFT circuit is input, the Analysis circuit has to find out the main frequency band. The definition of main frequency band is: the frequency whose sum of square of the real part data and imaginary part data is maximum. For example, Y(n) = a + bj (n = 0 ~ 15), then a2 + b2 has to be calculated for comparison. Finally, the main frequency band should be output with freq signal. If Y(2) has maximum sum of square, the freq should output 4’b0010.

More products