Electrical Engineering › Section W · Signal conversion and data transmission › Topic W.2
Digital signal processing
Once a signal is a stream of numbers, arithmetic can filter it, clean it, compress it and analyse it in ways analog circuits struggle to match. Digital signal processing is that arithmetic, and the digital signal processor is the chip built to do it in real time.
The digital signal processing chain
Digital signal processing (DSP) means operating on a sampled signal with arithmetic. A typical system follows the chain from "Analog-to-digital and digital-to-analog conversion": an anti-aliasing filter, a sample-and-hold circuit and an ADC turn the analog input into a stream of binary codes. A processor then works on those numbers, perhaps removing noise, boosting some frequencies and cutting others, or detecting errors. Finally a DAC and a reconstruction filter, a low-pass filter that smooths the DAC's staircase output, return an analog signal. Some systems never return to analog: a speech recogniser or a radar tracker simply outputs decisions or data.
Why process signals digitally
Digital processing has decisive advantages. The same numbers always give the same result, with no drift from component tolerance, temperature or ageing. Changing a filter means changing coefficients or code, not soldering parts. Operations that are impractical with analog parts become routine: very sharp filters, filters with exactly linear phase, filters that adapt themselves to changing conditions, and compression. The costs are real too. Every sample must be processed before the next arrives, which adds a delay, called latency, absent in analog filters. The signal must be band-limited and sampled, and quantisation adds a small error.
The core operation: multiply and accumulate
Most DSP algorithms reduce to one operation repeated millions of times a second: multiply a sample by a coefficient and add the product to a running total. This multiply-accumulate (MAC) step builds a finite impulse response (FIR) filter, whose output is a weighted sum of the present and past inputs:
Here \(x[n]\) is the input at sample \(n\), \(y[n]\) the output and \(b_k\) the \(N\) coefficients, or taps. Choosing the taps sets the frequency response. An infinite impulse response (IIR) filter also feeds back past outputs, getting a sharp response from fewer operations at the risk of instability if designed badly.
Worked example: a moving-average filter
A 4-tap FIR filter with every \(b_k = 0.25\) averages the last four samples, a simple low-pass filter. The input from \(n = 0\) is 2, 6, 4, 8, 10, 2, with earlier samples taken as 0. 1. \(y[0] = (2 + 0 + 0 + 0)/4 = 0.5\). 2. \(y[1] = (6 + 2)/4 = 2.0\) and \(y[2] = (4 + 6 + 2)/4 = 3.0\). 3. \(y[3] = (8 + 4 + 6 + 2)/4 = 5.0\). 4. \(y[4] = (10 + 8 + 4 + 6)/4 = 7.0\). 5. \(y[5] = (2 + 10 + 8 + 4)/4 = 6.0\). 6. Interpret: the input falls sharply from 10 to 2, but the output only eases from 7.0 to 6.0, because the averaging suppresses rapid changes. Each output cost four MACs.
Real-time demands and data rates
A DSP system works in real time: it must finish each sample's calculations before the next sample arrives. Telephone speech is sampled at 8000 samples per second with 8 bits per sample, a data rate of \(8000 \times 8 = 64{,}000\) bits per second, or 64 kb/s. Compression algorithms, which reduce the number of bits needed, cut speech to a fraction of that; modern voice codecs often use only a few kb/s to a few tens of kb/s. Uncompressed CD audio, 44,100 samples per second with 16 bits in each of two channels, runs at 1,411,200 b/s, about 1.41 Mb/s.
Worked example: a real-time budget
A processor clocked at 600 MHz completes one MAC per clock cycle. It must run a 64-tap FIR filter on each channel of stereo audio sampled at 48 kHz. 1. Time between samples: \(1 \div 48{,}000 = 20.8\,\mu\text{s}\). 2. Cycles available per sample period: \(600 \times 10^6 \div 48{,}000 = 12{,}500\). 3. Work per period: 64 MACs × 2 channels = 128 cycles. 4. Fraction used: \(128 \div 12{,}500 \approx 1\%\), leaving ample time for other tasks. 5. Check the limit: the processor could run about \(12{,}500 \div 128 \approx 97\) such filter pairs before missing a deadline, ignoring overheads.
Inside a digital signal processor
A digital signal processor, also called a DSP, is a microprocessor specialised for this work. Many use a Harvard architecture, with separate memories and buses for program and data, so an instruction and its operands can be fetched at the same time. Hardware multipliers complete a MAC in one cycle, often several in parallel. Pipelining overlaps the fetch, decode and execute stages of successive instructions, and some families, such as the Texas Instruments TMS320C6000 series, issue several instructions per cycle in very long instruction words. Address units handle circular buffers for filter samples automatically. DSP programs are written mostly in C, with hand-tuned assembly for the most critical loops.
Fixed point or floating point
DSPs come in fixed-point and floating-point versions, the number formats met in "Complements and signed numbers". Fixed-point processors treat values as integers or scaled fractions; they are smaller, cheaper and lower in power, but the programmer must scale signals to avoid overflow and keep enough precision. Floating-point processors handle a much wider dynamic range automatically, which shortens development, at some cost in silicon and power. Floating-point devices can also run fixed-point code. Fixed point suits high-volume products such as earbuds; floating point suits complex algorithms and low-volume instruments.
Where DSP is used
A mobile phone shows DSP at work. Its codec converts between voice and digital form, usually with delta-sigma converters, and DSP code compresses and decompresses speech, adds and checks error-correcting codes, encrypts the stream and performs much of the radio modulation. Long-distance calls use echo cancellation. Music production uses digital equalisers, reverberation and noise removal, and noise-cancelling headphones subtract an inverted copy of outside sound. CT and MRI scanners reconstruct images from measured signals, and radar and sonar extract targets from noise. Today much DSP also runs on DSP cores inside phone processors, on FPGAs, and on microcontrollers with MAC instructions.
Common mistakes to avoid
First, assuming digital filters respond instantly: processing adds latency, which matters in live audio and control loops. Second, forgetting the reconstruction filter: a bare DAC output is a staircase with high-frequency content. Third, ignoring the real-time budget: if one sample's work overruns the sample period, data is lost. Fourth, treating a fixed-point DSP like a floating-point one, so values overflow or lose precision. Fifth, confusing DSP the technique with DSP the chip: the same arithmetic runs on many kinds of processor.
Key takeaways
Digital signal processing filters, compresses and analyses sampled signals with arithmetic, in a chain of anti-aliasing filter, ADC, processor, DAC and reconstruction filter. It is repeatable and reprogrammable and makes sharp, linear-phase and adaptive filters practical, at the cost of latency. The multiply-accumulate step builds FIR filters, \(y[n] = \sum b_k x[n-k]\); IIR filters add feedback. Real-time work must fit within each sample period. Digital signal processors use Harvard architectures, single-cycle MACs, pipelining and parallel instructions, in fixed-point or floating-point form.
Flashcards
Flashcard
Anti-aliasing filter, sample-and-hold, ADC, processor, DAC, reconstruction filter
Test your understanding
Question 1 of 5
A 3-tap moving-average filter has all taps equal to 1/3. The last three inputs are 9, 3 and 6. What is the output?
Question 2 of 5
Speech is sampled at 16,000 samples per second with 12 bits per sample. What is the uncompressed data rate?
Question 3 of 5
A DSP clocked at 400 MHz does one MAC per cycle, and samples arrive at 40 kHz. How many MACs per sample can it perform before missing a deadline, ignoring overheads?
Question 4 of 5
Why do many digital signal processors use a Harvard architecture?
Question 5 of 5
Which is a genuine drawback of a digital filter compared with an analog one?
