106 6. REAL-TIME FILTERING
printf("A: %d,B: %d,C: %d,Status: %#010x
", A, B, result, status);
A = 10;
B = 11;
status = addGetStatus(A, B, &result);
printf("A: %d,B: %d,C: %d,Status: %#010x
", A, B, result, status);
A = -10;
B = -10;
status = addGetStatus(A, B, &result);
printf("A: %d,B: %d,C: %d,Status: %#010x
", A, B, result, status);
A = 100;
B = -1000;
status = addGetStatus(A, B, &result);
printf("A: %d,B: %d,C: %d,Status: %#010x
", A, B, result, status);
A = -100;
B = -32768;
status = addGetStatus(A, B, &result);
printf("A: %d,B: %d,C: %d,Status: %#010x
", A, B, result, status);
A = 32767;
B = 1000;
status = addGetStatus(A, B, &result);
printf("A: %d,B: %d,C: %d,Status: %#010x
", A, B, result, status);
e first half-byte of the status word copied from the APSR contains the NZCV (negative,
zero, carry, and overflow) bit flags. e outcome from the test cases is shown in Figures L6.2 and
L6.3. e first hexadecimal character corresponds to the bits of the NZCV flags. For the case
of 2
15
1 C 2
15
1 (the largest positive value represented by Q15 numbers), one can see the
resulting status of 0x9 or binary 1001. is means that the result became negative and produced
an overflow.
L6.3 LAB EXERCISES
1. Use the MATLAB code below to design an FIR filter based on the specifications noted.
is filter is obtained using a different design method than the one mentioned above via
the fir2() function of MATLAB. Refer to the MATLAB documentation on how to use
this function.