Download as pdf or txt
Download as pdf or txt
You are on page 1of 18

Digital Signal Processing Definition of a Digital Signal Processor A digital signal processor (DSP) is an integrated circuit designed for

high-speed data manipulations, and is used in audio, communications, image manipulation, and other data-acquisition and data-control applications. How Digital Signal Processing Works To explain how digital signal processing works, an understanding of the difference between analogue and digital signals. Analogue signals, which include sound intensity, pressure, light intensity, etc., are continuously variable. Each of our senses is sensitive to different kinds of analogue signals. Our ears are sensitive to sound, our eyes are sensitive to light, and so on. Once we receive a signal, our sensory organs convert it to an electrical signal and send it to our analogue computer (the brain). Our brains are very powerful parallel computers whose performance currently is unmatched by any digital computer. Our brains not only analyse the information received, but also make decisions using this data. Digital signals are those that are transmitted within or between computers, in which information is represented by discrete states for example, high voltages and low voltages rather than by continuously variable levels in a continuous stream, as in an analogue signal.

How Analogue and Digital Signals Work Together Digital technology such as personal computers (PCs), assist us in many ways: writing documents, spell checking, and drawing. Unfortunately, the world is analogue, and electronic analogue computers are not as versatile as digital computers. Therefore, in order to make use of the tremendous processing power that digital technology offers, the following must occur:

Convert the analogue signals into electrical signals, using a transducer (such as a microphone, as shown in the diagram). Digitise these signals (i.e., convert them from analogue to digital using an analogue-to-digital converter (ADC)), as shown in the diagram.

Once the signal is in digital form, a computer can easily process it through a digital signal processor. The DSP specialises in processing these signals, which makes it slightly different from microcomputers, microcontrollers, or general-purpose microprocessors. After the DSP has processed the signal, the output signal must be converted back to analogue form so that we can sense it. This is the digital-to-analogue (DAC) conversion stage in Figure 1. A loudspeaker, for example, would reproduce analogue signals coming from the DAC into sound. So, we can see that to process the signal digitally, we need to convert it at least twice.

The Reasons for UsingDigital Signal Processors. It is possible to use normal microprocessors for DSP but they are not usually as efficient as a purpose designed DSP chip. This can be highlighted by looking at some of the arithmetic operations performed by DSPs. Add and Subtract Add and subtract operations are performed quite simply by general-purpose microprocessors in a single or very few clock cycles. Digital addition is similar to decimal add. Figure 2 shows adding 1 plus 2. The result is the decimal 3. Multiply and Divide 2

The multiply and divide operations are more complex. A digital multiply operation consists of a series of shift and add operations. Figure 2 shows a multiplication of 3 by 5. General-purpose microprocessors are quite slow in performing multiply and divide operations. They will typically sequentially execute a series of shift, add, and subtract operations from their microcode to perform a single multiply operation, and may consume many cycles to complete. The DSP performs multiplication in a single cycle by implementing all shift and add operations in parallel. The circuitry is relatively complex and consumes a considerable number of transistors. The benefit is very fast multiplication, which is required for processing most digital signals. When general-purpose DSPs are not fast enough, the signal is either processed using analogue circuits (which may have some drawbacks), or in specialised DSP hardware designed only for that task. This eliminates many of the benefits of a programmable DSP. Digital signal processing, by its nature, requires many calculations of the form: A = B*C + D This may appear to be a simple task, but when speed is also required, we find that specialised, dedicated hardware to perform this task is very useful. Multiply, Accumulate (MAC) Most DSPs have a specialised instruction that allows them to multiply, add, and save the result in a single cycle. This instruction is usually called MAC (short for Multiply, Accumulate). DSPs, require specialised hardware that is capable of performing multiply and accumulate functions in the shortest possible time (preferably in a single cycle). However, the central problem remains, which is how to achieve a fast multiply operation. Without a fast multiplier, a worthwhile DSP design would only be a dream. Designing fast multipliers was one of the greatest challenges in digital design up until the 1980s. In the 1970s, several of the worlds leading research laboratories sought to make fast digital multipliers a reality. Multiply Times In 1971, Lincoln Laboratories designed a multiplier using 10,000 integrated circuits, performing the operation in just 600 ns. By the mid-1970s, multiply times of 200 ns were becoming commonplace. This made it possible to design acceptable digital signal processors. These early designs were expensive and bulky, but fast multiplication was determined to be possible. In the early 1980s, single-chip DSPs with good performance started to appear, and ever since, multiply times have continued to drop. Todays 16-bit fixed-point devices can achieve multiply times of 5 ns. Given the origins of this technology, this is a remarkable achievement. A closer look at the internal architecture of computers will show how this has affected the design of DSP chips.

