INTRODUCTION TO Microprocessors Dr. Hugh Blanton ENTC 4337/5337 Objectives • Build intuition for signal processing concepts • Translate signal processing concepts into real-time digital communications software in laboratory Dr. Blanton - ENTC 4337 - Introduction 2 General Information • Contact Information • Email—blanton@etsu.edu • Phone—(423) 439-4177 • Web Page • http://faculty.etsu.edu/blanton • Office Hours • MWF—10:15-11:45 Dr. Blanton - ENTC 4337 - Introduction 3 Grading • Calculation of numeric grades • • • • 15% midterm #1 25% final #2 (semi-cumulative) 20% homework 50% laboratory Dr. Blanton - ENTC 4337 - Introduction 4 • Laboratory component • Students work in teams of two on lab assignments/reports • Assign team members same lab report grade and then apply individual deductions for attendance/participation • Lowest lab report dropped Dr. Blanton - ENTC 4337 - Introduction 5 Academic Integrity • Homework/Exam assignments • Discuss homework/exam questions with others • Be sure to submit your own independent solution • Turning in two identical (or nearly identical) homework sets is considered academic dishonesty Dr. Blanton - ENTC 4337 - Introduction 6 • Laboratory reports • Should only contain work of those named on report • If any other work is included, then reference source • Copying information from another source without giving proper reference and quotation is plagiarism • Source code must be original work Dr. Blanton - ENTC 4337 - Introduction 7 Topics • The TMS320C6X (1 week) • Programming (4 weeks) •C • Code Composer • Assembly Language • Hardware (4 weeks) • architecture Dr. Blanton - ENTC 4337 - Introduction 8 • Applications • FIR Filters • IIR Filters • Fast Fourier Transforms Dr. Blanton - ENTC 4337 - Introduction 9 TMS320C6x Manuals • You need to refer to various TMS320C6000 manuals, which are only available electronically: • Code Composer User’s Guide • http://focus.ti.com/lit/ug/spru301c/spru301c.pdf • Optimizing C Compiler • http://www-s.ti.com/sc/psheets/spru187k/spru187k.pdf • Programmer’s Guide • http://www-s.ti.com/sc/psheets/spru198g/spru198g.pdf • CPU and Instruction Set Reference Guide • http://www-s.ti.com/sc/psheets/spru189f/spru189f.pdf Dr. Blanton - ENTC 4337 - Introduction 10 Microprocessors • General-purpose processors or microcontrollers (GPPs/MCUs for short) are either • not specialized for a specific kind of applications (in the case of generalpurpose processors), or • they are designed for control-oriented applications (in the case of microcontrollers). Dr. Blanton - ENTC 4337 - Introduction 11 Digital Signal Processors • DSP processors have features designed to support high-performance, repetitive, numerically intensive tasks. • Mostly designed with the same few basic operations in mind • They share the same set of basic characteristics • These characteristics fall into three categories: • specialized high speed arithmetic • data transfer to and from the real world • multiple access memory architecture Dr. Blanton - ENTC 4337 - Introduction 12 DSP Features • Features that accelerate performance in DSP applications include: • Single-cycle multiply-accumulate (MAC) capability; • high-performance DSPs often have two multipliers that enable two multiply-accumulate operations per instruction cycle; • some DSP have four or more multipliers • Specialized addressing modes, for example, • pre- and post-modification of address pointers, • circular addressing, and • bit-reversed addressing Dr. Blanton - ENTC 4337 - Introduction 13 DSP Features • Most DSPs provide various configurations of on-chip memory and peripherals tailored for DSP applications. • DSPs generally feature multiple-access memory architectures that enable DSPs to complete several accesses to memory in a single instruction cycle • Specialized execution control. • Usually, DSP processors provide a loop instruction that allows tight loops to be repeated without spending any instruction cycles • for updating and testing the loop counter or • for jumping back to the top of the loop Dr. Blanton - ENTC 4337 - Introduction 14 DSP Features • DSP processors are known for their irregular instruction sets, which generally allow several operations to be encoded in a single instruction. • For example, a processor that uses 32-bit instructions may encode • two additions, • two multiplications, and • four 16-bit data moves into a single instruction. • In general, DSP processor instruction sets allow a data move to be performed in parallel with an arithmetic operation. • GPPs/MCUs, in contrast, usually specify a single operation per instruction Dr. Blanton - ENTC 4337 - Introduction 15 DSP Features • It is worth noting that the difference between DSPs and GPPs/MCUs is fading: • many GPPs/MCUs now include DSP features, and DSPs are increasingly adding microcontroller features. Dr. Blanton - ENTC 4337 - Introduction 16 What is a DSP? • Digital Signal Processors (DSP) process digital signals • An alternative method to process analog world signals ADC DSP DAC • Once the signal is in digital form, the DSP can easily process it • After the DSP has processed the signal, the output signal must be converted back to analog so that we can sense it. Dr. Blanton - ENTC 4337 - Introduction 17 Why DSP? • Advantages of digital signal processing • Programmability—one hardware does many tasks • Flexibility and upgradeability—develop a new code • Repeatability—A CD player always plays the same music quality • Advantages of analog signal processing • low cost in some applications—attenuators, amplifiers • wide bandwidth (GHz) • Infinite resolution (no quantization error) and low signal levels Dr. Blanton - ENTC 4337 - Introduction 18 The DSP System • DSP chip • Arithmetic Logic Unit (ALU) • TMS320C6X Memory • Memory • Converters • Analog-to-Digital ADC DSP DAC • Digital-to-Analog • Communication Ports • Serial Ports • Parallel Dr. Blanton - ENTC 4337 - Introduction 19 Review: Signals • Continuous-time (analog) signals are functions of a real argument • x(t) where t can take any real value • Discrete-time (digital) signals are functions of an argument that takes values from a discrete set x[n] • n {...-3,-2,-1,0,1,2,3...} • Integer index n instead of time t for discrete-time systems • Value for x may be real or complex Dr. Blanton - ENTC 4337 - Introduction 20 Analog and Digital Signals • Amplitude of an analog signal can take any real or complex value at each time (sample) • Amplitude of a digital signal takes values from a discrete set 1 1 Dr. Blanton - ENTC 4337 - Introduction 21 Analog and Digital Signals • A system is a transformation from one signal (called the input) to another signal (called the output or the response). • Continuous-time systems with input signal x and output signal y (a.k.a., the response): • y (t ) x(t ) x(t 1) • y (t ) x 2 (t ) • Discrete-time system examples • y[n] x[n] x[n 1] 2 • y[n] x [n] Dr. Blanton - ENTC 4337 - Introduction 22 Audio Compact Discs • Human hearing is from about 20 Hz to 20 kHz • Sampling theorem: sample analog signal at a rate of more than twice the highest analog frequency • Apply a lowpass filter to pass frequencies up to 20 kHz; • e.g. a coffee filter water (small particles) through a coffee filter but not coffee grounds (large particles) • Lowpass filter needs 10% of maximum passband frequency to roll off to zero (2 kHz rolloff in this case). • Sampling at 44.1 kHz captures analog frequencies that are less than 22.05 kHz Dr. Blanton - ENTC 4337 - Introduction 23 Signal Processing Systems • Speech synthesis and speech recognition • Audio CD players • Audio compression (MP3, AC3) • Image compression (JPEG, JPEG 2000) • Optical character recognition • Video CDs (MPEG 1) • DVD, digital cable, and HDTV (MPEG 2) • Wireless video (MPEG 4/H.263) Dr. Blanton - ENTC 4337 - Introduction 24 Communication Systems • Voiceband Dialup/Fax modems • Digital subscriber line (DSL) modems • ISDN: 144 kilobits per second (kbps) • Business/symmetric: HDSL and HDSL2 • Home/symmetric: ADSL and VDSL • Cable modems • Cell phones • First generation (1G): AMPS • Second generation (2G): GSM, IS-95 (CDMA) • Third generation (3G): cdma2000, WCDMA Dr. Blanton - ENTC 4337 - Introduction 25 DSP Architectures • Multiply-Add-Accumulate (MAC) instruction • Most common operation in DSP, • A=B*C+D • Typically 70 clock cycles with ordinary processors • Single instruction cycle • Havard architecture • Separate data memory/bus and program memory/bus • Multiple memory accesses per instruction cycle • Modified von Neuman architecture • multiple memory accesses per instruction cycle by the simple trick of running the memory clock faster than the instruction cycle. Dr. Blanton - ENTC 4337 - Introduction 26 DSP Architectures • Deterministic interrupt service routine latency • Special addressing modes supported in hardware • Modulo addressing for circular buffers (e.g. FIR filters) • Bit-reversed addressing (e.g. fast Fourier transforms) • DSP needs a program that is a series of instructions that perform certain functions. Dr. Blanton - ENTC 4337 - Introduction 27 Digital vs Analog Digital Signal Processing Advantages Limitations • Often easier system upgrade. • A/D & signal processors speed: wide-band signals still difficult to treat (real-time systems). • Data easily stored. • Finite word-length effect. • Better control over accuracy requirements. • Obsolescence (analog electronics has it, too!). • More flexible. • Reproducibility. Dr. Blanton - ENTC 4337 - Introduction 28 Impact of DSP on Modern Living Cellular/mobile telephony Speech and channel coding Voice and data processing Power management Multipath equaliztion Automotive Digital Audio Digital Radio Personal communication systems Active suspension Digital audio Stereo and surround sound Audio equalization and mixing Electronic music Medical electronics Critical/intensive care monitors Digital X-rays ECG analyzers Cardiac monitors Medical imaging Personal computer Sound cards Data storage and retrieval Error correction/concealment Multimedia Modems Dr. Blanton - ENTC 4337 - Introduction 29 Analog & digital signals Analog Digital Discrete function Vk of discrete sampling variable tk, with k = integer: Vk = V(tk). 0.3 0.3 0.2 0.2 Voltage [V] Voltage [V] Continuous function V of continuous variable t (time, space etc) : V(t). 0.1 0 -0.1 -0.2 0.1 0 ts ts -0.1 -0.2 0 2 4 6 time [ms] 8 10 0 6 8 2 4 sampling time, tk [ms] Uniform (periodic) sampling. Sampling frequency fS = 1/ tS Dr. Blanton - ENTC 4337 - Introduction 30 10 DSP: aim & tools Applications • Predicting a system’s output. • Implementing a certain processing task. • Studying a certain signal. • General purpose processors (GPP), -controllers. Hardware Software • Digital Signal Processors (DSP). Fast • Programmable logic ( PLD, FPGA ). Faster real-time DSPing • Programming languages: Pascal, C / C++ ... • “High level” languages: Matlab, Mathcad, Mathematica… • Dedicated tools (ex: filter design s/w packages). Dr. Blanton - ENTC 4337 - Introduction 31