EEC 281 - Homework/Project #4

Winter 2017

Work individually, but I strongly recommend working with someone in the class nearby so you can help each other when you get stuck, with consideration to the Course Collaboration Policy. Please send me email if something isn't clear and I will update the assignment. Changes are logged at the bottom of this page.


Note that matlab naturally lets variables hold complex values, operates on complex values when defined, "j" is automatically imaginary-one, and "pi" is π. Use only very basic operations (e.g., *, +, –, exp(), etc.) and not high-level functions either built into matlab or that you find on the web. You are welcome to use the functions provided on the matlab 281 web page. The idea with the matlab is that you should be able to transition to verilog much more easily if you have implemented the details in matlab.

To receive more than 30% of the maximum number of points, all problems must show "reasonable" numerical accuracy considering the datapath widths.

  1. [50 points] Matlab 16-point complex FFT.

    a) [20 points] Design and implement a 16-point radix-2 complex FFT in matlab using complex variables, exp(–j*x) for WN calculations, and one or more 16-element arrays for the memory.

    b) [30 points] Show that your FFT correctly calculates an FFT for a random input by comparing it in matlab using:
    in = (1.99*rand(1,16) -1) + j*(1.99*rand(1,16) -1);
    plot_complex(in);     % look at waveform if you like

    difff(fft(in)*Scale, out);
    where Scale is a real constant specific to your design.

    Turn in: 1) the difff() plot, and 2) the text output of difff().

    Suggestion: if you are having trouble implementing a 16-point FFT, try using simpler inputs such as the ones in Problem 3, or implementing an 8-point or 4-point FFT first.

  2. [90 points] Matlab 16-point complex 16-bit FFT.

    Repeat the requirements in problem 2 but now the input, output, and all values between stages must be 16-bit values with valid ranges matching 16-bit 2's complement words. Round extra bits from wide numbers at the end of each stage; saturation would destroy SNR for large input waveforms.

    c) [10 points] State the "x.y" number format for the input, output, and all values between stages.

    d) [30 points] Repeat (b) with all inputs equal to (MaxNegative + j*MaxNegative). Of course Scale must be kept the same--this is a test of whether the internal scaling was done properly.

  3. [225 + 25–50 points] FFT Hardware design.

    Design, implement, write verilog, and synthesize a super-fast 16-point complex Radix-2 Decimation-In-Time (DIT) Fast Fourier Transform processor that processes a complete transform every clock cycle, though it has a latency of five cycles. Register all inputs as they enter fft.v before using them, register all values between FFT stages, and register all outputs of fft.v before they exit the unit.

                         Top-Level Block Diagram
                            16*16 |     | 16*16
     in_real00 - in_real15 ---/---| fft |---/--- out_real00 - outreal15
     in_imag00 - in_imag15 ---/---|     |---/--- out_imag00 - outimag15
                            16*16 |     | 16*16
    The key block signals are (others may be added as needed within reason):


    Full credit cannot be given unless the FFT can compute the test cases in part (c). Caution: please do not take documentation lightly; large numbers of points will be deducted for incomplete or unclear descriptions.

    a) [50 points] Draw a detailed pipelined block diagram of the FFT processor.

    b) Show that your FFT correctly calculates an FFT for the following cases by loading verilog output and comparing them in matlab using: difff(fft(in), out);     Turn in: 1) the difff() plot, and 2) the text output of difff().

          i) [35 points] Positive real impulse at time = 0 (mode=00 in dsource.v).

          ii) [35 points] Positive real impulse at time = 1 (mode=02 in dsource.v).

          iii) [35 points] Rect input (mode=06 in dsource.v).

          iv) [35 points] All inputs equal to (MaxNegative + j*MaxNegative).

          v) [35 points] Random input (mode=07 in dsource.v).

    c) [25–50 points] Accuracy points for smallest error for random signal input (part b.v) compared to matlab fft, in comparison to other working designs in the class. Write the Energy_diff/Energy_data0 value in dB from difff.m in your report.

  4. [250 points] Cognitive Radio Spectrum Analyzer

    Use your FFT engine to build a cognitive radio spectrum analyzer which examines 16 frequency bands and identifies the three bands which have the lowest spectral magnitude. The system has the following inputs and outputs:

    • 16-bit real + 16-bit imag input × 16 samples per clock cycle
    • 4-bit output low1: output values 0–15 correspond to the spectral output sub-band with the lowest magnitude for a particular set of 16 input samples
    • 4-bit output low2: second lowest magnitude
    • 4-bit output low3: third lowest magnitude
    • 1-bit output stable: goes high when low1, low2, and low3 have the same value for 3 cycles

    a) [50 points] Draw a detailed pipelined block diagram of the analyzer.

    b) [100 points] Show that your processor operates correctly for at least 20 sets (16 complex samples for each) of random inputs compared to a matlab model.

    c) [100 points] Synthesize the system without errors or serious warnings.

Possibly-helpful suggestions

2017/03/04  Posted
2017/03/09  Released
2017/03/11  Removed requirement of 2 diagrams for problems 3 and 4; now only one is required. 
            Moved some instructions to the page header.
            A few other minor cleanup changes.
2017/03/14  Latency of FFT is five cycles, not four.