Stored Program Machines Computers need instructions to operate. At every clock cycle, they must be told what to do. If the instructions are stored, the computer just has to fetch and execute them. Such computers are called stored program machines. Our computer typically fetches an instruction and then data, operates on the data, and returns the resulting data to the store. Stored program machines use two well-known and widely used computer architectures: von Neuman and Harvard.. Figure 4 shows the structure of the two architectures.

Von Neuman Architecture The Von Neuman machines store programming and data in the same memory area. In this type of machine, an instruction contains the operation command and the address of the data on which the operation is performed. There are two basic operation units within these machines: the arithmetic logic unit (ALU) and the input/output unit. The ALU performs the core operations: multiply, add, subtract, and many more. It is on these very simple core operations that complex software, such as word processing software, can be built. The input/output unit manages the flow of external data for the machine. Harvard Architecture The primary difference between Harvard architecture and von Neuman architecture is that with Harvard, program and data memories are physically separated transmission paths. This enables the machine to transfer instructions and data simultaneously. Such a structure can greatly enhance performance, because instructions and data can be fetched simultaneously. Harvard machines also have ALUs and input/output units. Von Neuman and Harvard Architecture History The history of these two architectures is very interesting. The Harvard architecture was developed by Howard Aiken in the late 1930s at Harvard University, with the Harvard Mark 1 becoming operational in 1944. The University of Pennsylvania followed in 1946 with the development of the Electronic Numerical Integrator and Calculator (ENIAC). John von Neuman, a Hungarian-born mathematician, suggested a simpler and lower cost architecture, namely a single memory for programming and data. This simple solution 5

has set the standard ever since. In 1951, the Institute of Advanced Studies in Princeton built the first von Neuman machine. Comparison between Architectures for DSP? Common general-purpose personal computers use processors designed with the von Neuman architecture while the Harvard architecture is more commonly used in specialised microprocessors for real-time and embedded applications. DSPs typically use Harvard architecture, although von Neuman DSPs also exist. Many signal and image processing applications require fast, real-time machines. The drawback to using a true Harvard architecture is that since it uses separate program and data memories, it needs twice as many address and data pins on the chip and twice as much external memory. Unfortunately, as the number of pins or chips increases, so does the price. Electronic designers, who have had to tackle problems like these before, have come up with an elegant solution: a single data and address bus is used externally, while two (or more) separate buses for program and data are used internally. Timing (multiplexing) handles the separation of program and data information. In one clock cycle, the program information flows on the pins, and in the second cycle, data follows on the same pins. Program and data information is then routed onto separate internal program and data buses. Such machines are called modified Harvard architecture processors because the internal architecture is Harvard while the external architecture is von Neuman. The performance of modified Harvard architecture processors typically compares well with the performance of true Harvard architecture processors because most DSP chips also incorporate multiple internal RAM/ROM cells for high-use instructions and data. This significantly reduces the time used for external sequential program and data access associated with classic von Neuman processors. Components of a Typical DSP System Typical DSP systems consist of a DSP chip, memory, possibly an analogue-to-digital converter (ADC), a digital-to-analogue converter (DAC), and communication channels. Not all DSP systems have the same architecture with the same components. The selection of components in a DSP system depends on the application. For example, a sound system would probably require A/D and D/A converters, whereas an image processing system may not.

