Download presentation
Presentation is loading. Please wait.
Published byWillow Scribner Modified over 9 years ago
1
Lab 2 – DSP software architecture and the real life DSP characteristics of signals that make it necessary
2
Lab. 2 – same as Lab. 1 but more so 1.Handling FIR algorithms in C++ and assembly code 2.Working to understand how C++ is trying to use the processor architecture 3.Trying to understand why we are not achieving th 2.5 GFLOPs (or what ever) that is available 4.Using the C++ compiler as a tutor 1.Get the compiler to do something, look at code generated and understand it 5.The more so – Persuading the compiler to use 1.Both data busses (pmda and dmda) and instruction bus (pmco) 2.Use SIMD
3
FIR filter is a natural for all these optimizations – from 24N down to N/2 cycles SISD -- Von Neuman Architecture – One memory – may have superscalar capability FIR_output = Fetch in instructions I MEM for this operation and then do (3N to 24N fetches) sum ( X MEM [n] * coeff MEM [n] ) ; 0 <= n < N SISD -- Harvard Architecture – Two memory with superscalar capability FIR_output = Fetch in instructions I PM for future operation and then do (only 2N fetches) sum (X DM [n] * coeff DM [n] ) ; 0 <= n < N SISD -- Super Harvard Architecture – Three memory with superscalar capability FIR_output = Fetch in instructions I PM-CO for future operation and then do (only N fetches) sum (X DM-DA [n] * coeff PM-DA [n] ) ; 0 <= n < N SIMD -- Super Harvard Architecture – Three memory with superscalar capability FIR_output = Fetch in instructions I PM-CO for future operation and then do (only N /2 fetches) sum (X DM-DA [2m] * coeff PM-DA [2m] ) + sum (X DM-DA [(2m + 1)] * coeff PM-DA [2m + 1] ) ; 0 <= m < N/2
4
Analog low pass anti-aliasing filter Problem to tackle – we want to filter a signal – How many FIR taps are needed? You must have Signal Strength of LP filter must match Sample rate Nyquist criterium A/D Sample rate D/A Sample rate Analog low pass anti-aliasing filter Strength of LP filter must match Sample rate Nyquist criterium Analog signal with amplitude values with changed frequency characteristics DSP Algorithm Discrete sample values with changed frequency characteristics from input signal
5
Analog Devices A/D work roughly like this Analog low pass anti-aliasing filter You must have Signal Strength of LP filter must match Sample rate Nyquist criterium A/D 8 TIMES OVER SAMPLING FIRMWARE (LP Averaging) anti ALIASING FILTER Discrete sample values with changed frequency characteristics from input signal Down-sampler by x2, x4, x8, x16 44 kHz
6
How much processing power per sample? FIR works on time domain signals – so that’s where we calculate the performance power needed for an N-tap FIR filter on any architecture N * (FIR values fetched + coeffs fetched + add + multiply + 4 Instructions) + (N – 1) * (2 * FIR values fetched + 2 instruction) So what is the value of N is needed
7
Work out the impact of N by examining FIR characteristics in frequency domain If you sample at 44 kHz then frequency characteristics of digital are like this -22 kHz +22 kHz -66 kHz -22 kHz -66 kHz +66 kHz -22 kHz +22kHz +66 kHz S -2 S -1 S0S0 S1S1 S2S2 The digitized signal if the sum of all frequencies to infinity grouped in stages of 44 kHz Process signal == S0 + S1 + S2 + S…….. + S-1 + S-2 + S…….s
8
In DSP – YOU MUST WORK WITH BAND-LIMITED SIGNALS AND BAND-LIMITED NOISE Signals must be in the range -22 kHz to +22kHz if sample at 44 kHz – Strict Nyquist Better signal processing if you arrange, and can afford the time, to process at 44 kHz but use band limited signals of-11 kHz to + 11 kHz Hence the need of an ANALOG anti-aliasing filter because once you have sampled – you have an aliased digital signal
9
Work out the impact of N by examining FIR characteristics in frequency domain If you sample at 44 kHz then frequency characteristics of digital are like this -22 kHz +22 kHz The digitized signal if the sum of all frequencies to infinity grouped in stages of 44 kHz Process signal == S0 + S1 + S2 + S…….. + S-1 + S-2 + S…….s N point FIR filter x x x x x x x x x x x x x Frequency resolution 44 kHz / N Say you want a filter of 3.3 kHz low pass with fairly smooth frequency characteristics 44/ N = 6.6 / 20 N = 44 * 20 / 7 around 128 tap filter x x x x x x x x x x x x x -22 kHz -3 kHz +3 kHz +22 kHz
10
Ranchlands -- 3 sound sources as 42 +-2 Hz, 57 +-2 Hz, 32 +-2Hz That means the bandwidth of each of 3 filters is 2 Hz If a 3.3 kHz filter needed 128 tap filter Then a 2 Hz filter will need more than 128, 000 tap filter Problem – each filter is doing its own independent frequency modification – very inefficient Solution – combine some of the frequency modification from all the filters Solution 1 – Combine frequency modification of data in time domain – Lab 2 Solution 2 – switch to modification of data infrequency domain – Lab 4 (fastest but not frequently done because of bad historical press Solution – bring in co-processor support (Labs 2 and 4)
11
Lab 2 – we are going to do this Analog low pass anti-aliasing filter Signal A/D FIRMWARE DIGITAL (summing) anti ALIASING FILTER Down-sampler x2, x4, x8, x16 44 kHz DIGITAL (32 x FIR) anti (LP) ALIASING FILTER Down-sampler x32 4 kHz DIGITAL (256 x FIR) BAND PASS FILTER 42 Hz DIGITAL (256 x FIR) BAND PASS FILTER 57 Hz DIGITAL (256 x FIR) BAND PASS FILTER 37 Hz 3 * N * N operations
12
Lab 4 – we are going to do this Analog low pass anti-aliasing filter Signal A/D FIRMWARE DIGITAL (summing) anti ALIASING FILTER Down-sampler x2, x4, x8, x16 44 kHz DIGITAL (32 x FIR) anti (LP) ALIASING FILTER Down-sampler x32 4 kHz DIGITAL (256 x FFT) BP FILTER 42 Hz 57 Hz 37 Hz 2 * N * log2(N) operations
13
Works like this Init_UTTCOS Add_PreEmptiveThread( ) While (1) Wait Dispatch Pre-emptive task 1) Do low-pass FIR on new value at place in Output Buffer 2) When full – down-sample the output buffer (discard 31 out of 32 points) into a new filters FIFO buffer 3) Launch 3 task (outside of interrupt handler) to apply FIR filters 2, 3 and 4 Non-emptive task – 3 band- pass FIR filters 1) Do FIR on new value at place in Output Buffer 2) Do an average power calculation on the output buffer 3) If average power is above a certain level then launch task to turn on LED or launch a task to turn it off
14
Software FIR Loop -- Used many places – when call functions in loop Pseudo code Count = 0; Sum_Rx = 0; LOOP_START: If count > MAX jump PAST_LOOP_END nop; nop; LOOP BODY -- sum_Rx[I] = sum_Rx + FIR[I++] ………. count++; jump LOOP START; nop; nop; PAST_LOOP_END: OUTSIDE LOOP
15
Hardware loop Pseudo code R0 = MAX; Sum_Rx = 0; LCNTR R0, DO (PC /* LOOP START IS NEXT PC */, PAST_LOOP_END-1) UNTIL LCE; LOOP_START: LOOP BODY -- sum_Rx = sum_Rx + FIR[I++] ………. PAST_LOOP_END: // Note PAST_LOOP_END-1 OUTSIDE LOOP
16
Hardware loop with SIMD MAX EVEN Pseudo code R0 = MAX / 2; SWITCH TO SIMD nop; nop; Sum_Rx = 0 // Hidden Sum_Sx = 0; LCNTR R0, DO (PC /* LOOP START IS NEXT PC */, PAST_LOOP_END-1) UNTIL LCE; LOOP_START: LOOP BODY -- sum_Rx = sum_Rx + FIR[I++] ………. // Hidden -- sum_Sx[I] = sum_Sx + FIR[I++] ………. // DOUBLE MEMORY INCREMENT PAST_LOOP_END: // Note PAST_LOOP_END-1 OUTSIDE LOOP SWITCH TO SISD nop; nop; Ry = Sx; // STALL; Rx = Rx + Ry
17
Hardware loop with SIMD MAX ODD R0 = MAX / 2; -- rounds down SWITCH TO SIMD nop; nop; Sum_Rx = 0 // Hidden Sum_Sx = 0; LCNTR R0, DO (PC /* LOOP START IS NEXT PC */, PAST_LOOP_END-1) UNTIL LCE; LOOP_START: LOOP BODY -- sum_Rx = sum_Rx + FIR[I++] ………. // Hidden -- sum_Sx = sum_Sx + FIR[I++] ………. // DOUBLE MEMORY INCREMENT PAST_LOOP_END: // Note PAST_LOOP_END-1 OUTSIDE LOOP SWITCH TO SISD nop; nop; Ry = Sx; // STALL; Rx = Rx + Ry sum_Rx = sum_Rx + FIR[I++] …
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.