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.
Do not include the problem statement in your submission, just your answers. Or if you really want to include it, show it in a different font such as italics.
inA inB outExp outMantissa Correct? -------- -------- ------ -------------- -------- 10101100 00110101 110010 01100110100101 Y 00000101 10110101 101010 01010101010101 Y 01010100 11101010 010100 11010101100101 no
If you would like to use your own algorithm, that's great. Otherwise, you might try coding an algorithm that works something like this:
a) [15 pts] Write the described function in matlab.
b) [5 pts] Assuming your function is called "numppterms", run the following bit of matlab code (a few points need fixing), and report the Total Sum for all numbers 0.5 – 100.00 .
StepSize = 0.5; NumTermsArrayPos = zeros(1, 100/StepSize); % small speedup if init first for k = StepSize : StepSize : 100, NumTermsArrayPos(k/StepSize) = numppterms(k); end fprintf('Total sum for +0.5 - +100.00 = %i\n', sum(NumTermsArrayPos)); figure(1); clf; plot(StepSize:StepSize:100, NumTermsArrayPos, 'x'); axis([0 101 0 1.1* max(NumTermsArrayPos)]); xlabel('Input number'); ylabel('Number of partial product terms');
coeff = [26 43 317 696 317 43 26];Assume the coefficients cannot be scaled larger, but they can be scaled smaller (up to 50% smaller) and the gain change can be compensated elsewhere. This implementation works with integers only, so round() scaled coefficients.
a) [5 pts] How many partial products are necessary to implement the FIR filter with the given coefficients?
b) [5 pts] See if a scaling for the coefficients exists such that the filter can be built with fewer partial products. Find the scaling that yields the minimum number of partial products.
c) [5 pts] Turn in a plot of the number of required partial products vs. the scaling factor. The plot should look something like the bogus results this matlab code generates.
figure(1); clf; plot(0.5:0.001:1.0, round(5* rand(1,501)+1), 'x'); axis([0.45 1.05 0 6.5]); xlabel('Scaling factor'); ylabel('Number of partial product terms'); title('EEC 281, Hwk/proj 2, Problem 3, Plot of bogus results');d) [15 pts] Draw dot diagrams showing how the partial products would be added (include sign extension) for the optimized coefficients you found in (b), using the FIR architecture shown below and an 8-bit 2's complement input word. Use 4:2, 3:2, and half adders as necessary and no need to design the final stage carry-propagate adder.
coeffs1 = remez(numtaps-1, freqs, amps); coeffs2 = coeffs1*scale; coeffs = round(coeffs2); [H,W] = freqz(coeffs); H_norm = abs(H) ./ abs(H(1)); [ripple, minpass, maxstoplo, maxstophi] = lpfirstats(H_norm);
Total_num_partial_products + 2*Num_filter_taps
Results from a previous year for a different filter show there is lots of room for optimization (absolute values vary greatly with different specifications): 109 area, 31 taps, 47 PPs 109 area, 31 taps, 47 PPs 113 area, 33 taps, 47 PPs 114 area, 33 taps, 48 PPs 123 area, 33 taps, 57 PPs 128 area, 34 taps, 60 PPs 182 area, 55 taps, 72 PPs 221 area, 59 taps, 103 PPs 221 area, 59 taps, 103 PPs 250 area, 61 taps, 128 PPs
Updates: 2015/02/18 Posted. 2015/02/22 Finalized, problem 4 posted.