DSP Chip A DSP chip can contain many hardware elements; some of the more common ones are listed below. Central Arithmetic Unit This part of the DSP performs major arithmetic functions such as multiplication and addition. It is the part that makes the DSP so fast in comparison with traditional processors. Auxiliary Arithmetic Unit DSPs frequently have an auxiliary arithmetic unit that performs pointer arithmetic, mathematical calculations, or logical operations in parallel with the main arithmetic unit. Serial Ports DSPs normally have internal serial ports for high-speed communication with other DSPs and data converters. These serial ports are directly connected to the internal buses to improve performance, to reduce external address decoding problems, and to reduce cost. Memory Memory holds information, data, and instructions for DSPs and is an essential part of any DSP system. Although DSPs are intelligent machines, they still need to be told what to do. Memory devices hold a series of instructions that tell the DSP which operations to perform on the data (i.e., information). In many cases, the DSP reads some data, operates on it, and writes it back. Almost all DSP systems have some type of memory device, 7

whether it is on-chip memory or off-chip memory; however, on-chip memory operates faster. A/D and D/A Converters Converters provide the translator function for the DSP. Since the DSP can only operate on digital data, analogue signals from the outside world must be converted to digital signals. When the DSP provides an output, it may need to be converted back to an analogue signal to be perceived by the outside world. Analogue-to-digital converters (ADCs) accept analogue input and turn it into digital data that consist of only 0s and 1s. Digital-to-analogue converters (DACs) perform the reverse process; they accept digital data and convert it to a continuous analogue signal. Ports Communication ports are necessary for a DSP system. Raw information is received and processed; then that information is transmitted to the outside world through these ports. For example, a DSP system could output information to a printer through a port. The most common ports are serial and parallel ports. A serial port accepts a serial (single) stream of data and converts it to the processor format. When the processor wishes to output serial data, the port accepts processor data and converts it to a serial stream (e.g., modem connections on PCs). A parallel port does the same job, except the output and input are in parallel (simultaneous) format. The most common example of a parallel port is a printer port on a PC. Practical Applications for DSP Systems Since their introduction to the market, DSPs have found a wide variety of applications. They are used in everyday hi-fi systems as well as high-end virtual-reality applications. Generally, DSP is not an expensive technology. Some practical DSP systems are: Hi-Fi Equipment Toys Videophones Modems Phone Systems 3D Graphics Systems Image Processing Systems Hi-Fi Equipment (Music Systems) DSPs are now being used in sound processors that can create the illusion of threedimensional sound or modify the acoustics of a room to give the illusion of very large rooms and auditoriums. The result is movie theatre quality sound in a home music system. Toys Today, DSP technology is integrated in children's toys. Talking toys are commonplace; by pressing the picture of a dog, children can hear it bark. They can also learn their alphabet by singing along with a teaching toy. This clearly demonstrates that DSP technology is not expensive. Videophones Videophones will affect the lives of people from all walks of life. They are quickly improving in quality. It is only a matter of time before prices drop and videophones 8

become widely used. DSPs are used for compression and decompression of images in videophones. There are several international standards for compressing moving images. Programmable DSPs are the perfect answer to evolving standards since this may only require a software update. Modems As the Internet continues to grow, so has the use of modems. To be able to handle the ever-increasing communications load, modems have become faster and more efficient. DSPs perform vital functions in modems such as modulating the digital bit stream into a signal compatible with a phone line, canceling line echoes, and compressing and decompressing data. Phone Systems These days, it is quite common to call a company and be answered by a machine that provides alternatives such as: Say 1 for sales, Say 2 for technical support, and so on. These phone systems use DSPs to perform the function of voice recognition. DSPs are also commonly used in the communications industry for the add-on features you can get from your telephone company like caller ID, voice messaging, and call back. 3D Graphics Systems Most flight simulators use 3D real-time graphics to enhance realism. To calculate the necessary details in three dimensions (and to be able to do this 30 times every second) requires very efficient and powerful processors. DSPs are now widely used in virtualreality applications. Image Processing Systems Personal handheld digital cameras are also now becoming widespread. DSPs are used to perform the conversion of charge-coupled device (CCD) chip analogue voltages (video) to compressed data, which is then stored digitally in constant storage EEPROM. The DSP also senses the buttons, controls exposure times, provides the CCD gate timing, and downloads images to the PC.

10

DSPs are also used extensively in image processing, such as robot vision, machine vision, image compression, and fingerprint recognition. A simple example of an imageprocessing application is the inspection of printed circuit boards. The system works by recording the image of a working board and comparing (subtracting) it to newly manufactured ones as they pass beneath a CCD camera. These systems also use the efficient multiply and add cycles in DSPs to perform two-dimensional filtering. Advantages of Digital Signal Processing Some applications require analogue designs, and some require digital designs. To process signals digitally, they must be converted from analogue to digital numbers. After a signal is processed, it is then often converted back to analogue form. Considering the overhead, digital processing must offer some clear advantages that include:

Programmability A single piece of digital DSP hardware can perform many functions. For example, a multimedia PC can play music and also function as a word processor if it is loaded with suitable programs. This ability to use the same hardware for many functions provides important flexibility. You can implement any new function you think of, as long as you can program it. Upgradability After a system has been designed and implemented, it may be required to upgrade or add new functions. With a digital system, this means modifying your code. With an analogue 11

system, this could involve obtaining and soldering in new components, or even a complete redesign. Flexibility A single DSP board can be made to perform many functions by simply loading new programs into it. A development board could be used as a music tune generator and as a low-pass filter by simply loading it with different software. This flexibility reduces design time and complexity. With analogue circuits, a new circuit has to be designed for each new function.

Stability The stability of analogue circuits depends upon several factors. Analogue circuits are affected by temperature and aging, among other things. Also, two analogue systems using the same design and components may differ in performance. Temperature Analogue components such as resistors, capacitors, diodes, and operational amplifiers are affected by temperature, humidity, and aging. A temperature-sensitive analogue circuit may perform quite differently in the UK than in Egypt, where the temperatures are different. This could prove disastrous for a company that sells its products worldwide. Digital circuits do not gradually change their characteristics over time, temperature, or humidity. They either work or they dont work. In other words, digital circuits are repeatable as long as they are designed with enough tolerance to operate properly over the range of expected conditions. 12

Aging The effects of component aging can be detrimental to analogue circuits as characteristics and performance change. These effects can sometimes be anticipated, or their effect may not be critical. Analogue designers must be aware of these effects. Tolerances Components such as resistors and capacitors have tolerances. If a component tolerance is only accurate to within 10%, two apparently identical analogue circuits could perform differently enough to cause operational problems. This can make design, manufacturing, and support expensive.

Digital Repeatability A properly designed digital circuit will produce the same result every time, in addition to being identical from unit to unit. If the same multiplication is performed on 500 computers, all 500 computers should produce the same result. Component tolerances, aging, and temperature drifts also do not affect digital circuits nearly as much. A properly designed digital circuit will produce the same results in the UK as in Egypt, even when the temperatures are different. On the other hand, 500 analogue circuits could produce a range of results. In digital circuitry, logical 1s and 0s are defined when an analogue voltage is above or below an analogue voltage threshold. For a digital circuit to be repeatable, the analogue voltage which represents the logical 1s and 0s needs to be sufficiently greater or less than the threshold so as not to be affected by circuit variations or noise. The only concern is that timing restrictions and maximum device ratings should not be exceeded. If proper digital inputs are not maintained, the 1s and 0s can be 13

corrupted, making a normally repeatable digital circuit suddenly fail. On the other hand, analogue circuit characteristics will tend to gradually drift. Digital accuracy is determined by the number of bits used and is guaranteed to remain the same. With analogue circuits, the number of bits is effectively infinite, but the effects of noise, tolerances, and linearity can rapidly diminish performance. A digital CD player consistently produces the same high-quality digital music and is primarily only limited by the analogue components that are still required. Analogue components in a CD player include the DAC, laser, laser pickup, read head actuator, spindle motor and headphones.

Compression Storage media such as hard disk drives and satellite communications links for telephone and video are examples where resources are limited in terms of the available size and bandwidths. More would be better, but installing additional hardware tends to be very expensive. In these cases, costs are passed on to the consumer in one way or another. An example would be the substantial cost difference between a 20-minute and a 2-minute phone call, especially if the call is long distance. Although the prices for installing more advanced hardware tend to be on a downward curve, our need for more information is on an even more aggressive upward curve. Data compression can be a valuable tool for providing adequate performance from available resources, and at a reasonable cost. Consider the example of a satellite link or transmission channel. If one megabyte of data is compressed down to half a megabyte and then transmitted, a decompressor can then recover the original data at the other end. 14

Considering that the transmission line is only aware that half a megabyte of data has been passed, the data channel bandwidth is effectively doubled. A DSP can compress raw binary data and signals through the use of appropriate software programs. Lossless compression programs are suitable for exact binary data transfers. On the other hand, programs designed for compressing speech and video offer much higher compression ratios but with some loss in signal quality. Analogue circuits can also be used for some very simple forms of lossless compression but offer very little flexibility. Adaptive Filters DSP systems have been developed that cancel some of the noise within cabins of cars, helicopters, and airplanes. The noises cancelled were those caused by engine vibrations. The noise cancellation systems used the engine speed as a reference and produced an anti-noise signal from speakers to cancel the cabin noise. Feedback from microphones in each headrest (or headphone) was used to adapt the characteristics of the anti-noise until the best possible noise reduction was achieved. The system then continued to adapt periodically to track changes in the cabin noise. A DSP system can easily adapt to some changes in environmental variables. An adaptive algorithm simply calculates the new parameters required and stores them back in main memory, overwriting the previous values. A very basic level of adaptation is possible in analogue systems, but the complete change of a complex set of filter characteristics (used in noise cancellation) is beyond the practical scope of analogue signal processing. A notch filter with a steep cut-off frequency would be one example of a filter that might be needed to implement noise cancellation. In this case, the DSP has the ability to recalculate suitable notches to remove the vibration noise as the engine RPM changes. It is virtually impossible to produce the many required tunable filters using analogue techniques alone. Linear Phase Filters There are some valuable signal processing techniques that are difficult or impossible to produce by analogue procedures. The classic example is that of a linear phase filter that is difficult to design in analogue and even then, over a limited bandwidth. With a digitally implemented filter, it is possible to keep the phase shift of each component frequency consistent with all other frequencies. This is possible by using a finite impulse response (FIR) filter. This term will be explained later. The Program The DSP chip is a piece of hardware that cannot function without the intelligence of a program. A program is a series of instructions that perform certain functions. In our demonstrations, we will see some examples of programming to compose simple musical tunes. To write these programs, we must use the tools of the trade.

15

Assemblers Assemblers generate machine-level code from text instructions. Let us assume we were given the following two lines to remember: ADD A, B 111000100101010001001 Since humans understand written words better than a series of 1s and 0s, it is evident which line is easier to understand and remember. Assemblers take our text instructions and convert them into machine language. This relieves us of the burden of having to remember binary instructions for DSP. High-Level Language High-level languages are like assembly languages, but much friendlier. Assembly languages have very basic instructions, such as multiply, add, and compare. High-level languages have higher-level instructions, such as print, and repeat until equal to zero. Therefore, it is easier to write programs in high-level languages. While it is easier to write in high-level languages, assembly language can produce programs that are able to execute faster. For this reason, both have their uses in DSPs. Sometimes it is necessary to write time-critical sections of a program in assembly. A complete program may have sections of code in assembly and sections in a high-level language. It is easy to combine both types of code into a single executable program. 16

Assembly and high-level programming languages make it possible to program DSPs to perform a variety of functions. Simulators Flight simulators make you feel as if you are in the cockpit of a plane without the cost of an actual airplane, fuel, or risk of crashing. Likewise, a DSP simulator is a software implementation of a DSP chip. A simulator typically runs on a computer (PC or workstation), simulating almost all of the functionality of the DSP. They are used to analyse the feasibility of designs before the designs are committed to hardware. They are also very useful in determining whether or not a particular design will work. Emulators An emulator allows us to directly control and debug the results of instructions executing on the DSP. Modern emulators do not replace the DSP chip on the board but exert their control through a serial emulation scan path. Using these devices, it is possible to see all of the internal changes in the device at each step. Developers can execute the instructions one step at a time, check voltage levels for correct operation, and check each result in their own time. Emulators are invaluable tools in development environments. Debugger A debugger interface is used to display program execution information in a useable format for the programmer. The data displayed in the debugger windows is essentially a formatted data print of the contents of the DSP memory. This memory is simply loaded into the PC using either an emulator or a communications link with the PC using appropriate software. For example, the memory window can display (and edit) data in hexadecimal, float or integer formats, but the data is nonetheless binary 1s and 0s to the DSP. Likewise, the disassembly window is simply a reformatting of the binary value into a recognizable alphanumeric mnemonic. The CPU register window is a little different in that the C54x register values are not directly accessible as memory data because they are not memory mapped registers. For the scan emulator, this job is quite easy since the scan path simply routes through the internal registers of the DSP. For the DSK, this task is accomplished using a special program that saves and restores the CPU registers from the DSP main memory. Other than this, the data displayed in the CPU register window is simply another data form. Debuggers consist of a user interface on the host PC computer, which can control and modify the contents and execution of the chip. The user interface displays the contents of RAM, registers, and the disassembly of the currently loaded program. The major advantage of debuggers over simulators is that they operate in real time, allowing the designer to assess the performance of the system in a real-time environment. Development Cycle After the feasibility of the design is established through simulation, program design can begin. First, the software is designed. This stage determines the complexity and the modules of the code. The modules of software are written and tested, and then the full system is put together and tested. If everything works as required, the result is version 1.0 of the product on the market. If it does not work as required, the process is repeated until it does. When new requirements and improvements emerge as a result of user feedback, a new version is produced via the same process. 17

Fixed-Point Notation Fixed-point notation, sometimes called fractional-point notation or Q format, uses an implied binary point to represent binary fractions. This point always remains at a fixed location. The dynamic range of a processor is the range between the smallest and the largest number it can represent. When the dynamic range is limited, In a 16-bit processor, the dynamic range is 32767 to 32768. Such a small dynamic range can easily create overflows. For example, 200 350 = 70000, which is an overflow! However, if the number range is limited, or more precisely scaled, to +1 to 1, a multiplication could never produce an overflow. For example, the multiplication of two fractional numbers within the range of 1 to 1 must always produce a result that is also a fraction. The result is therefore confined to be within the range of 1 to 1. Unfortunately, successive additions can produce overflow values outside the range of 1 to 1. This point should be remembered when performing fixed-point arithmetic. Signal processing is both multiplication and addition intensive. An overflow can have serious consequences, (e.g., unintentionally clipping a large signal). A fixed-point system can solve this problem by either checking for overflows after each math operation, or by knowing that the inputs and outputs of the operation are input bounded or well behaved.

18

You might also like