SlideShare a Scribd company logo
Real Time Digital Signal Processing
Implementations Applications And Experiments
With The Tms320c55x Sen M Kuo download
https://ebookbell.com/product/real-time-digital-signal-
processing-implementations-applications-and-experiments-with-the-
tms320c55x-sen-m-kuo-4311340
Explore and download more ebooks at ebookbell.com
Here are some recommended products that we believe you will be
interested in. You can click the link to download.
Realtime Digital Signal Processing Implementations And Applications
2nd Edition Sen M Kuo
https://ebookbell.com/product/realtime-digital-signal-processing-
implementations-and-applications-2nd-edition-sen-m-kuo-33786762
Realtime Digital Signal Processing Fundamentals Implementations And
Applications 3rd Sen M Kuo
https://ebookbell.com/product/realtime-digital-signal-processing-
fundamentals-implementations-and-applications-3rd-sen-m-kuo-5331202
Realtime Digital Signal Processing From Matlab To C With The Tms320c6x
Dsps 2nd Ed Wright
https://ebookbell.com/product/realtime-digital-signal-processing-from-
matlab-to-c-with-the-tms320c6x-dsps-2nd-ed-wright-5145054
Realtime Digital Signal Processing Based On The Tms320c6000 Nasser
Kehtarnavaz
https://ebookbell.com/product/realtime-digital-signal-processing-
based-on-the-tms320c6000-nasser-kehtarnavaz-992478
Realtime Digital Signal Processing From Matlab To C With The Tms320c6x
Dsps Third Edition 3rd Ed Morrow
https://ebookbell.com/product/realtime-digital-signal-processing-from-
matlab-to-c-with-the-tms320c6x-dsps-third-edition-3rd-ed-
morrow-9954322
Realtime Digital Signal Processing From Matlab To C With The Tms320c6x
Dsk Welch
https://ebookbell.com/product/realtime-digital-signal-processing-from-
matlab-to-c-with-the-tms320c6x-dsk-welch-9955500
Realtime Digital Signal Processing From Matlab To C With The Tms320c6x
Dsps Third Edition 3rd Edition Michael G Morrow Cameron Hg Wright Thad
B Welch Michael G Morrow
https://ebookbell.com/product/realtime-digital-signal-processing-from-
matlab-to-c-with-the-tms320c6x-dsps-third-edition-3rd-edition-michael-
g-morrow-cameron-hg-wright-thad-b-welch-michael-g-morrow-7384218
Architecting Highperformance Embedded Systems Design And Build
Highperformance Realtime Digital Systems Based On Fpgas And Custom
Circuits Ledin
https://ebookbell.com/product/architecting-highperformance-embedded-
systems-design-and-build-highperformance-realtime-digital-systems-
based-on-fpgas-and-custom-circuits-ledin-34810328
Indigeneity In Real Time The Digital Making Of Oaxacalifornia Ingrid
Kummels
https://ebookbell.com/product/indigeneity-in-real-time-the-digital-
making-of-oaxacalifornia-ingrid-kummels-51199030
Real Time Digital Signal Processing Implementations Applications And Experiments With The Tms320c55x Sen M Kuo
Real-Time
Digital Signal Processing
Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee
Copyright # 2001 John Wiley & Sons Ltd
ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
Real-Time
Digital Signal Processing
Implementations, Applications, and
Experiments with the TMS320C55X
Sen M Kuo
Northern Illinois University, DeKalb, Illinois, USA
Bob H Lee
Texas Instruments, Inc., Schaumburg, Illinois, USA
JOHN WILEY & SONS, LTD.
Chichester  New York  Weinheim  Brisbane  Singapore  Toronto
Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee
Copyright # 2001 John Wiley  Sons Ltd
ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
Copyright # 2001 by John Wiley  Sons, Ltd
Baffins Lane, Chichester,
West Sussex, PO 19 1UD, England
National 01243 779777
International (‡44) 1243 779777
e-mail (for orders and customer service enquiries): cs-books@wiley.co.uk
Visit our Home Page on http://www.wiley.co.uk
or
http://www.wiley.com
All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in
any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except under the
terms of the Copyright Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright
Licensing Agency, 90 Tottenham Court Road, London, W1P 9HE, UK, without the permission in writing of the
Publisher, with the exception of any material supplied specifically for the purpose of being entered and executed on a
computer system, for exclusive use by the purchaser of the publication.
Neither the authors nor John Wiley  Sons Ltd accept any responsibility or liability for loss or damage occasioned to
any person or property through using the material, instructions, methods or ideas contained herein, or acting or
refraining from acting as a result of such use. The authors and Publisher expressly disclaim all implied warranties,
including merchantability of fitness for any particular purpose. There will be no duty on the authors or Publisher to
correct any errors or defects in the software.
Designations used by companies to distinguish their products are often claimed as trademarks. In all instances where
John Wiley  Sons is aware of a claim, the product names appear in initial capital or capital letters. Readers,
however, should contact the appropriate companies for more complete information regarding trademarks and
registration.
Other Wiley Editorial Offices
John Wiley  Sons, Inc., 605 Third Avenue,
New York, NY 10158±0012, USA
Wiley-VCH Verlag GmbH
Pappelallee 3, D-69469 Weinheim, Germany
Jacaranda Wiley Ltd, 33 Park Road, Milton,
Queensland 4064, Australia
John Wiley  Sons (Canada) Ltd, 22 Worcester Road
Rexdale, Ontario, M9W 1L1, Canada
John Wiley  Sons (Asia) Pte Ltd, 2 Clementi Loop #02±01,
Jin Xing Distripark, Singapore 129809
Library of Congress Cataloging-in-Publication Data
Kuo, Sen M. (Sen-Maw)
Real-time digital signal processing: implementations, applications, and experiments
with the TMS320C55x / Sen M. Kuo, Bob H. Lee
p. cm.
Includes bibliographical references and index.
ISBN 0±470±84137±0
1. Signal processingÐDigital techniques. 2. Texas Instruments TMS320 series
microprocessors. I. Lee, Bob H. II. Title.
TK5102.9 .K86 2001
621.3820
2Ðdc21 2001026651
British Library Cataloguing in Publication Data
A catalogue record for this book is available from the British Library
ISBN 0 470 84137 0
Typeset by Kolam Information Services Pvt. Ltd, Pondicherry, India
Printed and bound in Great Britain by Antony Rowe Ltd
This book is printed on acid-free paper responsibly manufactured from sustainable forestry,
in which at least two trees are planted for each one used for paper production.
Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee
Copyright # 2001 John Wiley  Sons Ltd
ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
To my wife Paolien, and children Jennifer, Kevin,
and Kathleen.
± Sen M. Kuo
To my dear wife Vikki and daughter Jenni.
± Bob H. Lee
Contents
Preface xv
1 Introduction to Real-Time Digital Signal Processing 1
1.1 Basic Elements of Real-Time DSP Systems 2
1.2 Input and Output Channels 3
1.2.1 Input Signal Conditioning 3
1.2.2 A/D Conversion 4
1.2.3 Sampling 5
1.2.4 Quantizing and Encoding 7
1.2.5 D/A Conversion 9
1.2.6 Input/Output Devices 9
1.3 DSP Hardware 11
1.3.1 DSP Hardware Options 11
1.3.2 Fixed- and Floating-Point Devices 13
1.3.3 Real-Time Constraints 14
1.4 DSP System Design 14
1.4.1 Algorithm Development 14
1.4.2 Selection of DSP Chips 16
1.4.3 Software Development 17
1.4.4 High-Level Software Development Tools 18
1.5 Experiments Using Code Composer Studio 19
1.5.1 Experiment 1A ± Using the CCS and the TMS320C55x Simulator 20
1.5.2 Experiment 1B ± Debugging Program on the CCS 25
1.5.3 Experiment 1C ± File Input and Output 28
1.5.4 Experiment 1D ± Code Efficiency Analysis 29
1.5.5 Experiment 1E ± General Extension Language 32
References 33
Exercises 33
2 Introduction to TMS320C55x Digital Signal Processor 35
2.1 Introduction 35
2.2 TMS320C55x Architecture 36
2.2.1 TMS320C55x Architecture Overview 36
2.2.2 TMS320C55x Buses 39
2.2.3 TMS320C55x Memory Map 40
Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee
Copyright # 2001 John Wiley  Sons Ltd
ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
2.3 Software Development Tools 40
2.3.1 C Compiler 42
2.3.2 Assembler 44
2.3.3 Linker 46
2.3.4 Code Composer Studio 48
2.3.5 Assembly Statement Syntax 49
2.4 TMS320C55x Addressing Modes 50
2.4.1 Direct Addressing Mode 52
2.4.2 Indirect Addressing Mode 53
2.4.3 Absolute Addressing Mode 56
2.4.4 Memory-Mapped Register Addressing Mode 56
2.4.5 Register Bits Addressing Mode 57
2.4.6 Circular Addressing Mode 58
2.5 Pipeline and Parallelism 59
2.5.1 TMS320C55x Pipeline 59
2.5.2 Parallel Execution 60
2.6 TMS320C55x Instruction Set 63
2.6.1 Arithmetic Instructions 63
2.6.2 Logic and Bits Manipulation Instructions 64
2.6.3 Move Instruction 65
2.6.4 Program Flow Control Instructions 66
2.7 Mixed C and Assembly Language Programming 68
2.8 Experiments ± Assembly Programming Basics 70
2.8.1 Experiment 2A ± Interfacing C with Assembly Code 71
2.8.2 Experiment 2B ± Addressing Mode Experiments 72
References 75
Exercises 75
3 DSP Fundamentals and Implementation
Considerations 77
3.1 Digital Signals and Systems 77
3.1.1 Elementary Digital Signals 77
3.1.2 Block Diagram Representation of Digital Systems 79
3.1.3 Impulse Response of Digital Systems 83
3.2 Introduction to Digital Filters 83
3.2.1 FIR Filters and Power Estimators 84
3.2.2 Response of Linear Systems 87
3.2.3 IIR Filters 88
3.3 Introduction to Random Variables 90
3.3.1 Review of Probability and Random Variables 90
3.3.2 Operations on Random Variables 92
3.4 Fixed-Point Representation and Arithmetic 95
3.5 Quantization Errors 98
3.5.1 Input Quantization Noise 98
3.5.2 Coefficient Quantization Noise 101
3.5.3 Roundoff Noise 102
3.6 Overflow and Solutions 103
3.6.1 Saturation Arithmetic 103
3.6.2 Overflow Handling 104
3.6.3 Scaling of Signals 105
3.7 Implementation Procedure for Real-Time Applications 107
viii CONTENTS
3.8 Experiments of Fixed-Point Implementations 108
3.8.1 Experiment 3A ± Quantization of Sinusoidal Signals 109
3.8.2 Experiment 3B ± Quantization of Speech Signals 111
3.8.3 Experiment 3C ± Overflow and Saturation Arithmetic 112
3.8.4 Experiment 3D ± Quantization of Coefficients 115
3.8.5 Experiment 3E ± Synthesizing Sine Function 117
References 121
Exercises 122
4 Frequency Analysis 127
4.1 Fourier Series and Transform 127
4.1.1 Fourier Series 127
4.1.2 Fourier Transform 130
4.2 The z-Transforms 133
4.2.1 Definitions and Basic Properties 133
4.2.2 Inverse z-Transform 136
4.3 System Concepts 141
4.3.1 Transfer Functions 141
4.3.2 Digital Filters 143
4.3.3 Poles and Zeros 144
4.3.4 Frequency Responses 148
4.4 Discrete Fourier Transform 152
4.4.1 Discrete-Time Fourier Series and Transform 152
4.4.2 Aliasing and Folding 154
4.4.3 Discrete Fourier Transform 157
4.4.4 Fast Fourier Transform 159
4.5 Applications 160
4.5.1 Design of Simple Notch Filters 160
4.5.2 Analysis of Room Acoustics 162
4.6 Experiments Using the TMS320C55x 165
4.6.1 Experiment 4A ± Twiddle Factor Generation 167
4.6.2 Experiment 4B ± Complex Data Operation 169
4.6.3 Experiment 4C ± Implementation of DFT 171
4.6.4 Experiment 4D ± Experiment Using Assembly Routines 173
References 176
Exercises 176
5 Design and Implementation of FIR Filters 181
5.1 Introduction to Digital Filters 181
5.1.1 Filter Characteristics 182
5.1.2 Filter Types 183
5.1.3 Filter Specifications 185
5.2 FIR Filtering 189
5.2.1 Linear Convolution 189
5.2.2 Some Simple FIR Filters 192
5.2.3 Linear Phase FIR Filters 194
5.2.4 Realization of FIR Filters 198
5.3 Design of FIR Filters 201
5.3.1 Filter Design Procedure 201
5.3.2 Fourier Series Method 202
5.3.3 Gibbs Phenomenon 205
CONTENTS ix
5.3.4 Window Functions 208
5.3.5 Frequency Sampling Method 214
5.4 Design of FIR Filters Using MATLAB 219
5.5 Implementation Considerations 221
5.5.1 Software Implementations 221
5.5.2 Quantization Effects in FIR Filters 223
5.6 Experiments Using the TMS320C55x 225
5.6.1 Experiment 5A ± Implementation of Block FIR Filter 227
5.6.2 Experiment 5B ± Implementation of Symmetric FIR Filter 230
5.6.3 Experiment 5C ± Implementation of FIR Filter Using Dual-MAC 233
References 235
Exercises 236
6 Design and Implementation of IIR Filters 241
6.1 Laplace Transform 241
6.1.1 Introduction to the Laplace Transform 241
6.1.2 Relationships between the Laplace and z-Transforms 245
6.1.3 Mapping Properties 246
6.2 Analog Filters 247
6.2.1 Introduction to Analog Filters 248
6.2.2 Characteristics of Analog Filters 249
6.2.3 Frequency Transforms 253
6.3 Design of IIR Filters 255
6.3.1 Review of IIR Filters 255
6.3.2 Impulse-Invariant Method 256
6.3.3 Bilinear Transform 259
6.3.4 Filter Design Using Bilinear Transform 261
6.4 Realization of IIR Filters 263
6.4.1 Direct Forms 263
6.4.2 Cascade Form 266
6.4.3 Parallel Form 268
6.4.4 Realization Using MATLAB 269
6.5 Design of IIR Filters Using MATLAB 271
6.6 Implementation Considerations 273
6.6.1 Stability 274
6.6.2 Finite-Precision Effects and Solutions 275
6.6.3 Software Implementations 279
6.6.4 Practical Applications 280
6.7 Software Developments and Experiments Using the TMS320C55x 284
6.7.1 Design of IIR Filter 285
6.7.2 Experiment 6A ± Floating-Point C Implementation 286
6.7.3 Experiment 6B ± Fixed-Point C Implementation Using Intrinsics 289
6.7.4 Experiment 6C ± Fixed-Point C Programming Considerations 292
6.7.5 Experiment 6D ± Assembly Language Implementations 295
References 297
Exercises 297
7 Fast Fourier Transform and Its Applications 303
7.1 Discrete Fourier Transform 303
7.1.1 Definitions 304
7.1.2 Important Properties of DFT 308
7.1.3 Circular Convolution 311
x CONTENTS
7.2 Fast Fourier Transforms 314
7.2.1 Decimation-in-Time 315
7.2.2 Decimation-in-Frequency 319
7.2.3 Inverse Fast Fourier Transform 320
7.2.4 MATLAB Implementations 321
7.3 Applications 322
7.3.1 Spectrum Estimation and Analysis 322
7.3.2 Spectral Leakage and Resolution 324
7.3.3 Power Density Spectrum 328
7.3.4 Fast Convolution 330
7.3.5 Spectrogram 332
7.4 Implementation Considerations 333
7.4.1 Computational Issues 334
7.4.2 Finite-Precision Effects 334
7.5 Experiments Using the TMS320C55x 336
7.5.1 Experiment 7A ± Radix-2 Complex FFT 336
7.5.2 Experiment 7B ± Radix-2 Complex FFT Using Assembly Language 341
7.5.3 Experiment 7C ± FFT and IFFT 344
7.5.4 Experiment 7D ± Fast Convolution 344
References 346
Exercises 347
8 Adaptive Filtering 351
8.1 Introduction to Random Processes 351
8.1.1 Correlation Functions 352
8.1.2 Frequency-Domain Representations 356
8.2 Adaptive Filters 359
8.2.1 Introduction to Adaptive Filtering 359
8.2.2 Performance Function 361
8.2.3 Method of Steepest Descent 365
8.2.4 The LMS Algorithm 366
8.3 Performance Analysis 367
8.3.1 Stability Constraint 367
8.3.2 Convergence Speed 368
8.3.3 Excess Mean-Square Error 369
8.4 Modified LMS Algorithms 370
8.4.1 Normalized LMS Algorithm 370
8.4.2 Leaky LMS Algorithm 371
8.5 Applications 372
8.5.1 Adaptive System Identification 372
8.5.2 Adaptive Linear Prediction 373
8.5.3 Adaptive Noise Cancellation 375
8.5.4 Adaptive Notch Filters 377
8.5.5 Adaptive Channel Equalization 379
8.6 Implementation Considerations 381
8.6.1 Computational Issues 381
8.6.2 Finite-Precision Effects 382
8.7 Experiments Using the TMS320C55x 385
8.7.1 Experiment 8A ± Adaptive System Identification 385
8.7.2 Experiment 8B ± Adaptive Predictor Using the Leaky LMS Algorithm 390
References 396
Exercises 396
CONTENTS xi
9 Practical DSP Applications in Communications 399
9.1 Sinewave Generators and Applications 399
9.1.1 Lookup-Table Method 400
9.1.2 Linear Chirp Signal 402
9.1.3 DTMF Tone Generator 403
9.2 Noise Generators and Applications 404
9.2.1 Linear Congruential Sequence Generator 404
9.2.2 Pseudo-Random Binary Sequence Generator 406
9.2.3 Comfort Noise in Communication Systems 408
9.2.4 Off-Line System Modeling 409
9.3 DTMF Tone Detection 410
9.3.1 Specifications 410
9.3.2 Goertzel Algorithm 411
9.3.3 Implementation Considerations 414
9.4 Adaptive Echo Cancellation 417
9.4.1 Line Echoes 417
9.4.2 Adaptive Echo Canceler 418
9.4.3 Practical Considerations 422
9.4.4 Double-Talk Effects and Solutions 423
9.4.5 Residual Echo Suppressor 425
9.5 Acoustic Echo Cancellation 426
9.5.1 Introduction 426
9.5.2 Acoustic Echo Canceler 427
9.5.3 Implementation Considerations 428
9.6 Speech Enhancement Techniques 429
9.6.1 Noise Reduction Techniques 429
9.6.2 Spectral Subtraction Techniques 431
9.6.3 Implementation Considerations 433
9.7 Projects Using the TMS320C55x 435
9.7.1 Project Suggestions 435
9.7.2 A Project Example ± Wireless Application 437
References 442
Appendix A Some Useful Formulas 445
A.1 Trigonometric Identities 445
A.2 Geometric Series 446
A.3 Complex Variables 447
A.4 Impulse Functions 449
A.5 Vector Concepts 449
A.6 Units of Power 450
Reference 451
Appendix B Introduction of MATLAB for DSP
Applications 453
B.1 Elementary Operations 453
B.1.1 Initializing Variables and Vectors 453
B.1.2 Graphics 455
B.1.3 Basic Operators 457
B.1.4 Files 459
B.2 Generation and Processing of Digital Signals 460
B.3 DSP Applications 463
B.4 User-Written Functions 465
xii CONTENTS
B.5 Summary of Useful MATLAB Functions 466
References 467
Appendix C Introduction of C Programming for DSP
Applications 469
C.1 A Simple C Program 470
C.1.1 Variables and Assignment Operators 472
C.1.2 Numeric Data Types and Conversion 473
C.1.3 Arrays 474
C.2 Arithmetic and Bitwise Operators 475
C.2.1 Arithmetic Operators 475
C.2.2 Bitwise Operators 476
C.3 An FIR Filter Program 476
C.3.1 Command-Line Arguments 477
C.3.2 Pointers 477
C.3.3 C Functions 478
C.3.4 Files and I/O Operations 480
C.4 Control Structures and Loops 481
C.4.1 Control Structures 481
C.4.2 Logical Operators 483
C.4.3 Loops 484
C.5 Data Types Used by the TMS320C55x 485
References 486
Appendix D About the Software 487
Index 489
CONTENTS xiii
Preface
Real-time digital signal processing (DSP) using general-purpose DSP processors is very
challenging work in today's engineering fields. It promises an effective way to design,
experiment, and implement a variety of signal processing algorithms for real-world
applications. With DSP penetrating into various applications, the demand for high-
performance digital signal processors has expanded rapidly in recent years. Many
industrial companies are currently engaged in real-time DSP research and development.
It becomes increasingly important for today's students and practicing engineers to
master not only the theory of DSP, but equally important, the skill of real-time DSP
system design and implementation techniques.
This book offers readers a hands-on approach to understanding real-time DSP
principles, system design and implementation considerations, real-world applications,
as well as many DSP experiments using MATLAB, C/C++, and the TMS320C55x. This
is a practical book about DSP and using digital signal processors for DSP applications.
This book is intended as a text for senior/graduate level college students with emphasis
on real-time DSP implementations and applications. This book can also serve as a
desktop reference for practicing engineer and embedded system programmer to learn
DSP concepts and to develop real-time DSP applications at work. We use a practical
approach that avoids a lot of theoretical derivations. Many useful DSP textbooks with
solid mathematical proofs are listed at the end of each chapter. To efficiently develop a
DSP system, the reader must understand DSP algorithms as well as basic DSP chip
architecture and programming. It is helpful to have several manuals and application
notes on the TMS320C55x from Texas Instruments at http://www.ti.com.
The DSP processor we will use as an example in this book is the TMS320C55x, the
newest 16-bit fixed-point DSP processor from Texas Instruments. To effectively illustrate
real-time DSP concepts and applications, MATLAB will be introduced for analysis and
filter design, C will be used for implementing DSP algorithms, and Code Composer
Studio (CCS) of the TMS320C55x are integrated into lab experiments, projects, and
applications. To efficiently utilize the advanced DSP architecture for fast software
development and maintenance, the mixing of C and assembly programs are emphasized.
Chapter 1 reviews the fundamentals of real-time DSP functional blocks, DSP hard-
ware options, fixed- and floating-point DSP devices, real-time constraints, algorithm
development, selection of DSP chips, and software development. In Chapter 2, we
introduce the architecture and assembly programming of the TMS320C55x. Chapter
3 presents some fundamental DSP concepts in time domain and practical considerations
for the implementation of digital filters and algorithms on DSP hardware. Readers who
are familiar with these DSP fundamentals should be able to skip through some of these
sections. However, most notations used throughout the book will be defined in this
chapter. In Chapter 4, the Fourier series, the Fourier transform, the z-transform, and
the discrete Fourier transforms are introduced. Frequency analysis is extremely helpful
Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee
Copyright # 2001 John Wiley  Sons Ltd
ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
in understanding the characteristics of both signals and systems. Chapter 5 is focused on
the design, implementation, and application of FIR filters; digital IIR filters are covered
in Chapter 6, and adaptive filters are presented in Chapter 8. The development,
implementation, and application of FFT algorithms are introduced in Chapter 7. In
Chapter 9, we introduce some selected DSP applications in communications that have
played an important role in the realization of the systems.
As with any book attempting to capture the state of the art at a given time, there will
necessarily be omissions that are necessitated by the rapidly evolving developments in
this dynamic field of exciting practical interest. We hope, at least, that this book will
serve as a guide for what has already come and as an inspiration for what will follow. To
aid teaching of the course a Solution Manual that presents detailed solutions to most of
the problems in the book is available from the publisher.
Availability of Software
The MATLAB, C, and assembly programs that implement many DSP examples and
applications are listed in the book. These programs along with many other programs
for DSP implementations and lab experiments are available in the software package
at http://www.ceet.niu.edu/faculty/kuo/books/rtdsp.html and http://pages.prodigy.net/
sunheel/web/dspweb.htm. Several real-world data files for some applications introduced
in the book also are included in the software package. The list of files in the software
package is given in Appendix D. It is not critical you have this software as you read the
book, but it will help you to gain insight into the implementation of DSP algorithms, and it
will be required for doing experiments at the last section of each chapter. Some of these
experiments involve minor modification of the example code. By examining, studying and
modifyingtheexamplecode,thesoftwarecanalsobeusedasaprototypeforotherpractical
applications.Everyattempthasbeenmadetoensurethecorrectnessofthecode.Wewould
appreciate readers bringing to our attention (kuo@ceet.niu.edu) any coding errors so that
we can correct and update the codes available in the software package on the web.
Acknowledgments
We are grateful to Maria Ho and Christina Peterson at Texas Instruments, and Naomi
Fernandes at Math Works, who provided the necessary support to write the book in a
shortperiod.ThefirstauthorthanksmanyofhisstudentswhohavetakenhisDSPcourses,
Senior Design Projects, and Master Thesis courses. He is indebted to Gene Frentz, Dr.
Qun S. Lin, and Dr. Panos Papamichalis of Texas Instruments, John Kronenburger of
Tellabs, and Santo LaMantia of Shure Brothers, for their support of DSP activities at
Northern Illinois University. He also thanks Jennifer Y. Kuo for the proofreading of the
book.Thesecondauthorwishestothank Robert DeNardo,DavidBaughman,andChuck
Brokish of Texas Instruments, for their valuable inputs, help, and encouragement during
the course of writing this book. We would like to thank Peter Mitchell, editor at Wiley, for
his support of this project. We also like to thank the staff at Wiley for the final preparation
of the book. Finally, we thank our parents and families for their endless love, encourage-
ment, and the understanding they have shown during the whole time.
Sen M. Kuo and Bob H. Lee
xvi PREFACE
Index
R2's complement, 96, 103, 118
3-dB bandwidth, 188, 281
3-dB cut-off frequency, 249±50
60 Hz hum, 6, 184
6-dB signal-to-quantization-noise gain, 8, 100,
105
accumulator (AC0±AC3), 27, 38, 57, 62, 97, 169,
382
acoustic
echo, 427
echo cancellation, 163, 409, 417, 426, 427
echo path, 427
active noise control system, 373
adaptive
algorithm, 351, 360, 368, 377, 385, 409, 420, 427
channel equalization, 379
echo cancellation, 417, 418, 419, 427
filter, 351, 359, 369, 419, 427
linear prediction (predictor), 373, 374, 390
noise cancellation (ANC), 375, 430
notch filter, 377
step size, 370, 371
system identification, 372, 373, 385
ADC, see analog-to-digital converter
adders, 80
address-data flow unit (AU), 36, 38, 174
addressing modes, 50
aliasing, 6, 156, 260, 401
allpass filter, 185
all-pole model (system), 163
all-zero model (system), 145, 163
amplitude spectrum, see magnitude spectrum
analog
filter, 181, 241, 247
interface chip (AIC), 10
signal, 1, 241
analog-to-digital converter (ADC), 3, 6, 8, 10, 100
anti-aliasing filter, 6, 9, 156
anti-imaging filter, 9
anti-resonances, 163
anti-symmetry
filter, 230
properties, 195
application specific integrated circuits (ASIC), 11,
437
arithmetic and logic unit (ALU), 36, 38, 39
arithmetic
error, 98, 382
instruction, 63
ASIC, see Application specific integrated circuits
ASCII (text) file, 18, 19
assembler directives, 44
assembly statement syntax, 49
autocorrelation, 352, 356, 361, 362
properties, 353
matrix, 361
autocovariance, 352
automatic gain controller (AGC), 4, 440
autopower spectrum, 356
auxiliary register (AR0±AR7), 36, 38, 62
averaging technique, 410
bandlimited, 5, 155, 259
bandpass filter, 184, 185, 254
bandstop (band-reject) filter, 185, 254
bandwidth, 2, 155, 188, 254
barrel shifter, 38
Bessel
filter, 253
function, 212
bilinear transform, 259
binary
file, 18
point, 95
bit manipulation instruction, 64
bit-reversal, 318, 343
Blackman window, 210
Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee
Copyright # 2001 John Wiley  Sons Ltd
ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
block
FIR filter, 225
processing, 198, 225, 331
block-repeat
counter, 168
instruction (RPTB), 168
breakpoint, 26
built-in parallel instruction, 60
bus contention, 232, 234
buses, 39
butterfly network (computation), 316, 317, 335
Butterworth filter, 249, 271
Cascade (series) form, 142, 199, 266, 269
Cauchy's integral (residue) theorem, 139
causal
filter, 182, 203
signal, 78, 134
system, 88
C compiler, 19, 42
CD player, 3, 9
center
clipper, 408, 425
frequency, 187, 254
central limit theorem, 95
channel
coding, 437
equalization, 359, 399, 441
characteristic equation, 150
Chebyshev
approximation, 118, 219
filter, 252, 271
circular
buffer, 200, 217
convolution, 311, 330
pointer, 400
shift, 310
circular addressing
mode, 36, 58, 227
buffer size registers (BK03, BK47, BKC), 58, 62
starting address registers (BSA01, BSA23,
BSA45, BSA67, BSAC), 58, 62
clipping threshold, 408, 425
coefficient
data pointer (CDP), 38
quantization, 101, 115, 223, 276
code composer studio (CCS), 19, 48
code conversion process, 41
code division multiple access (CDMA), 3, 353
code optimizer, 42
coder/decoder (CODEC), 10
comb filter, 192, 200, 216
combined parallel instruction, 61
comfort noise, 408, 431
common object file format (COFF), 41, 44
companding, 8
compiler optimization, 43, 294
complex
arithmetic, 380, 414, 448
LMS algorithm, 380
variable, 165, 447
complex-conjugate property, 153, 309
complexity, 2
continuous-time signal, 1
convergence, 366, 368
factor, see step size
speed, 368
convolution, 135, 330
sum, 87±8, 189
convolutional encoding, 438
correlation function, 94, 352
cosine and sine power series expansion, 117±18
CRC, see cyclic redundant check
critical frequencies, 257, 261
crosscorrelation, 352, 354, 361
vector, 361
crosscovariance, 352±3
cross-power spectrum, 357
crosstalk effect, 376
C-to-ASM interlister, 42
cumulative probability distribution function, 90
cutoff frequency, 6, 184
cyclic redundant check (CRC), 437, 440
DAC, see digital-to-analog converter
data
buses, 39
computation unit (DU), 36, 38, 174
generation unit (DAGEN), 60
page pointer (DP), 52
dBm, 451
DC
component, 128
offset, 6, 184
DCT, see discrete cosine transformation
debugger, 19, 25
decibel (dB), 450
decimation, 8
decimation-in-frequency, 315, 319
decimation-in-time, 315
decision-directed algorithm, 380
delay
equalizer, 185
property, 135
units, 81
delta function, 131, 207, 449
design of FIR filter, 201
deterministic signal, 77, 351
490 INDEX
DFT, see discrete Fourier transform
DFT matrix, 306
differentiator, 220
digital building block, 11, 12
digital
filter, 143, 181
filter design, 181
resonator, 150
signal, 1
signal processing (DSP), 1
signal processors (DSP chips), 11, 35
digital-to-analog converter (DAC), 3, 9
digit decoder, 416
digitization, 4
direct addressing mode, 52
direct form, 198, 263±4
discrete
cosine transformation (DCT), 436
Fourier transform, 152, 157, 171, 303, 308, 411
discrete-time
Fourier transform (DTFT), 153, 304, 356
frequency, 79
signal, 1, 5, 152, 245
system, 77
dispersive delay, 419
dot product, 73
double-talk, 423
detector, 423, 427, 429
DSP, see digital signal processing
chip selection, 16
hardware, 11
software development, 16
software development tool, 18
start kit (DSK), 48
system design, 14
DTMF (dual-tone multi-frequency)
frequencies, 411
tone detection, 410
tone generator, 403
dual slope, see analog-to-digital converter
echo
cancellation, 399
path, 417, 419, 421
return loss (ERL), 424
return loss enhancement (ERLE), 421
eigenvalue spread, 369
elementary digital signal, 77
elliptic filter, 253±54, 271
encoding process, 7
energy, 85, 416, 450
ensemble average, 352, also see expectation
operation
equalizer, 379
ergodic, 352, 355
error
coding, 437
contours, 363±64
surface, 363
Euler's
formula, 129
theorem, 446
evaluation module (EVM), 48, 49
even function, 128, 131, 149, 309, 353, 356
excess mean-square error (MSE), 369, 370, 383,
420, 429
excitation signal, 372, 419
expectation
operation, 92, 352
value, see mean
far-end, 418, 419
fast
convolution, 198, 330, 344
Fourier transform, 159, 314, 321, 336, 411
feedback coefficients, 144
feedforward coefficients, 144
FFT, see fast Fourier transform
file header format, 111±12
filter, 181
coefficients (weights or taps), 83
design procedure, 201
specifications, 185
finite impulse response, see FIR filter
finite precision (wordlength) effects, 107, 267, 334,
382
FIR filter, 83, 84, 89, 143, 144, 181, 189, 221, 227,
360
fixed-point, 13, 95, 223, 284
flash ADCs, see analog-to-digital converter
flat delay, 419
flexibility, 1
floating-point, 13, 223, 284
folding
frequency, see Nyquist frequency
phenomenon, 156
forced response, 147, 245
forward error correction (FEC), 437
Fourier
coefficient, 128, 152
series, 128, 152
series (window) method, 202
transform, 130, 132, 133, 153, 157, 158, 242
four-wire facility, 418
fractional number, 95, 97
frequency, 78, 127
offset test, 416
resolution, 159, 307, 322, 326
INDEX 491
frequency (cont.)
response, 148, 153
sampling method, 202, 214, 255
transform, 253
warping, 261
fundamental frequency, 129, 130, 156
G.165 (G.168), 422
gain, 4
Gaussian distribution function, 95
general extension language, 32
geometric series, 215, 446
Gibbs phenomenon, 205
Goertzel algorithm, 411
gradient, 365
estimate, 366
granulation noise, 100
group delay, 188, 196
guard bits, 106
half-wave rectification, 434
Hamming window, 209, 221
hands-free telephone, see speakerphone
Hann (Hanning) window, 209
Hanning filter, 198
harmonics, 128, 192
Harvard architecture, 12
highpass filter, 184, 249, 253, 254
Hilbert transformer, 185, 197, 220, 378
hybrid, 418, 427
loss, see echo return loss
ideal
filter, 183
oscillator, 129
sampler, 4, 5
system, 107
IDCT, see inverse discrete cosine transformation
IDFT, see inverse fast Fourier transform
IFFT, see inverse fast Fourier transform
IIR Filters, 88, 89, 143, 241, 255, 263, 271, 279,
360
image
coding, 399
recognition, 2
impedance, 248, 417
implementation procedure, 107
implied parallel instructions, 60
impulse
functions, 449
response, 83, 87, 202, 203, 255
train, 177, 245
impulse-invariant method, 255, 256
indirect addressing mode, 53
infinite impulse response, see IIR filters
in-circuit emulator (XDS), 48, 49
in-place FFT algorithms, 315
input
autocorrelation matrix, 361
channel, 3
quantization, 98, 277
signal conditioning, 3
vector, 360, 381
instantaneous
normalized frequency, 402
power, 424
squared error, 366
instruction
buffer queue (IBQ), 60, 341
buffer unit (IU), 36, 37
set, 63
interfacing C with assembly code, 71
interleave, 441
interpolation, 8, 401
filter, 198
interrupt, 174
service routine (ISR), 174
vector table, 174
intersymbol interference (ISI), 379
intrinsics, 289
inverse
discrete cosine transformation (IDCT), 436
discrete Fourier transform (IDFT), 153, 158,
306
fast Fourier transform (IFFT), 320
filter, 198
Fourier transform, 130
Laplace transform, 242
z-transform, 136
JPEG (Joint Photographic Experts Group), 1, 437
Kaiser window, 212
Kronecker delta function, 78
Laplace transform, 133, 241
leakage (or smearing), 208
factor, 371, 372
leaky LMS algorithm, 371, 382, 390
learning curve, 368
least-mean-square, see LMS algorithm
least significant bit (LSB), 8, 40, 96
limit cycle oscillation, 98
line
echo, 417
spectrum, 129
linear
chirp signal, 402, 409
492 INDEX
congruential method, 404
convolution, 87±8, 135, 189, 198, 243±4, 314,
330
interpolation, 401
phase, 188
phase filter, 183, 194
prediction, 373, 374
system, 87
time-invariant (LTI) system, 133
linearity (superposition), 134, 182, 308
linker, 46
command file, 23
LMS algorithm, 351, 366
logarithmic quantizer, 10
logic instructions, 64
long division, 136, 137
lookup-table method, 400, 403
loop unrolling, 228
lowpass filter, 184, 204, 249, 250
LPC, 165
MAC unit, see multiply-accumulate
magnitude, 447
bit, 95, 96, 382
distortion, 185
response, 148±9, 151, 154, 160, 164, 182
spectrum, 129, 130±31, 153±54, 308
test, 414
mainlobe, 207, 325
maintainability, 17
mapping properties, 246, 260, 261
marginally stable, 148, 245, 274
MATLAB (matrix laboratory), 2, 202, 453
basic Operators, 457
built-in function, 465
files, 459
functions, 466
graphics, 455
M-files, 459
Mat-files, 460
Mex-files, 460
script files, 459
user-written functions, 465
maximum-length sequence, 163
mean, 92
mean-square error (MSE), 361, 383
mean-squared value, 93, 353, 356
MEMORY directive, see linker
memory map, 40
memory-mapped register addressing mode, 56
memory mapped registers (MMRs), 40
microprocessor and microcontrollers (mP), 11
minimum
MSE, 362, 383
step size, 384
mixture of C and assembly programming, 68
MMR, see memory mapped registers
mnemonic assembly code, 42
modulo operation, 293, 404±5
most significant bit (MSB), 95
move instruction, 65
moving average filter, 84, 89, 145, 149, 193, 194
MPEG (Moving Picture Experts Group), 437
MSE, see mean-square error
surface, 363
time constant, 368±9
multipliers, 80
multiply±accumulate, 36, 227
multi-rate, 8
natural response, 147
near-end, 418
negative symmetry, see anti-symmetric
network echo, 417
noise
generators, 404
reduction, 399, 429
subtraction, 430
nonlinear phase, 194
non-causal filter, 182, 198, 203
non-parametric methods, 322
non-real-time DSP, 2
non-recursive filter, 89
non-uniform quantization, 8
normal distribution function, 95
normalized
digital frequency, 155
frequency, 79, 271
LMS algorithm, 368, 371, 428
step size, 371
notch filter, 160, 185, 377
Nyquist
frequency, 6, 156, 197
interval, 6
rate, 6
odd function, 128, 129, 131, 149, 309
off-line system modeling, 373, 409, 428
one-sided z-transform, 134
operand types, 51
optimum
filter, 362
step size, 383
weight vector, 362
oscillatory behavior, 205
output channel, 3
overflow, 103, 112
overlap-add, 332
INDEX 493
overlap-save, 331
oversampling, 6
overshoot, 182
parallel
connection, 141
converter, 9
execution, 60
form, 268
parallelism, 59
parametric equalizer, 283
parametric methods, 322
Park±McClellan algorithm, 202, 219
Parseval's theorem, 129, 131, 328
partial-fraction expansion, 137
passband, 183, 271
edge (cutoff) frequency, 185
ripple, 186
PDS, see power density spectrum
peak value, 85
performance
(or cost) function, 361
surface, 363
periodic signal, 127, 152, 153, 177, 304
periodicity, 305, 310
periodogram, 328
peripheral data-page pointer (PDP), 52
phase, 432±3, 447
distortion, 185
response (shift), 149, 154, 160, 182, 188
spectrum, 129, 131, 154, 188, 308
pipeline, 59
break down, 60
protection unit, 38
PN sequence, see pseudo-random number
polar form, 447
pole, 134, 144, 150, 163, 244, 251, 269, 276, 277
pole±zero
cancellation, 146, 147, 193, 216
plot (diagram), 134, 145, 147, 150
system (model), 145, 163, 165
polynomial approximation, 117, 249, 399
positive symmetric, see symmetric
power, 85, 93, 128, 129, 354, 356, 368, 450
density spectrum (PDS), 129, 131, 328, 356
estimator, 84, 147, 424
spectral density, see PDS
spectrum, see PDS
practical system, 107
prediction delay, 374
pre-warping, 261
probability, 90
density function, 91
probe point, 28
processing time, 381
profiler (profiling), 29
program
address generator, 57
counter (PC), 38, 174
execution pipeline, 59
fetch pipeline, 59
flow control instructions, 66
flow unit (PU), 36, 38
program-read address bus (PAB), 39
program-read data bus (PB), 39
Prony's method, 165
pseudo-random
binary sequence generator, 406
numbers (noise), 94, 404
Q format, 97, 118, 291, 296
quadrants, 118, 401
quadrature amplitude modulation (QAM), 380,
437
quadrature phase, 402
quality factor, 188
quantization, 4
effect, 223
errors (noise), 7, 98, 99, 100, 107, 223, 276, 278,
335, 401
process, 7, 99, 109, 111, 223
step (interval, width, resolution), 98
radix-2 FFT, 159, 336
raised cosine function, 209
random
number generation, 399, 404
process (signals), 78, 89, 351
variable, 90, 352
Rayleigh fading, 441
realization of IIR filter, 263
real-time
constraint, 14
emulator, 18
signal processing, 2, 381
reconstruction filter, 9, 10
rectangular
pulse train, 128
window, 207, 324, 327
recursive
oscillator, 281
power estimator, 147
region of convergence (ROC), 134
register, 95, 406
reliability, 2
Remez algorithm, 219
repeat operation, 36, 293
reproducibility, 2
494 INDEX
residual
echo, 420
echo suppressor, 408, 425
method, 139
noise reduction, 434
resonator (peaking) filter, 185, 217, 280
reverberation, 163, 426, 427
rise time, 182
room transfer function (RTF), 162, 165
roots, 244
of polynomials, 145, 146
rounding and saturation control logic, 38
rounding and truncation, 98
roundoff error (noise), 102, 267, 382, 383, 429
running averaging filter
see moving averaging filter
run-time support library, 24, 293
sample
autocorrelation function, 355
function, 245, 352
mean, 355
space, 90
variance, 355
sample and hold, 4
sampling
frequency (rate), 5, 6, 283, 330, 413
function, 4, 245
process, 4
theorem, 5, 6, 156
saturation arithmetic, 103, 112
scaling
factor, 106, 193, 224, 278, 382
signal, 105
Schur±Cohn stability test, 275
second harmonic test, 416
SECTION directive, see linker
serial converter, 9
settling time, 182
Shannon's sampling theorem, 5
sidelobes, 207, 325
sigma-delta ADC, see analog-to-digital converter
signal buffer, 199, 222, 227
signal-to-quantization-noise ratio, 7±8, 100
sign bit, 96, 382
simulator, 17, 48
sinc function, 204
sinewave
generation, 167, 226, 281, 399
table address increment, 400
single-repeat instruction (RPT), 168
sinusoidal
signal, 78
steady-state response, 245
sirens, 403
slicer, 380
smearing, 208, 325
smoothing filter, 9, 198
software development tools, 40
SP, see stack pointer
speakerphone, 426
spectral
dynamic range, 369
estimator, 433
leakage, 324
magnitude averaging, 433
resolution, 324
smearing, 326
subtraction, 375, 431
spectrogram, 332
spectrum, 131, 161, 309, 322, 325
speech
enhancement, 429
(source) coding, 375, 399, 437
recognition, 2, 375
square wave, 176
squared-magnitude response, 149
stability, 182, 274
condition, 148, 245, 274
constraint, 367, 369
triangle, 275
stack, 174
stack pointer (SP), 52
stalling, 384
standard deviation, 93
stationary, 369
statistical independence, 94
status registers, 57
steady-state response, 147, 154, 182, 188, 245
steepest descent, 365
step size, 365, 370, 383, 421, 429
stochastic gradient algorithm, see LMS algorithm
stochastic process, see random process
stopband, 183
edge frequency, 185
ripple (or attenuation), 186
subband acoustic echo canceler, 427
successive approximation, see analog-to-digital
converter
sum of products, 73
superposition, 182
switched capacitor filter, 9
symmetry, 195, 230, 305
synthesis equation, 158
synthesizes sine function, 117
system
gain, 149, 154
identification, 372
INDEX 495
system (cont.)
stack pointer (SSP), 175
tail delay, 420
talk-off, 411
tapped-delay-line, 84, 200
Taylor series expansion, 117
temporal, 352
temporary register (T0±T3), 38
time
average, 352
delay, 188, 353
shifting, 135
time-invariant filter (system), 181
time-quantization error, 401
TMS320C3x, 13
TMS320C55x, 13, 35
tolerance (or ripple) scheme, 185
tone generation and detection, 399, 403
tone-to-total energy test, 416
total harmonic distortion, 399
trace, 368
training
signal, 409
stage, 380, 409
transfer function, 141, 143, 189, 198, 244
transformer, 192
transient response, 147, 182, 191, 245
transition
band, 185, 187
discontinuity, 205
transversal filter, see FIR filter
trellis, 439
trigonometric
function, 399
identities, 445
truncation, 203, 205
twiddle
factor, 158, 165, 167, 305, 314, 334
matrix, 306
twist, 411
test, 415
two-sided z-transform, 134
two-wire facility, 418
uncorrelated, 94
uniform density function, 91, 92, 93
unit
circle, 133
delay, 81, 135
unit-impulse sequence, 78, 449
units of power, 450
unit-step sequence, 78
unstable condition, 148, 245
user-built parallel instruction, 61
variable watch, 20
variance, 93, 100
vector concept, 449
Viterbi decoding, 437, 439
voice activity detector (VAD), 430, 431
von Neumann architecture, 12
weight vector, 220, 361, 365, 366
white noise, 357, 409
wide-sense stationary (WSS), 353
window functions, 208, 326
wireless application, 437
wordlength, 2, 7, 96, 224
zero, 134, 144, 151, 163, 244
padding, 313, 326, 330
zero-mean, 92, 357
zero-order-hold, 9
zero-order modified Bessel function, 212
zero-overhead looping, 36, 227
z-plane, 133, 246
z-transform, 133, 136, 153, 246, 311, 356
496 INDEX
1
Introduction to Real-Time
Digital Signal Processing
Signals can be divided into three categories ± continuous-time (analog) signals,
discrete-time signals, and digital signals. The signals that we encounter daily are mostly
analog signals. These signals are defined continuously in time, have an infinite range
of amplitude values, and can be processed using electrical devices containing both
active and passive circuit elements. Discrete-time signals are defined only at a particular
set of time instances. Therefore they can be represented as a sequence of numbers that
have a continuous range of values. On the other hand, digital signals have discrete
values in both time and amplitude. In this book, we design and implement digital
systems for processing digital signals using digital hardware. However, the analysis
of such signals and systems usually uses discrete-time signals and systems for math-
ematical convenience. Therefore we use the term `discrete-time' and `digital' inter-
changeably.
Digital signal processing (DSP) is concerned with the digital representation of signals
and the use of digital hardware to analyze, modify, or extract information from these
signals. The rapid advancement in digital technology in recent years has created the
implementation of sophisticated DSP algorithms that make real-time tasks feasible. A
great deal of research has been conducted to develop DSP algorithms and applications.
DSP is now used not only in areas where analog methods were used previously, but also
in areas where applying analog techniques is difficult or impossible.
There are many advantages in using digital techniques for signal processing rather
than traditional analog devices (such as amplifiers, modulators, and filters). Some of the
advantages of a DSP system over analog circuitry are summarized as follows:
1. Flexibility. Functions of a DSP system can be easily modified and upgraded with
software that has implemented the specific algorithm for using the same hardware.
One can design a DSP system that can be programmed to perform a wide variety of
tasks by executing different software modules. For example, a digital camera may
be easily updated (reprogrammed) from using JPEG ( joint photographic experts
group) image processing to a higher quality JPEG2000 image without actually
changing the hardware. In an analog system, however, the whole circuit design
would need to be changed.
Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee
Copyright # 2001 John Wiley  Sons Ltd
ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
2. Reproducibility. The performance of a DSP system can be repeated precisely from
one unit to another. This is because the signal processing of DSP systems work
directly with binary sequences. Analog circuits will not perform as well from each
circuit, even if they are built following identical specifications, due to component
tolerances in analog components. In addition, by using DSP techniques, a digital
signal can be transferred or reproduced many times without degrading its signal
quality.
3. Reliability. The memory and logic of DSP hardware does not deteriorate with
age. Therefore the field performance of DSP systems will not drift with changing
environmental conditions or aged electronic components as their analog counter-
parts do. However, the data size (wordlength) determines the accuracy of a DSP
system. Thus the system performance might be different from the theoretical expect-
ation.
4. Complexity. Using DSP allows sophisticated applications such as speech or image
recognition to be implemented for lightweight and low power portable devices. This
is impractical using traditional analog techniques. Furthermore, there are some
important signal processing algorithms that rely on DSP, such as error correcting
codes, data transmission and storage, data compression, perfect linear phase filters,
etc., which can barely be performed by analog systems.
With the rapid evolution in semiconductor technology in the past several years, DSP
systems have a lower overall cost compared to analog systems. DSP algorithms can be
developed, analyzed, and simulated using high-level language and software tools such as
C=C‡‡ and MATLAB (matrix laboratory). The performance of the algorithms can be
verified using a low-cost general-purpose computer such as a personal computer (PC).
Therefore a DSP system is relatively easy to develop, analyze, simulate, and test.
There are limitations, however. For example, the bandwidth of a DSP system is
limited by the sampling rate and hardware peripherals. The initial design cost of a
DSP system may be expensive, especially when large bandwidth signals are involved.
For real-time applications, DSP algorithms are implemented using a fixed number of
bits, which results in a limited dynamic range and produces quantization and arithmetic
errors.
1.1 Basic Elements of Real-Time DSP Systems
There are two types of DSP applications ± non-real-time and real time. Non-real-time
signal processing involves manipulating signals that have already been collected and
digitized. This may or may not represent a current action and the need for the result
is not a function of real time. Real-time signal processing places stringent demands
on DSP hardware and software design to complete predefined tasks within a certain
time frame. This chapter reviews the fundamental functional blocks of real-time DSP
systems.
The basic functional blocks of DSP systems are illustrated in Figure 1.1, where a real-
world analog signal is converted to a digital signal, processed by DSP hardware in
2 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
Other digital
systems
Anti-aliasing
filter
ADC
x(n)
DSP
hardware
Other digital
systems
DAC
Reconstruction
filter y(n)
x(t)
x⬘(t)
Amplifier
Amplifier
y(t) y⬘(t)
Input channels
Output channels
Figure 1.1 Basic functional blocks of real-time DSP system
digital form, and converted back into an analog signal. Each of the functional blocks in
Figure 1.1 will be introduced in the subsequent sections. For some real-time applica-
tions, the input data may already be in digital form and/or the output data may not need
to be converted to an analog signal. For example, the processed digital information may
be stored in computer memory for later use, or it may be displayed graphically. In other
applications, the DSP system may be required to generate signals digitally, such as
speech synthesis used for cellular phones or pseudo-random number generators for
CDMA (code division multiple access) systems.
1.2 Input and Output Channels
In this book, a time-domain signal is denoted with a lowercase letter. For example, x t†
in Figure 1.1 is used to name an analog signal of x with a relationship to time t. The time
variable t takes on a continuum of values between 1 and 1. For this reason we say
x t† is a continuous-time signal. In this section, we first discuss how to convert analog
signals into digital signals so that they can be processed using DSP hardware. The
process of changing an analog signal to a xdigital signal is called analog-to-digital (A/D)
conversion. An A/D converter (ADC) is usually used to perform the signal conversion.
Once the input digital signal has been processed by the DSP device, the result, y n†, is
still in digital form, as shown in Figure 1.1. In many DSP applications, we need to
reconstruct the analog signal after the digital processing stage. In other words, we must
convert the digital signal y n† back to the analog signal y t† before it is passed to an
appropriate device. This process is called the digital-to-analog (D/A) conversion, typi-
cally performed by a D/A converter (DAC). One example would be CD (compact disk)
players, for which the music is in a digital form. The CD players reconstruct the analog
waveform that we listen to. Because of the complexity of sampling and synchronization
processes, the cost of an ADC is usually considerably higher than that of a DAC.
1.2.1 Input Signal Conditioning
As shown in Figure 1.1, the analog signal, x0
t†, is picked up by an appropriate
electronic sensor that converts pressure, temperature, or sound into electrical signals.
INPUT AND OUTPUT CHANNELS 3
For example, a microphone can be used to pick up sound signals. The sensor output,
x0
t†, is amplified by an amplifier with gain value g. The amplified signal is
x t† ˆ gx0
t†: 1:2:1†
The gain value g is determined such that x t† has a dynamic range that matches the
ADC. For example, if the peak-to-peak range of the ADC is 5 volts (V), then g may be
set so that the amplitude of signal x t† to the ADC is scaled between  5V. In practice, it
is very difficult to set an appropriate fixed gain because the level of x0
t† may be
unknown and changing with time, especially for signals with a larger dynamic range
such as speech. Therefore an automatic gain controller (AGC) with time-varying gain
determined by DSP hardware can be used to effectively solve this problem.
1.2.2 A/D Conversion
As shown in Figure 1.1, the ADC converts the analog signal x t† into the digital signal
sequence x n†. Analog-to-digital conversion, commonly referred as digitization, consists
of the sampling and quantization processes as illustrated in Figure 1.2. The sampling
process depicts a continuously varying analog signal as a sequence of values. The basic
sampling function can be done with a `sample and hold' circuit, which maintains the
sampled level until the next sample is taken. Quantization process approximates a
waveform by assigning an actual number for each sample. Therefore an ADC consists
of two functional blocks ± an ideal sampler (sample and hold) and a quantizer (includ-
ing an encoder). Analog-to-digital conversion carries out the following steps:
1. The bandlimited signal x t† is sampled at uniformly spaced instants of time, nT,
where n is a positive integer, and T is the sampling period in seconds. This sampling
process converts an analog signal into a discrete-time signal, x nT†, with continuous
amplitude value.
2. The amplitude of each discrete-time sample is quantized into one of the 2B
levels,
where B is the number of bits the ADC has to represent for each sample. The
discrete amplitude levels are represented (or encoded) into distinct binary words
x n† with a fixed wordlength B. This binary sequence, x n†, is the digital signal for
DSP hardware.
x(t)
Ideal sampler
x(nT)
Quantizer
x(n)
A/D converter
Figure 1.2 Block diagram of A/D converter
4 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
The reason for making this distinction is that each process introduces different distor-
tions. The sampling process brings in aliasing or folding distortions, while the encoding
process results in quantization noise.
1.2.3 Sampling
An ideal sampler can be considered as a switch that is periodically open and closed every
T seconds and
T ˆ
1
fs
, 1:2:2†
where fs is the sampling frequency (or sampling rate) in hertz (Hz, or cycles per
second). The intermediate signal, x nT†, is a discrete-time signal with a continuous-
value (a number has infinite precision) at discrete time nT, n ˆ 0, 1, . . ., 1 as illustrated
in Figure 1.3. The signal x nT† is an impulse train with values equal to the amplitude
of x t† at time nT. The analog input signal x t† is continuous in both time and
amplitude. The sampled signal x nT† is continuous in amplitude, but it is defined
only at discrete points in time. Thus the signal is zero except at the sampling instants
t ˆ nT.
In order to represent an analog signal x t† by a discrete-time signal x nT† accurately,
two conditions must be met:
1. The analog signal, x t†, must be bandlimited by the bandwidth of the signal fM.
2. The sampling frequency, fs, must be at least twice the maximum frequency com-
ponent fM in the analog signal x t†. That is,
fs  2 fM: 1:2:3†
This is Shannon's sampling theorem. It states that when the sampling frequency is
greater than twice the highest frequency component contained in the analog signal, the
original signal x t† can be perfectly reconstructed from the discrete-time sample x nT†.
The sampling theorem provides a basis for relating a continuous-time signal x t† with
Time, t
x(nT)
0 T 2T 3T 4T
x(t)
Figure 1.3 Example of analog signal x t† and discrete-time signal x nT†
INPUT AND OUTPUT CHANNELS 5
the discrete-time signal x nT† obtained from the values of x t† taken T seconds apart. It
also provides the underlying theory for relating operations performed on the sequence
to equivalent operations on the signal x t† directly.
The minimum sampling frequency fs ˆ 2fM is the Nyquist rate, while fN ˆ fs=2 is
the Nyquist frequency (or folding frequency). The frequency interval ‰ fs=2, fs=2Š
is called the Nyquist interval. When an analog signal is sampled at sampling frequency,
fs, frequency components higher than fs=2 fold back into the frequency range ‰0, fs=2Š.
This undesired effect is known as aliasing. That is, when a signal is sampled
perversely to the sampling theorem, image frequencies are folded back into the desired
frequency band. Therefore the original analog signal cannot be recovered from the
sampled data. This undesired distortion could be clearly explained in the frequency
domain, which will be discussed in Chapter 4. Another potential degradation is due to
timing jitters on the sampling pulses for the ADC. This can be negligible if a higher
precision clock is used.
For most practical applications, the incoming analog signal x t† may not be band-
limited. Thus the signal has significant energies outside the highest frequency of
interest, and may contain noise with a wide bandwidth. In other cases, the sampling
rate may be pre-determined for a given application. For example, most voice commu-
nication systems use an 8 kHz (kilohertz) sampling rate. Unfortunately, the maximum
frequency component in a speech signal is much higher than 4 kHz. Out-of-band signal
components at the input of an ADC can become in-band signals after conversion
because of the folding over of the spectrum of signals and distortions in the discrete
domain. To guarantee that the sampling theorem defined in Equation (1.2.3) can be
fulfilled, an anti-aliasing filter is used to band-limit the input signal. The anti-aliasing
filter is an analog lowpass filter with the cut-off frequency of
fc 
fs
2
: 1:2:4†
Ideally, an anti-aliasing filter should remove all frequency components above the
Nyquist frequency. In many practical systems, a bandpass filter is preferred in order
to prevent undesired DC offset, 60 Hz hum, or other low frequency noises. For example,
a bandpass filter with passband from 300 Hz to 3200 Hz is used in most telecommunica-
tion systems.
Since anti-aliasing filters used in real applications are not ideal filters, they cannot
completely remove all frequency components outside the Nyquist interval. Any fre-
quency components and noises beyond half of the sampling rate will alias into the
desired band. In addition, since the phase response of the filter may not be linear, the
components of the desired signal will be shifted in phase by amounts not proportional to
their frequencies. In general, the steeper the roll-off, the worse the phase distortion
introduced by a filter. To accommodate practical specifications for anti-aliasing filters,
the sampling rate must be higher than the minimum Nyquist rate. This technique is
known as oversampling. When a higher sampling rate is used, a simple low-cost anti-
aliasing filter with minimum phase distortion can be used.
Example 1.1: Given a sampling rate for a specific application, the sampling period
can be determined by (1.2.2).
6 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
(a) In narrowband telecommunication systems, the sampling rate fs ˆ 8 kHz,
thus the sampling period T ˆ 1=8 000 seconds ˆ 125 ms (microseconds).
Note that 1 ms ˆ 10 6
seconds.
(b) In wideband telecommunication systems, the sampling is given as
fs ˆ 16 kHz, thus T ˆ 1=16 000 seconds ˆ 62:5 ms.
(c) In audio CDs, the sampling rate is fs ˆ 44:1 kHz, thus T ˆ 1=44 100 seconds
ˆ 22:676 ms.
(d) In professional audio systems, the sampling rate fs ˆ 48 kHz, thus
T ˆ 1=48 000 seconds ˆ 20:833 ms.
1.2.4 Quantizing and Encoding
In the previous sections, we assumed that the sample values x nT† are represented
exactly with infinite precision. An obvious constraint of physically realizable digital
systems is that sample values can only be represented by a finite number of bits.
The fundamental distinction between discrete-time signal processing and DSP is the
wordlength. The former assumes that discrete-time signal values x nT† have infinite
wordlength, while the latter assumes that digital signal values x n† only have a limited
B-bit.
We now discuss a method of representing the sampled discrete-time signal x nT† as a
binary number that can be processed with DSP hardware. This is the quantizing and
encoding process. As shown in Figure 1.3, the discrete-time signal x nT† has an analog
amplitude (infinite precision) at time t ˆ nT. To process or store this signal with DSP
hardware, the discrete-time signal must be quantized to a digital signal x n† with a finite
number of bits. If the wordlength of an ADC is B bits, there are 2B
different values
(levels) that can be used to represent a sample. The entire continuous amplitude range is
divided into 2B
subranges. Amplitudes of waveform that are in the same subrange are
assigned the same amplitude values. Therefore quantization is a process that represents
an analog-valued sample x nT† with its nearest level that corresponds to the digital
signal x n†. The discrete-time signal x nT† is a sequence of real numbers using infinite
bits, while the digital signal x n† represents each sample value by a finite number of bits
which can be stored and processed using DSP hardware.
The quantization process introduces errors that cannot be removed. For example, we
can use two bits to define four equally spaced levels (00, 01, 10, and 11) to classify the
signal into the four subranges as illustrated in Figure 1.4. In this figure, the symbol `o'
represents the discrete-time signal x nT†, and the symbol `' represents the digital signal
x n†.
In Figure 1.4, the difference between the quantized number and the original value is
defined as the quantization error, which appears as noise in the output. It is also called
quantization noise. The quantization noise is assumed to be random variables that are
uniformly distributed in the intervals of quantization levels. If a B-bit quantizer is used,
the signal-to-quantization-noise ratio (SNR) is approximated by (will be derived in
Chapter 3)
INPUT AND OUTPUT CHANNELS 7
T 2T 3T
00
01
10
11
Quantization level
Time, t
x(t)
0
Quantization errors
Figure 1.4 Digital samples using a 2-bit quantizer
SNR  6B dB: 1:2:5†
This is a theoretical maximum. When real input signals and converters are used, the
achievable SNR will be less than this value due to imperfections in the fabrication of
A/D converters. As a result, the effective number of bits may be less than the number
of bits in the ADC. However, Equation (1.2.5) provides a simple guideline for determin-
ing the required bits for a given application. For each additional bit, a digital signal has
about a 6-dB gain in SNR. For example, a 16-bit ADC provides about 96 dB SNR. The
more bits used to represent a waveform sample, the smaller the quantization noise will
be. If we had an input signal that varied between 0 and 5 V, using a 12-bit ADC, which
has 4096 212
† levels, the least significant bit (LSB) would correspond to 1.22 mV
resolution. An 8-bit ADC with 256 levels can only provide up to 19.5 mV resolution.
Obviously with more quantization levels, one can represent the analog signal more
accurately. The problems of quantization and their solutions will be further discussed in
Chapter 3.
If the uniform quantization scheme shown in Figure 1.4 can adequately represent
loud sounds, most of the softer sounds may be pushed into the same small value. This
means soft sounds may not be distinguishable. To solve this problem, a quantizer whose
quantization step size varies according to the signal amplitude can be used. In practice,
the non-uniform quantizer uses a uniform step size, but the input signal is compressed
first. The overall effect is identical to the non-uniform quantization. For example, the
logarithm-scaled input signal, rather than the input signal itself, will be quantized. After
processing, the signal is reconstructed at the output by expanding it. The process of
compression and expansion is called companding (compressing and expanding). For
example, the m-law (used in North America and parts of Northeast Asia) and A-law
(used in Europe and most of the rest of the world) companding schemes are used in most
digital communications.
As shown in Figure 1.1, the input signal to DSP hardware may be a digital signal
from other DSP systems. In this case, the sampling rate of digital signals from other
digital systems must be known. The signal processing techniques called interpolation or
decimation can be used to increase or decrease the existing digital signals' sampling
rates. Sampling rate changes are useful in many applications such as interconnecting
DSP systems operating at different rates. A multirate DSP system uses more than one
sampling frequency to perform its tasks.
8 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
1.2.5 D/A Conversion
Most commercial DACs are zero-order-hold, which means they convert the binary
input to the analog level and then simply hold that value for T seconds until the next
sampling instant. Therefore the DAC produces a staircase shape analog waveform y0
t†,
which is shown as a solid line in Figure 1.5. The reconstruction (anti-imaging and
smoothing) filter shown in Figure 1.1 smoothes the staircase-like output signal gener-
ated by the DAC. This analog lowpass filter may be the same as the anti-aliasing filter
with cut-off frequency fc  fs=2, which has the effect of rounding off the corners of the
staircase signal and making it smoother, which is shown as a dotted line in Figure 1.5.
High quality DSP applications, such as professional digital audio, require the use of
reconstruction filters with very stringent specifications.
From the frequency-domain viewpoint (will be presented in Chapter 4), the output of
the DAC contains unwanted high frequency or image components centered at multiples
of the sampling frequency. Depending on the application, these high-frequency compon-
ents may cause undesired side effects. Take an audio CD player for example. Although
the image frequencies may not be audible, they could overload the amplifier and cause
inter-modulation with the desired baseband frequency components. The result is an
unacceptable degradation in audio signal quality.
The ideal reconstruction filter has a flat magnitude response and linear phase in the
passband extending from the DC to its cut-off frequency and infinite attenuation in
the stopband. The roll-off requirements of the reconstruction filter are similar to those
of the anti-aliasing filter. In practice, switched capacitor filters are preferred because of
their programmable cut-off frequency and physical compactness.
1.2.6 Input/Output Devices
There are two basic ways of connecting A/D and D/A converters to DSP devices: serial
and parallel. A parallel converter receives or transmits all the B bits in one pass, while
the serial converters receive or transmit B bits in a serial data stream. Converters with
parallel input and output ports must be attached to the DSP's address and data buses,
y⬘(t)
Time, t
0 T 2T 3T 4T 5T
Smoothed output
signal
Figure 1.5 Staircase waveform generated by a DAC
INPUT AND OUTPUT CHANNELS 9
which are also attached to many different types of devices. With different memory
devices (RAM, EPROM, EEPROM, or flash memory) at different speeds hanging on
DSP's data bus, driving the bus may become a problem. Serial converters can be
connected directly to the built-in serial ports of DSP devices. This is why many practical
DSP systems use serial ADCs and DACs.
Many applications use a single-chip device called an analog interface chip (AIC) or
coder/decoder (CODEC), which integrates an anti-aliasing filter, an ADC, a DAC, and a
reconstruction filter all on a single piece of silicon. Typical applications include modems,
speech systems, and industrial controllers. Many standards that specify the nature of the
CODEC have evolved for the purposes of switching and transmission. These devices
usually use a logarithmic quantizer, i.e., A-law or m-law, which must be converted into a
linear format for processing. The availability of inexpensive companded CODEC justi-
fies their use as front-end devices for DSP systems. DSP chips implement this format
conversion in hardware or in software by using a table lookup or calculation.
The most popular commercially available ADCs are successive approximation, dual
slope, flash, and sigma-delta. The successive-approximation ADC produces a B-bit
output in B cycles of its clock by comparing the input waveform with the output of a
digital-to-analog converter. This device uses a successive-approximation register to split
the voltage range in half in order to determine where the input signal lies. According to
the comparator result, one bit will be set or reset each time. This process proceeds
from the most significant bit (MSB) to the LSB. The successive-approximation type of
ADC is generally accurate and fast at a relatively low cost. However, its ability to follow
changes in the input signal is limited by its internal clock rate, so that it may be slow to
respond to sudden changes in the input signal.
The dual-slope ADC uses an integrator connected to the input voltage and a reference
voltage. The integrator starts at zero condition, and it is charged for a limited time. The
integrator is then switched to a known negative reference voltage and charged in the
opposite direction until it reaches zero volts again. At the same time, a digital counter
starts to record the clock cycles. The number of counts required for the integrator
output voltage to get back to zero is directly proportional to the input voltage. This
technique is very precise and can produce ADCs with high resolution. Since the
integrator is used for input and reference voltages, any small variations in temperature
and aging of components have little or no effect on these types of converters. However,
they are very slow and generally cost more than successive-approximation ADCs.
A voltage divider made by resistors is used to set reference voltages at the flash ADC
inputs. The major advantage of a flash ADC is its speed of conversion, which is simply
the propagation delay time of the comparators. Unfortunately, a B-bit ADC needs
2B
1† comparators and laser-trimmed resistors. Therefore commercially available
flash ADCs usually have lower bits.
The block diagram of a sigma±delta ADC is illustrated in Figure 1.6. Sigma±delta
ADCs use a 1-bit quantizer with a very high sampling rate. Thus the requirements for an
anti-aliasing filter are significantly relaxed (i.e., the lower roll-off rate and smaller flat
response in passband). In the process of quantization, the resulting noise power is spread
evenly over the entire spectrum. As a result, the noise power within the band of interest is
lower. In order to match the output frequency with the system and increase its resolution,
a decimator is used. The advantages of the sigma±delta ADCs are high resolution and
good noise characteristics at a competitive price because they use digital filters.
10 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
Analog
input
−
Σ
Sigma
Delta
1-bit B-bit
1-bit
DAC
1-bit
ADC
∫
+ Digital
decimator
Figure 1.6 A block of a sigma-delta ADC
1.3 DSP Hardware
DSP systems require intensive arithmetic operations, especially multiplication and
addition. In this section, different digital hardware architectures for DSP applications
will be discussed.
1.3.1 DSP Hardware Options
As shown in Figure 1.1, the processing of the digital signal x n† is carried out using the
DSP hardware. Although it is possible to implement DSP algorithms on any digital
computer, the throughput (processing rate) determines the optimum hardware plat-
form. Four DSP hardware platforms are widely used for DSP applications:
1. general-purpose microprocessors and microcontrollers mP†,
2. general-purpose digital signal processors (DSP chips),
3. digital building blocks (DBB) such as multiplier, adder, program controller, and
4. special-purpose (custom) devices such as application specific integrated circuits
(ASIC).
The hardware characteristics are summarized in Table 1.1.
ASIC devices are usually designed for specific tasks that require a lot of DSP MIPS
(million instructions per second), such as fast Fourier transform (FFT) devices and
Reed±Solomon coders used by digital subscriber loop (xDSL) modems. These devices
are able to perform their limited functions much faster than general-purpose DSP chips
because of their dedicated architecture. These application-specific products enable the
use of high-speed functions optimized in hardware, but they lack the programmability
to modify the algorithm, so they are suitable for implementing well-defined and well-
tested DSP algorithms. Therefore applications demanding high speeds typically employ
ASICs, which allow critical DSP functions to be implemented in the hardware. The
availability of core modules for common DSP functions has simplified the ASIC design
tasks, but the cost of prototyping an ASIC device, a longer design cycle, insufficient
DSP HARDWARE 11
Table 1.1 Summary of DSP hardware implementations
ASIC DBB mP DSP chips
Chip count 1  1 1 1
Flexibility none limited programmable programmable
Design time long medium short short
Power consumption low medium±high medium low±medium
Processing speed high high low±medium medium±high
Reliability high low±medium high high
Development cost high medium low low
Production cost low high low±medium low±medium
Processor
Address bus
Data bus
Memory
Processor
Address bus 1
Address bus 2
Data bus 1
Data bus 2
Memory 1 Memory 2
(a) (b)
Figure 1.7 Different memory architectures: (a) Harvard architecture, and (b) von Newmann
architecture
standard development tools support, and the lack of reprogramming flexibility some-
times outweigh their benefits.
Digital building blocks offer a more general-purpose approach to high-speed DSP
design. These components, including multipliers, arithmetic logic units (ALUs), sequen-
cers, etc., are joined together to build a custom DSP architecture for a specific applica-
tion. Performance can be significantly higher than general-purpose DSP devices.
However, the disadvantages are similar to those of the special-purpose DSP devices ±
lack of standard design tools, extended design cycles, and high component cost.
General architectures for computers and microprocessors fall into two categories:
Harvard architecture and von Neumann architecture. Harvard architecture has a
separate memory space for the program and the data, so that both memories can be
accessed simultaneously, see Figure 1.7(a). The von Neumann architecture assumes that
12 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
there is no intrinsic difference between the instructions and the data, and that the
instructions can be partitioned into two major fields containing the operation command
and the address of the operand. Figure 1.7(b) shows the memory architecture of the von
Neumann model. Most general-purpose microprocessors use the von Neumann archi-
tecture. Operations such as add, move, and subtract are easy to perform. However,
complex instructions such as multiplication and division are slow since they need a
series of shift, addition, or subtraction operations. These devices do not have the
architecture or the on-chip facilities required for efficient DSP operations. They may
be used when a small amount of signal processing work is required in a much larger
system. Their real-time DSP performance does not compare well with even the cheaper
general-purpose DSP devices, and they would not be a cost-effective solution for many
DSP tasks.
A DSP chip (digital signal processor) is basically a microprocessor whose architecture
is optimized for processing specific operations at high rates. DSP chips with architec-
tures and instruction sets specifically designed for DSP applications have been launched
by Texas Instruments, Motorola, Lucent Technologies, Analog Devices, and many
other companies. The rapid growth and the exploitation of DSP semiconductor tech-
nology are not a surprise, considering the commercial advantages in terms of the fast,
flexible, and potentially low-cost design capabilities offered by these devices. General-
purpose-programmable DSP chip developments are supported by software develop-
ment tools such as C compilers, assemblers, optimizers, linkers, debuggers, simulators,
and emulators. Texas Instruments' TMS320C55x, a programmable, high efficiency, and
ultra low-power DSP chip, will be discussed in the next chapter.
1.3.2 Fixed- and Floating-Point Devices
A basic distinction between DSP chips is their fixed-point or floating-point architectures.
The fixed-point representation of signals and arithmetic will be discussed in Chapter 3.
Fixed-point processors are either 16-bit or 24-bit devices, while floating-point processors
are usually 32-bit devices. A typical 16-bit fixed-point processor, such as the
TMS320C55x, stores numbers in a 16-bit integer format. Although coefficients and
signals are only stored with 16-bit precision, intermediate values (products) may be kept
at 32-bit precision within the internal accumulators in order to reduce cumulative round-
ing errors. Fixed-point DSP devices are usually cheaper and faster than their floating-
point counterparts because they use less silicon and have fewer external pins.
A typical 32-bit floating-point DSP device, such as the TMS320C3x, stores a 24-bit
mantissa and an 8-bit exponent. A 32-bit floating-point format gives a large dynamic
range. However, the resolution is still only 24 bits. Dynamic range limitations may be
virtually ignored in a design using floating-point DSP chips. This is in contrast to fixed-
point designs, where the designer has to apply scaling factors to prevent arithmetic
overflow, which is a very difficult and time-consuming process.
Floating-point devices may be needed in applications where coefficients vary in time,
signals and coefficients have a large dynamic range, or where large memory structures
are required, such as in image processing. Other cases where floating-point devices can
be justified are where development costs are high and production volumes are low. The
faster development cycle for a floating-point device may easily outweigh the extra cost
DSP HARDWARE 13
of the DSP device itself. Floating-point DSP chips also allow the efficient use of
the high-level C compilers and reduce the need to identify the system's dynamic range.
1.3.3 Real-Time Constraints
A limitation of DSP systems for real-time applications is that the bandwidth of the
system is limited by the sampling rate. The processing speed determines the rate at
which the analog signal can be sampled. For example, a real-time DSP system demands
that the signal processing time, tp, must be less than the sampling period, T, in order to
complete the processing task before the new sample comes in. That is,
tp  T: 1:3:1†
This real-time constraint limits the highest frequency signal that can be processed by a
DSP system. This is given as
fM 
fs
2

1
2tp
: 1:3:2†
It is clear that the longer the processing time tp, the lower the signal bandwidth fM.
Although new and faster DSP devices are introduced, there is still a limit to the
processing that can be done in real time. This limit becomes even more apparent when
system cost is taken into consideration. Generally, the real-time bandwidth can be
increased by using faster DSP chips, simplified DSP algorithms, optimized DSP pro-
grams, and parallel processing using multiple DSP chips, etc. However, there is still a
trade-off between costs and system performances, with many applications simply not
being economical at present.
1.4 DSP System Design
A generalized DSP system design is illustrated in Figure 1.8. For a given application, the
theoretical aspects of DSP system specifications such as system requirements, signal
analysis, resource analysis, and configuration analysis are first performed to define the
system requirements.
1.4.1 Algorithm Development
The algorithm for a given application is initially described using difference equations or
signal-flow block diagrams with symbolic names for the inputs and outputs. In docu-
menting the algorithm, it is sometimes helpful to further clarify which inputs and
outputs are involved by means of a data flow diagram. The next stage of the develop-
ment process is to provide more details on the sequence of operations that must be
performed in order to derive the output from the input. There are two methods for
characterizing the sequence of steps in a program: flowcharts or structured descriptions.
14 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
H
A
R
D
W
A
R
E
S
O
F
T
W
A
R
E
System requirements specifications
Algorithm development and simulation
Select DSP devices
System integration and debug
System testing and release
Application
Software
architecture
Coding and
Debugging
Hardware
Schematic
Hardware
Prototype
Figure 1.8 Simplified DSP system design flow
MATLAB or C/C++
ADC
Other
computers
Other
computers
DAC
Signal generators
DSP
algorithms
DSP
software
Data
files
Data
files
Figure 1.9 DSP software development using a general-purpose computer
At the algorithm development stage, we most likely work with high-level DSP tools
(such as MATLAB or C=C‡‡) that enable algorithmic-level system simulations. We
then migrate the algorithm to software, hardware, or both, depending on our specific
needs. A DSP application or algorithm can be first simulated using a general-purpose
computer, such as a PC, so that it can be analyzed and tested off-line using simulated
input data. A block diagram of general-purpose computer implementation is illustrated
in Figure 1.9. The test signals may be internally generated by signal generators or
digitized from an experimental setup based on the given application. The program uses
the stored signal samples in data file(s) as input(s) to produce output signals that will be
saved in data file(s).
DSP SYSTEM DESIGN 15
Advantages of developing DSP software on a general-purpose computer are:
1. Using the high-level languages such as MATLAB, C=C‡‡, or other DSP software
packages can significantly save algorithm and software development time. In add-
ition, C programs are portable to different DSP hardware platforms.
2. It is easy to debug and modify programs.
3. Input/output operations based on disk files are simple to implement and the behav-
iors of the system are easy to analyze.
4. Using the floating-point data format can achieve higher precision.
5. With fixed-point simulation, bit-true verification of an algorithm against fixed-
point DSP implementation can easily be compared.
1.4.2 Selection of DSP Chips
A choice of DSP chip from many available devices requires a full understanding of the
processing requirements of the DSP system under design. The objective is to select the
device that meets the project's time-scales and provides the most cost-effective solution.
Some decisions can be made at an early stage based on computational power, resolu-
tion, cost, etc. In real-time DSP, the efficient flow of data into and out of the processor
is also critical. However, these criteria will probably still leave a number of candidate
devices for further analysis. For high-volume applications, the cheapest device that can
do the job should be chosen. For low- to medium-volume applications, there will be a
trade-off between development time, development tool cost, and the cost of the DSP
device itself. The likelihood of having higher-performance devices with upwards-
compatible software in the future is also an important factor.
When processing speed is at a premium, the only valid comparison between devices is
on an algorithm-implementation basis. Optimum code must be written for both devices
and then the execution time must be compared. Other important factors are memory size
and peripheral devices, such as serial and parallel interfaces, which are available on-chip.
In addition, a full set of development tools and supports are important for DSP chip
selection, including:
1. Software development tools, such as assemblers, linkers, simulators, and C com-
pilers.
2. Commercially available DSP boards for software development and testing before
the target DSP hardware is available.
3. Hardware testing tools, such as in-circuit emulators and logic analyzers.
4. Development assistance, such as application notes, application libraries, data
books, real-time debugging hardware, low-cost prototyping, etc.
16 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
1.4.3 Software Development
The four common measures of good DSP software are reliability, maintainability,
extensibility, and efficiency. A reliable program is one that seldom (or never) fails.
Since most programs will occasionally fail, a maintainable program is one that is easy
to fix. A truly maintainable program is one that can be fixed by someone other than
the original programmer. In order for a program to be truly maintainable, it must be
portable on more than one type of hardware. An extensible program is one that can
be easily modified when the requirements change, new functions need to be added, or
new hardware features need to be exploited. An efficient DSP program will use the
processing capabilities of the target hardware to minimize execution time.
A program is usually tested in a finite number of ways much smaller than the number
of input data conditions. This means that a program can be considered reliable only
after years of bug-free use in many different environments. A good DSP program often
contains many small functions with only one purpose, which can be easily reused by
other programs for different purposes. Programming tricks should be avoided at all
costs as they will often not be reliable and will almost always be difficult for someone
else to understand even with lots of comments. In addition, use variable names that are
meaningful in the context of the program.
As shown in Figure 1.8, the hardware and software design can be conducted at the
same time for a given DSP application. Since there is a lot of interdependence factors
between hardware and software, the ideal DSP designer will be a true `system' engineer,
capable of understanding issues with both hardware and software. The cost of hardware
has gone down dramatically in recent years. The majority of the cost of a DSP solution
now resides in software development. This section discussed some issues regarding
software development.
The software life cycle involves the completion of a software project: the project
definition, the detailed specification, coding and modular testing, integration, and
maintenance. Software maintenance is a significant part of the cost of a software
system. Maintenance includes enhancing the software, fixing errors identified as the
software is used, and modifying the software to work with new hardware and software.
It is essential to document programs thoroughly with titles and comment statements
because this greatly simplifies the task of software maintenance.
As discussed earlier, good programming technique plays an essential part in success-
ful DSP application. A structured and well-documented approach to programming
should be initiated from the beginning. It is important to develop an overall specifica-
tion for signal processing tasks prior to writing any program. The specification includes
the basic algorithm/task description, memory requirements, constraints on the program
size, execution time, etc. Specification review is an important component of the software
development process. A thoroughly reviewed specification can catch mistakes before
code is written and reduce potential code rework risk at system integration stage. The
potential use of subroutines for repetitive processes should also be noted. A flow
diagram will be a very helpful design tool to adopt at this stage. Program and data
blocks should be allocated to specific tasks that optimize data access time and address-
ing functions.
A software simulator or a hardware platform can be used for testing DSP code.
Software simulators run on a host computer to mimic the behavior of a DSP chip. The
DSP SYSTEM DESIGN 17
simulator is able to show memory contents, all the internal registers, I/O, etc., and the
effect on these after each instruction is performed. Input/output operations are simu-
lated using disk files, which require some format conversion. This approach reduces the
development process for software design only. Full real-time emulators are normally
used when the software is to be tested on prototype target hardware.
Writing and testing DSP code is a highly iterative process. With the use of a simulator
or an evaluation board, code may be tested regularly as it is written. Writing code in
modules or sections can help this process, as each module can be tested individually,
with a greater chance of the whole system working at the system integration stage.
There are two commonly used methods in developing software for DSP devices: an
assembly program or a C=C‡‡ program. Assembly language is one step removed from
the machine code actually used by the processor. Programming in assembly language
gives the engineers full control of processor functions, thus resulting in the most efficient
program for mapping the algorithm by hand. However, this is a very time-consuming
and laborious task, especially for today's highly paralleled DSP architectures. A C
program is easier for software upgrades and maintenance. However, the machine code
generated by a C compiler is inefficient in both processing speed and memory usage.
Recently, DSP manufactures have improved C compiler efficiency dramatically.
Often the ideal solution is to work with a mixture of C and assembly code. The overall
program is controlled by C code and the run-time critical loops are written in assembly
language. In a mixed programming environment, an assembly routine may be either
called as a function, or in-line coded into the C program. A library of hand-optimized
functions may be built up and brought into the code when required. The fundamentals
of C language for DSP applications will be introduced in Appendix C, while the
assembly programming for the TMS320C55x will be discussed in Chapter 2. Mixed C
and assembly programming will be introduced in Chapter 3. Alternatively, there are
many high-level system design tools that can automatically generate an implementation
in software, such as C and assembly language.
1.4.4 High-Level Software Development Tools
Software tools are computer programs that have been written to perform specific
operations. Most DSP operations can be categorized as being either analysis tasks
or filtering tasks. Signal analysis deals with the measurement of signal properties.
MATLAB is a powerful environment for signal analysis and visualization, which are
critical components in understanding and developing a DSP system. Signal filtering,
such as removal of unwanted background noise and interference, is usually a time-
domain operation. C programming is an efficient tool for performing signal filtering
and is portable over different DSP platforms.
In general, there are two different types of data files: binary files and ASCII (text)
files. A binary file contains data stored in a memory-efficient binary format, whereas an
ASCII file contains information stored in ASCII characters. A binary file may be
viewed as a sequence of characters, each addressable as an offset from the first position
in the file. The system does not add any special characters to the data except null
characters appended at the end of the file. Binary files are preferable for data that is
going to be generated and used by application programs. ASCII files are necessary if the
18 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
C program
(Source)
C compiler
Machine
code
(Object)
Linker/loader Execution
Program
output
Libraries Data
Figure 1.10 Program compilation, linking, and execution
data is to be shared by programs using different languages and different computer
platforms, especially for data transfer over computer networks. In addition, an ASCII
file can be generated using a word processor program or an editor.
MATLAB is an interactive, technical computing environment for scientific and
engineering numerical analysis, computation, and visualization. Its strength lies in the
fact that complex numerical problems can be solved easily in a fraction of the time
required with a programming language such as C. By using its relatively simple pro-
gramming capability, MATLAB can be easily extended to create new functions, and is
further enhanced by numerous toolboxes such as the Signal Processing Toolbox.
MATLAB is available on most commonly used computers such as PCs, workstations,
Macintosh, and others. The version we use in this book is based on MATLAB for
Windows, version 5.1. The brief introduction of using MATLAB for DSP is given in
Appendix B.
The purpose of a programming language is to solve a problem involving the manip-
ulation of information. The purpose of a DSP program is to manipulate signals in order
to solve a specific signal-processing problem. High-level languages are computer lan-
guages that have English-like commands and instructions. They include languages such
as C=C‡‡, FORTRAN, Basic, and Pascal. High-level language programs are usually
portable, so they can be recompiled and run on many different computers. Although
C is categorized as a high-level language, it also allows access to low-level routines.
In addition, a C compiler is available for most modern DSP devices such as the
TMS320C55x. Thus C programming is the most commonly used high-level language
for DSP applications.
C has become the language of choice for many DSP software development engineers
not only because it has powerful commands and data structures, but also because it can
easily be ported on different DSP platforms and devices. The processes of compilation,
linking/loading, and execution are outlined in Figure 1.10. A C compiler translates a
high-level C program into machine language that can be executed by the computer. C
compilers are available for a wide range of computer platforms and DSP chips, thus
making the C program the most portable software for DSP applications. Many C
programming environments include debugger programs, which are useful in identifying
errors in a source program. Debugger programs allow us to see values stored in
variables at different points in a program, and to step through the program line by line.
1.5 Experiments Using Code Composer Studio
The code composer studio (CCS) is a useful utility that allows users to create, edit,
build, debug, and analyze DSP programs. The CCS development environment supports
EXPERIMENTS USING CODE COMPOSER STUDIO 19
several Texas Instruments DSP processors, including the TMS320C55x. For building
applications, the CCS provides a project manager to handle the programming tasks.
For debugging purposes, it provides breakpoint, variable watch, memory/register/stack
viewing, probe point to stream data to and from the target, graphical analysis, execution
profiling, and the capability to display mixed disassembled and C instructions. One
important feature of the CCS is its ability to create and manage large projects from a
graphic-user-interface environment. In this section, we will use a simple sinewave
example to introduce the basic built-in editing features, major CCS components, and
the use of the C55x development tools. We will also demonstrate simple approaches to
software development and debugging process using the TMS320C55x simulator. The
CCS version 1.8 was used in this book.
Installation of the CCS on a PC or a workstation is detailed in the Code Composer
Studio Quick Start Guide [8]. If the C55x simulator has not been installed, use the
CCS setup program to configure and set up the TMS320C55x simulator. We can start
the CCS setup utility, either from the Windows start menu, or by clicking the Code
Composer Studio Setup icon. When the setup dialogue box is displayed as shown in
Figure 1.11(a), follow these steps to set up the simulator:
± Choose Install a Device Driver and select the C55x simulator device driver,
tisimc55.dvr for the TMS320C55x simulator. The C55x simulator will appear
in the middle window named as Available Board/Simulator Types if the installation
is successful, as shown in Figure 1.11(b).
± Drag the C55x simulator from Available Board/Simulator Types window to the
System Configuration window and save the change. When the system configuration
is completed, the window label will be changed to Available Processor Types as
shown in Figure 1.11(c).
1.5.1 Experiment 1A ± Using the CCS and the TMS320C55x Simulator
This experiment introduces the basic features to build a project with the CCS. The
purposes of the experiment are to:
(a) create projects,
(b) create source files,
(c) create linker command file for mapping the program to DSP memory space,
(d) set paths for C compiler and linker to search include files and libraries, and
(e) build and load program for simulation.
Let us begin with the simple sinewave example to get familiar with the TMS320C55x
simulator. In this book, we assume all the experiment files are stored on a disk in the
computer's A drive to make them portable for users, especially for students who may
share the laboratory equipment.
20 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
(a)
(b)
(c)
Figure 1.11 CCS setup dialogue boxes: (a) install the C55x simulator driver, (b) drag the C55x
simulator to system configuration window, and (c) save the configuration
The best way to learn a new software tool is by using it. This experiment is partitioned
into following six steps:
1. Start the CCS and simulator:
± Invoke the CCS from the Start menu or by clicking on the Code Composer Studio
icon on the PC. The CCS with the C55x simulator will appear on the computer
screen as shown in Figure 1.12.
2. Create a project for the CCS:
± Choose Project!New to create a new project file and save it as exp1 to
A:Experiment1. The CCS uses the project to operate its built-in utilities
to create a full build application.
3. Create a C program file using the CCS:
± Choose File!New to create a new file, then type in the example C code listed
in Table 1.2, and save it as exp1.c to A:Experiment1. This example reads
EXPERIMENTS USING CODE COMPOSER STUDIO 21
Figure 1.12 CCS integrated development environment
Table 1.2 List of sinewave example code, exp1.c
#define BUF_SIZE 40
const int sineTable[
BUF_SIZE]ˆ
{0x0000,0x000f,0x001e,0x002d,0x003a,0x0046,0x0050,0x0059,
0x005f,0x0062,0x0063,0x0062,0x005f,0x0059,0x0050,0x0046,
0x003a,0x002d,0x001e,0x000f,0x0000,0xfff1,0xffe2,0xffd3,
0xffc6,0xffba,0xffb0,0xffa7,0xffa1,0xff9e,0xff9d,0xff9e,
0xffa1,0xffa7,0xffb0,0xffba,0xffc6,0xffd3,0xffe2,0xfff1}
;
int in_buffer[
BUF_SIZE];
int out_buffer[
BUF_SIZE];
int Gain;
void main
()
{
int i,j;
Gain ˆ 0x20;
22 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
Table 1.2 (continued )
while (1)
{ /* - set profile point on this line */
for (i ˆ BUF_SIZE 1; i ˆ 0; i )
{
j ˆ BUF_SIZE 1 i;
out_buffer[
j]ˆ 0;
in_buffer[
j]ˆ 0;
}
for (i ˆ BUF_SIZE 1; i ˆ 0; i )
{
j ˆ BUF_SIZE 1 i;
in_buffer[
i]ˆ sineTable[
i]; /* - set breakpoint */
in_buffer[
i]ˆ 0 in_buffer[
i];
out_buffer[
j]ˆ Gain*in_buffer[
i];
}
} /* - set probe and profile points on this line */
}
pre-calculated sinewave values from a table, negates, and stores the values in a
reversed order to an output buffer. Note that the program exp1.c is included in
the experimental software package.
However, it is recommended that we create this program with the editor to get
familiar with the CCS editing functions.
4. Create a linker command file for the simulator:
± Choose File!New to create another new file and type in the linker
command file listed in Table 1.3 (or copy the file exp1.cmd from the experi-
mental software package). Save this file as exp1.cmd to A:Experiment1.
Linker uses a command file to map different program segments into a pre-
partitioned system memory space. A detailed description on how to define and
use the linker command file will be presented in Chapter 2.
5. Setting up the project:
± After exp1.c and exp1.cmd are created, add them to the project by
choosing Project!Add Files, and select files exp1.c and exp1.cmd from
A:Experiment1.
± Before building a project, the search paths should be set up for the C
compiler, assembler, and linker. To set up options for the C compiler,
assembler, and linker, choose Project!Options. The paths for the C55x
tools should be set up during the CCS installation process. We will need to add
search paths in order to include files and libraries that are not included in the
C55x tools directories, such as the libraries and included files we have created in
EXPERIMENTS USING CODE COMPOSER STUDIO 23
Table 1.3 Linker command file
/* Specify the system memory map */
MEMORY
{
RAM (RWIX): origin ˆ 000100h, length ˆ 01feffh /* Data memory */
RAM2 (RWIX): origin ˆ 040100h, length ˆ 040000h /* Program memory */
ROM (RIX) : origin ˆ 020100h, length ˆ 020000h /* Program memory */
VECS (RIX) : origin ˆ 0ffff00h, length ˆ 00100h /* Reset vector */
}
/* Specify the sections allocation into memory */
SECTIONS
{
vectors  VECS /* Interrupt vector table */
.text  ROM /* Code */
.switch  RAM /* Switch table information */
.const  RAM /* Constant data */
.cinit  RAM2 /* Initialization tables */
.data  RAM /* Initialized data */
.bss  RAM /* Global  static variables */
.sysmem  RAM /* Dynamic memory allocation area */
.stack  RAM /* Primary system stack */
}
± the working directory. For programs written in C language, it requires using the
run-time support library, rts55.lib for DSP system initialization. This can be
done by selecting Libraries under Category in the Linker dialogue box, and enter
the C55x run-time support library, rts55.lib. We can also specify different
directories to store the output executable file and map file. Figure 1.13 shows an
example of how to set the search paths for compiler, assembler, or linker.
6. Build and run the program:
± Once all the options are set, use Project!Rebuild All command to build the
project. If there are no errors, the CCS will generate the executable output
file, exp1.out. Before we can run the program, we need to load the executable
output file to the simulator from File!Load Program menu. Pick the file
exp1.out in A:Experiment1 and open it.
± Execute this program by choosing Debug!Run. DSP status at the bottom
left-hand corner of the simulator will be changed from DSP HALTED to DSP
RUNNING. The simulation process can be stopped withthe Debug!Halt
command. We can continue the program by reissuing the run command or
exiting the simulator by choosing File!Exit menu.
24 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
Figure 1.13 Setup search paths for C compiler, assembler, or linker
1.5.2 Experiment 1B ± Debugging Program on the CCS
The CCS has extended traditional DSP code generation tools by integrating a set of
editing, emulating, debugging, and analyzing capabilities in one entity. In this section of
the experiment, we will introduce some DSP program building steps and software
debugging capabilities including:
(a) the CCS standard tools,
(b) the advanced editing features,
(c) the CCS project environment, and
(d) the CCS debugging settings.
For a more detailed description of the CCS features and sophisticated configuration
settings, please refer to Code Composer Studio User's Guide [7].
Like most editors, the standard tool bar in Figure 1.12 allows users to create and open
files, cut, copy, and paste texts within and between files. It also has undo and re-do
capabilities to aid file editing. Finding or replacing texts can be done within one file or in
different files. The CCS built-in context-sensitive help menu is also located in the
standard toolbar menu. More advanced editing features are in the edit toolbar menu,
refer to Figure 1.12. It includes mark to, mark next, find match, and find next open
parenthesis capabilities for C programs. The features of out-indent and in-indent can be
used to move a selected block of text horizontally. There are four bookmarks that allow
users to create, remove, edit, and search bookmarks.
EXPERIMENTS USING CODE COMPOSER STUDIO 25
The project environment contains a C compiler, assembler, and linker for users to
build projects. The project toolbar menu (see Figure 1.12) gives users different choices
while working on projects. The compile only, incremental build, and build all functions
allow users to build the program more efficiently. Breakpoints permit users to set stop
points in the program and halt the DSP whenever the program executes at those
breakpoint locations. Probe points are used to transfer data files in and out of pro-
grams. The profiler can be used to measure the execution time of the program. It
provides program execution information, which can be used to analyze and identify
critical run-time blocks of the program. Both the probe point and profile will be
discussed in detail in the next section.
The debug toolbar menu illustrated in Figure 1.12 contains several step operations:
single step, step into a function, step over a function, and step out from a function back
to its caller function. It can also perform the run-to-cursor operation, which is a very
convenient feature that allows users to step through the code. The next three hot
buttons in the debug tool bar are run, halt, and animate. They allow users to execute,
stop, and animate the program at anytime. The watch-windows are used to monitor
variable contents. DSP CPU registers, data memory, and stack viewing windows
provide additional information for debugging programs. More custom options are
available from the pull-down menus, such as graphing data directly from memory
locations.
When we are developing and testing programs, we often need to check the values of
variables during program execution. In this experiment, we will apply debugging
settings such as breakpoints, step commands, and watch-window to understand the
CCS. The experiment can be divided into the following four steps.
1. Add and remove breakpoints:
± Start with Project!Open, select exp1 in the A:Experiment1 directory.
Build and load the experiment exp1.out. Double-click on the C file exp1.c in
the project-viewing window to open it from the source folder.
± Adding and removing a breakpoint to a specific line is quite simple. To add a
breakpoint, move the cursor to the line where we want to set a breakpoint. The
command to enable a breakpoint can be given from the Toggle Breakpoint hot
button on the project toolbar or by clicking the right mouse button and choosing
toggle breakpoint. The function key F9 is a shortcut key that also enables
breakpoints. Once a breakpoint is enabled, a red dot will appear on the left to
indicate where the breakpoint is set. The program will run up to that line without
exceeding it. To remove breakpoints, we can either toggle breakpoints one by one,
or we can select the Delete All tap from the debug tool bar to clear all the break-
points at once. Now put the cursor on the following line:
in_buffer[
i] ˆ sineTable[
i]; /* - set breakpoint */
and click the Toggle Breakpoint toolbar button (or press F9).
2. Set up viewing windows:
± On the standard tool menu bar click View!CPU Registers!CPU Registers
to open the CPU registers window. We can edit the contents of any
26 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
CPU register by double clicking on it. Right click on the CPU Register window
and select Allow Docking. We can now move and resize the window. Try
to change the temporary register T0 and accumulator AC0 to T0 ˆ 0x1234 and
AC0 ˆ 0x56789ABC.
± On the CCS menu bar click Tools!Command Window to add the Command
Window. We can resize and dock it as in the previous step. The command
window will appear each time we rebuild the project.
± We can customize the CCS display and settings using the workspace
feature. To save a workspace, click File!Workspace!Save Workspace and give
the workspace a name. When we restart CCS, we can reload that workspace by
clicking File!Workspace!Load Workspace and select the proper workspace
filename.
± Click View!Dis-Assembly on the menu bar to see the disassembly window.
Every time we reload an executable file, the disassembly window will appear
automatically.
3. Using the single step features:
± When using C programs, the C55x system uses a function called boot from the
run-time support library rts55.lib to initialize the system. After we load the
exp1.out, the program counter (PC) should be at the start of the boot function
and the assembly code, boot.asm, should be displayed in the disassembly
window. For a project starting with C programs, there must be a function called
main() from which the C functions logically begin to execute. We can issue the
command, Go Main, from the Debug menu to start the C program.
± After the Go Main command, the DSP will be halted at the location where the
function main() is. Hit the F8 key or click the single step button on the debug
toolbar repeatedly and single-step through the program exp1.c, watching the
values of the CPU registers change. Move the cursor to a different location in the
code and try the run-to-cursor command (hold down the Ctrl and F10 keys
simultaneously).
4. Resource monitoring:
± From View!Watch Window, open the Watch Window area. At run time, this
area shows the values of watched variables. Right-click on the Watch Window
area and choose Insert New Expression from the pop-up list. Type the output
buffer name, out_buffer, into the expression box and click OK, expand the
out_buffer to view each individual element of the buffer.
± From View!Memory, open a memory window and enter the starting address
of the in_buffer in data page to view the data in the input and output buffers.
Since global variables are defined globally, we can use the variable name as the
address for memory viewing.
± From View!Graph!Time/Frequency, open the Graphic Property dialogue. Set
the display parameters as shown in Figure 1.14. The CCS allows the user to plot
data directly from memory by specifying the memory location and its length.
± Set a breakpoint on the line of the following C statement:
EXPERIMENTS USING CODE COMPOSER STUDIO 27
Figure 1.14 Graphics display settings
in_buffer[
i] ˆ sineTable[
i]; /* - set breakpoint */
Start animation execution, and view CPU registers, in_buffer and out_buffer data
in both the watch-window and the memory window. Figure 1.15 shows one instant
snapshot of the animation. The yellow arrow represents the current program counter's
location, and the red dot shows where the breakpoint is set. The data and register values
in red color are the ones that have just been updated.
1.5.3 Experiment 1C ± File Input and Output
Probe point is a useful tool for algorithm development, such as simulating real-time
input and output operations. When a probe point is reached, the CCS can either read a
selected amount of data samples from a file on the host PC to DSP memory on the
target, or write processed data samples to the host PC. In the following experiment, we
will learn how to set up a probe point to transfer data from the example program to a
file on the host computer.
± Set the probe point at the end of the while {} loop at the line of the close bracket
as:
while(1)
{
... ...
} /* - set probe point on this line */
± where the data in the output buffer is ready to be transferred out. Put the cursor on
the line and click Toggle Probe Point. A blue dot on the left indicates the probe point
is set (refer to Figure 1.15).
28 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
Figure 1.15 CCS screen snapshot of the Experiment 1B
± From File!File I/O, open the file I/O dialogue box and select File Output tab.
From the Add File tab, enter exp1_out.dat as file name, then select Open. Using
the output variable name, out_buffer, as the address and 40 (BUF_SIZE) as the
length of the data block for transferring 40 data samples to the host computer
from the buffer every time the probe point is reached. Now select Add Probe Point
tab to connect the probe point with the output file exp1_out.dat as shown in
Figure 1.16.
± Restart the program. After execution, we can view the data file exp1_out.dat
using the built-in editor by issue File!Open command. If we want to view
or edit the data file using other editors/viewers, we need to exit the CCS or
disconnect the file from the File I/O.
An example data file is shown in Table 1.4. The first line contains the header
information in TI Hexadecimal format, which uses the syntax illustrated in Figure 1.17.
For the example given in Table 1.4, the data stored is in hexadecimal format with the
address of out_buffer at 0xa8 on data page and each block containing 40 (0x28) data
values. If we want to use probe to connect an input data file to the program, we will
need to use the same hex format to include a header in the input data file.
1.5.4 Experiment 1D ± Code Efficiency Analysis
The profiler can be used to measure the system execution status of specific segments of
the code. This feature gives users an immediate result about the program's performance.
EXPERIMENTS USING CODE COMPOSER STUDIO 29
Another Random Document on
Scribd Without Any Related Topics
I can sew better myself, was Hal's usual comment.
And it was true. Hal had a bedquilt nearly pieced, which he had
done on rainy days and by odd spells. I expect you think he was
something of a girl-boy. But then he was very sweet and nice.
Florence stood by the gate one afternoon, looking extremely
lovely in her blue and white gingham, and her curls tied back with a
bit of blue ribbon. Dot had been in the mud-pie business; and, if it
had proved profitable, she would no doubt have made a fortune for
the family.
Go in the house this minute, and get washed, commanded
Florence. What a naughty, dirty child you are!
Then a carriage passed by very slowly. A young man was driving,
and two ladies sat on the back seat. They looked as if they were
going to halt.
Florence's heart was in her mouth. She drew herself up in her
most stately attitude.
The young man turned; and the lady nearer her beckoned.
Florence stepped out slowly. She thought, with some pride, that,
if they wanted a drink, she had a goblet to offer them.
My little girl, said the lady, in a soft, clear voice, can you direct
us to a blacksmith's?
There is one on this road, rather more than a quarter of a mile
farther.
Thank you.
The other lady leaned over, and studied Florence. She had a
worn, faded, and fretful look; but some new expression lighted up
her sallow face.
Oh, she sighed, what a beautiful girl! Now, if I had a daughter
like that! I wonder if she lives in that forlorn old rookery?
A princess in disguise; and the young man laughed.
She was unusually lovely. At her age I had just such hair. But ah,
how one fades!
The straggling auburn hair, very thin on the top, hardly looked as
if it had once been like fine spun gold.
The trial of my life has been not having a daughter.
Mrs. Duncan had heard this plaint very often from her half-sister,
who had married a widower nearly three times her age. He had
made a very liberal provision for her during her life, but at her death
the fortune reverted to his family again. She had always bewailed
the fact of having no children; but boys were her abomination. Mrs.
Duncan's house was too noisy, with its four rollicking boys; but now
that George was growing to manhood he became rather more
endurable.
I do not believe the child could have belonged there, she
commenced again.
Because she was so pretty? asked George.
She doesn't look like a country girl.
But some country girls are very handsome, said Mrs. Duncan.
They do not possess this air of refinement generally. And did
you observe that she answered in a correct and ladylike manner?
Aunt Sophie is captivated. A clear case of love at first sight. Why
not adopt her?
It would be a charity to take her out of that hovel, if it is her
home.
I shouldn't think of such a thing now, Sophie, with your poor
health, said her sister.
There are some natures on which the least contradiction or
opposition acts instantly, rousing them to a spirit of defiance. For
several years Mrs. Duncan had urged her sister to adopt a child; but
she had never found one that answered her requirements. She was
not fond of the trouble of small children. Now that Mrs. Duncan had
advised contrarywise, Mrs. Osgood was seized with a perverse fit.
I am sure I need a companion, she returned with martyr-like
air.
Take a young woman then, who can be a companion.
Here is the blacksmith's, announced George. I suppose you
will have to find some place of refuge; and he laughed again gayly.
Where can we go?
George held a short conversation with the smith.
My house is just opposite, and the ladies will be welcome, the
latter said. It will take me about half an hour to repair your
mishap.
George conducted them thither. The good woman would fain
have invited them in; but they preferred sitting on the vine-covered
porch. Mrs. Osgood asked for a glass of water. O Florence! if you
had been there!
It happened after a while, that George and his mother walked
down the garden. Mrs. Green felt bound to entertain this stranger
cast upon her care, as she considered it.
Mrs. Osgood made some inquiries presently about the house they
had passed, with a small stream of water just below it.
Why, that's Granny Kenneth's, said Mrs. Green.
And who is the child,—almost a young lady?
Why, that must be Florence. Did she have long yeller curls? If
she was my gal she should braid 'em up decently. I wouldn't have
'em flyin' about.
And who is Florence?
Mrs. Osgood's curiosity must have been very great to induce her
to listen to the faulty grammar and country pronunciations. But she
listened to the story from beginning to end,—Joe, and Joe's wife,
and all the children, figuring largely in it.
And if Granny Kenneth'd had any sense, she would a bundled
'em all off to the poor-house. One of the neighbors here did want to
take Florence; but law! what a time they made! She's a peart, stuck-
up thing!
If Florence had heard this verdict against all her small industries
and neatnesses and ladylike habits, her heart would have been
almost broken. But there are a great many narrow-minded people in
this world, who can see no good except in their own way.
Mrs. Osgood made no comments. Presently the carriage was
repaired, and the accidental guests departed. They had a long ride
yet to take. George asked if there was any nearer way of getting to
Seabury.
There's a narrer road just below Granny Kenneth's,—the little
shanty by the crick. It's ruther hard trav'lin', but it cuts off nigh on
ter three miles.
I think we had better take it, said George. Even that will give
us a five-miles drive.
So they passed the cottage again. This time Hal was feeding the
chickens; Kit and Charlie swinging upon an old dilapidated apple-
tree; and Florence sat by the open window, sewing.
There's your princess! exclaimed George with a laugh.
Florence colored a little at beholding the party again.
Mrs. Duncan had come to Seabury, a rather mountainous place,
remarkable for its pure air, for the sake of her youngest son, Arthur,
who had been ill with a fever. Mrs. Osgood took an odd fancy to
accompany her. The seven years of her widowhood had not been
happy years, though she had a house like a palace. When she first
laid off mourning, she tried Newport and Saratoga; but somehow
she did not succeed in making a belle of herself, and that rather
mortified her.
Then she sank into invalidism; which tried everybody's patience
sorely.
Leaning back in the carriage now, she thought to herself, Yes, if
I only had some one of my own! Sister Duncan never did understand
me, or appreciate the delicacy of my constitution. Her nerves have
been blunted by those great rude boys. And that girl looks so refined
and graceful,—she would make a pleasant companion I am sure. But
I should want to take her away from her family: I never could
consent to any intimacy with them.
She ventured to broach her subject to Mrs. Duncan the next day.
Perhaps Mrs. Duncan had grown rather impatient with her sister's
whims and fancies; and she discouraged the plan on some very
sensible grounds. Mrs. Osgood felt like a martyr.
Yet the opposition roused her to attempt it. One day, a week
afterward perhaps, she hired a carriage, and was driven over to
Madison. George had gone back to the city, so there was no
question of having him for escort.
Granny Kenneth was much surprised at the appearance of so fine
a lady. She seized Dot, and scrubbed her face, her usual
employment upon the entrance of any one.
Mrs. Osgood held up her ruffled skirts as if afraid of
contamination.
Is your granddaughter at home? was asked in the most languid
of voices.
Flo, you mean? No: she hasn't come from school yet. Do walk in
and wait—that is—I mean—if you please, said Granny a good deal
flustered, while the little gray curls kept bobbing up and down.
Here's a clean cheer; and she gave one a whiff with her apron.
Poor Flossy. She had tried so hard to correct Granny's old-
fashioned words and pronunciations.
Thank you. Miss Florence embroiders, I believe.
Yes, she works baby-petticoats, and does 'em splendid.
And then Granny wondered if she, the fine lady, had any work for
Florence.
How glad Flo'll be, and vacation coming so soon, she thought in
the depth of her tender old soul.
And she's a genius at crochetin'! The laces and shawls and
hoods she's knit are a real wonder. They didn't do any thing of the
kind in my young days.
You must find it pretty hard to get along, condescended Mrs.
Osgood.
Yes; but the Lord allers provides some way. Joe's gone in a
store,—Mr. Terry's. He's next to Florence, went on Granny in
sublime disregard of her pronoun.
Mrs. Osgood took an inventory of the little room, and waited
rather impatiently. Then she asked for a glass of water.
O Granny! how could you have been so forgetful! To take that
old, thick, greenish glass tumbler when Flossy's choice goblet stood
on the shelf above! And then to fill it in the pail, and let the water
dribble!
Granny wondered whether it would be polite to entertain her or
not. But just then there was a crash and a splash; and Dot and the
water-pail were in the middle of the floor.
Here's a chance! exclaimed Kit, pausing in the doorway. Give
us a hook and line, Granny: Dot's mouth is just at an angle of ten
degrees, good for a bite.
A wail, sure enough! said Charlie. Wring her out, and hang her
up to dry.
Oh, dear! and Granny, much disconcerted, sat Dot wrong side
up on a chair, and the result was a fresh tumble.
It was Hal who picked her up tenderly,—poor wet baby, with a
big red lump on her forehead, and dismal cries issuing from the
mouth that seemed to run all round her head.
Stay out there till I wipe up, said Granny to the others. Then
I'll get Dot a dry dress. I never did see such an onlucky child—and
company too. What will Flo say!
For Florence came tripping up the path, knitting her delicate
brows in consternation.
Never you mind. There's a lady in the parlor who's been waitin'.
Oh, my! what did I do with that floor-cloth?
A lady?
Yes: run right along.
Luckily the door was shut between. Florence gave her curls a
twist and a smoothing with her fingers, took off her soiled white
apron, pulled her dress out here and there, stepped over the pools
of water, and entered.
Mrs. Osgood admired her self-possession, and pitied the poor
child profoundly. The flush and partial embarrassment were very
becoming to her.
That lady did not mean to rush headlong into her proposal. She
broke the ground delicately by inquiring about the embroidering;
and Florence brought some to show her.
Who taught you? she asked in surprise.
No one; and Florence colored a little. I did not do the first as
neatly, but it is quite easy after one is fairly started.
I really do not see how you find time, with going to school; and
this persevering industry did touch Mrs. Osgood's heart.
I cannot do very much, answered Florence with a sigh. But it
will soon be vacation.
How old are you?
I shall be fifteen the last of this month.
What a family your grandmother has on her hands!
Yes. If my father had lived, it would have been very different.
A touching expression overspread Florence's face, and made her
lovelier than ever in Mrs. Osgood's eyes.
She certainly is very pretty, that lady thought; and how
attractive such a daughter would be in my house! I should live my
young life over again in her.
For Mrs. Osgood had found that the days for charming young
men were over, and prosy middle-aged people were little to her
taste. No woman ever clung to youth with a greater longing.
What do you study at school? she asked.
Only the English branches. I have been thinking of—of becoming
a teacher, said Florence hesitatingly.
You would have a poor opportunity in this little town.
I might go away; and Florence sighed again.
You have never studied music, I suppose.
No: I have had no opportunity, returned Florence honestly
enough.
Do you sing?
Yes. And I love music so very, very much! I do mean to learn by
and by, if it is possible.
I wish you would sing something for me,—a little school-song,
or any thing you are familiar with.
Florence glanced up in amazement; and for a few moments was
awkwardly silent.
I should like to hear your voice. It is very pleasant in talking,
and ought to be musical in singing.
Florence was a good deal flattered; and then she had the
consciousness that she was one of the best singers in school. So she
ran over the songs in her own mind, and selected Natalie, the Maid
of the Mill, which she was very familiar with.
She sang it beautifully. Florence was one of the children who are
always good in an emergency. She was seldom flustered, as
Granny expressed it, and always seemed to know how to make the
best of herself. And, as she saw the pleasure in Mrs. Osgood's face,
her own heart beat with satisfaction.
That is really charming. A little cultivation would make your
voice very fine indeed. What a pity that you should be buried in this
little town!
Do you think—that I could—do any thing with it? asked
Florence in a tremor of delight.
I suppose your grandmother would not stand in the way of your
advancement? questioned Mrs. Osgood.
Oh, no! And then if I could do something—
Florence felt that she ought to add, for the others, but
somehow she did not. She wondered if Mrs. Osgood was a music-
teacher, or a professional singer. But she did not like to ask.
There is my carriage, said Mrs. Osgood, as a man drove slowly
round. I am spending a few weeks at some distance from here, and
wished to have you do a little flannel embroidery for me. When will
your vacation commence?
In about ten days,—the first of July.
I wish to see you when we can have a longer interview. I will
come over again then.
Mrs. Osgood rose, and shook out her elegant grenadine dress,
much trimmed and ruffled. On her wrists were beautiful bracelets,
and her watch-chain glittered with every movement. Then she really
smiled very sweetly upon the young girl; and Florence was charmed.
Some dim recollection passed over her mind.
Oh! she said, were you not in a carriage that stopped here
some days ago. Another lady and a young gentleman—
Yes, answered Mrs. Osgood, pleased at being remembered.
And, my dear, I took a great fancy to you that day. You are so
different from the majority of country girls, that it is a pity you
should have no better chance.
The longing and eloquent eyes of Florence said more than words.
Yes. I will see you again; and I may, perhaps, think of
something to your advantage.
There was a mode of egress through this best-room, though
Granny had brought her guest in by the kitchen way. Florence
opened the door now.
What a lovely, graceful child! thought Mrs. Osgood; and she
scrutinized her from head to feet.
Florence watched the carriage out of sight in a half-dream. How
long she would have stood in a brown study is uncertain; but Granny
came in to get some dry clothes for Dot.
What did she want of you? exclaimed Charlie, all curiosity. And
what were you singing for? Oh, my! wasn't she splendid?
You sang like a bird, said Hal in wide-eyed wonder as well. Did
she ask you?
Of course. You don't suppose I would offer to sing for a
stranger,—a lady too?
Did she like it?
Yes. She thought I might—that is, if I had any opportunity—oh,
I wish we were a little richer! and Florence burst into a flood of
hysterical tears.
I wish we were; and Hal gave her hand a soft squeeze. If you
could learn to play on the melodeon at church, and give music-
lessons—
The vision called up a heaven of delight to poor Flossy.
But what did she want? asked Granny in a great puzzle, putting
Dot's foot through the sleeve of her dress, and tying the neck-string
in garter fashion.
I do believe she is a singer herself. Maybe she belongs to a
company who give concerts; but then she was dressed so elegantly.
They make lots of money, said Kit with a sagacious nod of the
head. It's what I'm going to be, only I shall have a fiddle.
And a scalp-lock.
Charlie pulled this ornamentation to its fullest height, which was
considerable, as Kit's hair needed cutting.
Oh! suppose she was, said Hal. And suppose she wanted to
take Flossy, and teach her music,—why, it's like your plan, you know,
only it isn't an old gentleman; and I don't believe she has any little
girls,—I mean a little girl who died. Did she ask for a drink, Granny?
Yes; and then Dot pulled over the water-pail. Oh, my! if I
haven't put this dress on upside down, and the string's in a hard
knot. Whatever shall I do? And, Flossy, I forgot all about the gobler.
I took the first thing that came to hand.
Not that old tumbler with a nick in the edge? And it is goblet. I
do wish you'd learn to call things by their right names! exclaimed
Florence in vexation.
It's the very same, isn't it? began Charlie, only, as Hal said, it
isn't an old gentleman. Oh, suppose it should come true! And if Kit
should have a fiddle like black Jake.
And if you should run away, laughed Hal. I don't believe you
can find a better time than this present moment. Kit, you had better
go after the cows.
Charlie started too, upon Hal's suggestion. Florence gave a little
sniff, and betook herself to the next room.
Oh, dear! How poor and mean and tumbled about their house
always was! No, not always, but if any one ever came. Dot chose
just that moment to be unfortunate; and then that Granny should
have used that forlorn old tumbler. She doubted very much if the
lady would ever come again.
So Flossy had a good cry from wounded vanity, and then felt
better. Hal took Dot out with him to feed the chickens, and Granny
prepared the table.
Still Florence's lady was the theme of comment and wonder for
several days, although the child insisted that she only came to get
some embroidering done. All further speculations seemed too wild
for sober brains.
But it is so odd that she asked you to sing, said Hal. And I do
believe something will come of it.
Florence gave a little despairing sniff.
M
CHAPTER VIII.
FLORENCE IN STATE.
rs. Osgood leaned back in the carriage,—it was the very best
that Seabury afforded,—and, looking out on the pleasant
sunshine and waving trees, considered the subject before her. If she
took Florence, she would have a governess in the house, and go on
as rapidly as possible with the finishing process. Music should be the
first thing: the child did have a lovely voice, and such fair, slender
hands! In a year she would be quite presentable. How vexed all the
Osgood nieces would be! They were continually hinting at visits, and
would be delighted at having Aunt Osgood take them up. But
somehow she had a grudge against her husband's relatives, because
the property reverted to them in the end.
And then she fancied herself riding out with this beautiful
daughter by her side, or stopping at hotels where every one would
wonder who that lovely girl could be! And Florence would certainly
be most grateful for the change. It was a deed of charity to rescue
the poor child from the life before her, with no better prospect than
that of a school-teacher. She certainly had some ideas and ambitions
beyond her sphere.
School closed presently, and the children were wild with delight.
They had a great time on examination day, and Florence acquitted
herself finely. Mr. Fielder was very proud of her.
If you can go to school another year, and improve as much, he
said, I can almost promise you a very good situation.
Flossy's dream in respect to her elegant lady was fading, and she
came back to humbler prospects quite thankfully.
What Granny was to do with the children through vacation she
hardly knew.
Oh, you needn't worry! said Charlie consolingly. Kit and me are
going out in the woods; and we'll build a stunning log-hut, or make
a cave—
O Charlie, if you would be a little more careful! Kit and I.
I can't be always bothering! Mr. Fielder almost wears me out, so
you might let me have a little rest in vacation.
'For spelling is vexation,
And writing is bad:
Geography it puzzles me,
And grammar makes me mad.'
With that Charlie perched herself on the gate-post, and began to
whistle.
If Charlie only had been a boy! groaned Florence.
On Monday of the first week they washed. Florence assisted; but
she hurried to get herself dressed in the afternoon, for fear some
one might come. And then she wondered a little what she ought to
do. Embroidering and fancy work appeared to be dull just now; and
she would have two months in which she might earn considerable
money, if it only came. For, with all her small vanities and particular
ways, she was not indolent.
On Tuesday they began their ironing at an early hour. There were
Florence's pretty dresses and aprons, nothing very costly, but a
dainty ruffle here and there added to the general grace. These same
ruffles were a great trouble to some of the old ladies in Madison,
who didn't see how Granny Kenneth could let Florence waste her
time in such nonsense while she slaved herself to death!
Florence had twisted her hair in a knot, and her dress was rather
the worse for wear; but she worked away cheerfully. Her pile of
clothes was decreasing very fast.
Suddenly a sound of carriage-wheels startled her; and, glancing
up, she uttered a frightened exclamation.
O Granny! it's the lady again, and I look like a fright! What shall
I do? Won't you go and ask her in? and you look dreadful too! Put
on your other sacque. There! I'll run and tidy up a bit.
She made a snatch at the brush and comb, and hurried up in the
boys' room.
Oh, dear! How red I am in the face! It's too bad; and she felt
tempted to cry, but she knew that would only make matters worse.
So she let down her shining hair, brushed it out, and wound it round
her fingers in curls. Then Granny came plodding up stairs.
I told her you were busy, but that you'd be ready in a few
minutes, she explained.
Why didn't you think to bring up one of my clean dresses?
To be sure! which one?
The pink calico, I guess. Oh! and the braided white apron.
Down went Granny. Ah! many a step had she taken for these
children, weary ones, and yet cheerfully done. Would they ever think
of it?
Florence was not long in making herself neat and presentable,
but the flushed face still troubled her. She viewed herself critically in
the cracked glass, and then ran down, pausing to fan a few
moments with the cape of an old sun-bonnet, the nearest thing at
hand.
Do I look decent, Granny? she said apprehensively.
To be sure you do, and nice too.
Granny's eyes expressed her admiration.
Florence ventured in timidly, and the lady inclined her head.
I am sorry that I have kept you waiting so long, but it was
unavoidable; and the child made a little halt to wonder if her long
word sounded well.
I suppose I took you somewhat by surprise. Are you very busy
to-day?
Not very, answered Florence at random, her heart beating
violently.
And quite well? but I hardly need ask the question.
I am always well, thank you, with a touch of grace.
How fortunate! Now, I have such wretched health, and my
nerves are weak beyond description.
Florence gave a glance of quick sympathy, not unmixed with
admiration. There was something very romantic about the languid
lady.
If you are quite at liberty, Mrs. Osgood began, I should like to
have you drive out with me. I have a great deal to say to you, and
we shall not be interrupted.
Florence could hardly credit her hearing. To be asked to ride with
so grand a lady!
Oh! and then she paused and colored.
Would you like to go?
Very, very much indeed; and the young face was full of
pleasure.
Well, get yourself ready; and, if you will send your grandmother
to me, I will explain.
Florence felt as if she were in a dream. Then she wondered what
she ought to wear. She had a pretty light gray dress and sacque for
Sunday best, and a new white dress; but her visitor's dress was
gray, and that decided her. So she took the articles out of the old-
fashioned wardrobe, and summoned Granny.
Granny was dazed. Where is she going to take you? she asked
in helpless astonishment.
I don't know. She will tell you, I suppose.
But, Flo, I have heerd of girls being kidnapped or something;
and Granny's face turned pale with fear.
Nonsense! returned Flossy with a toss of the curls. She could
not even trouble herself about Granny's mispronunciation just then.
You don't know—
I guess she won't eat me up. Any how, I am going.
Florence uttered this with a touch of imperiousness. Granny felt
that she would have little influence over her, so she entered the
room where the guest was seated.
Mrs. Kenneth, the lady began in her most impressive and
gracious manner, when I was here a few days ago, I took a great
fancy to your granddaughter. My name is Osgood; and I am staying
at Seabury with my sister, Mrs. Duncan. And although you may
hesitate to trust Florence with a stranger, she will be quite safe, I
assure you; and if you are willing, therefore, I should like to take her
out for a few hours. I have some plans that may be greatly to the
child's advantage, I think.
You'll be sure to bring her back, asked Granny in a spasm of
anxious terror, which showed in her eyes.
Why, certainly! My poor woman, I cannot blame you for this
carefulness; for the worn face with its eagerness touched Mrs.
Osgood. My brother-in-law, Mr. Duncan, is a well-known merchant
in New York; and I think you will confess when I return Florence this
afternoon, that the ride has been no injury to her.
Granny could make no further objections, and yet she did not
feel quite at ease. But Florence entered looking so bright and
expectant, that she had not the heart to disappoint her, so she kept
her fears to herself.
You must not feel troubled, Mrs. Osgood deigned to say, as she
rose rather haughtily. You will find my promises perfectly reliable.
You needn't finish my pieces, Florence whispered softly to
Granny at the door. I shall be back time enough; and if the fire is
out I'll wait till to-morrow They are my ruffled aprons, and—
Mrs. Osgood beckoned her with a smile and an inclination of the
head. Florence felt as if she were being bewitched.
Granny watched her as she stepped into the carriage.
If she'd been born a lady she couldn't act more like one. It's a
great pity—
A few tears finished Granny's sentence. All the others were more
content with their poverty than Florence.
So she went back to her ironing with a heart into which had crept
some strange misgiving. Hal was out; Joe never came home to
dinner; so Granny gave the children a piece of bread all round, and
kept going steadily on until the last ruffled apron had been taken out
of the pile.
Very long indeed the hours seemed. Oh, if any harm should befall
her beautiful, darling Flossy! Poor Joe, in his grave, had loved her so
well!
Flossy meanwhile was having a most delightful time.
I am going to take you to Salem, Mrs. Osgood said, after
Florence had begun to feel quite at home with her. We will have our
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.
More than just a book-buying platform, we strive to be a bridge
connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.
Join us on a journey of knowledge exploration, passion nurturing, and
personal growth every day!
ebookbell.com

More Related Content

PDF
Realtime Digital Signal Processing Implementations And Applications 2nd Editi...
PDF
Full download Real Time Digital Signal Processing Implementation and Applicat...
PDF
Data Acquisition and Signal Processing for Smart Sensors Nikolay V. Kirianaki
PDF
Data Acquisition and Signal Processing for Smart Sensors Nikolay V. Kirianaki
PDF
Digital Aliasfree Signal Processing Ivars Bilinskis
PDF
Protocols And Architectures For Wireless Sensor Networks 1st Edition Holger Karl
PDF
Software Defined Radio Enabling Technologies Walter Tuttlebeeeds
PDF
Software Defined Radio Origins Drivers And International Perspectives Walter ...
Realtime Digital Signal Processing Implementations And Applications 2nd Editi...
Full download Real Time Digital Signal Processing Implementation and Applicat...
Data Acquisition and Signal Processing for Smart Sensors Nikolay V. Kirianaki
Data Acquisition and Signal Processing for Smart Sensors Nikolay V. Kirianaki
Digital Aliasfree Signal Processing Ivars Bilinskis
Protocols And Architectures For Wireless Sensor Networks 1st Edition Holger Karl
Software Defined Radio Enabling Technologies Walter Tuttlebeeeds
Software Defined Radio Origins Drivers And International Perspectives Walter ...

Similar to Real Time Digital Signal Processing Implementations Applications And Experiments With The Tms320c55x Sen M Kuo (20)

PDF
Emerging Wireless Multimedia Services And Technologies Apostolis Salkintzis
PDF
Display Interfaces Fundamentals Standards 1st Edition Robert L Myers
PDF
Advances In Timedomain Computational Electromagnetic Methods Qiang Ren
PDF
Enabling Technologies for Mobile Services The MobiLife Book 1st Edition Mika ...
PDF
Programming Mobile Devices An Introduction for Practitioners 1st Edition Tomm...
PDF
The IMS IP Multimedia Concepts and Services Second Edition Miikka Poikselka
PDF
Understanding Digital Terrestrial Broadcasting Seamus Oleary
PDF
Wireless Local Loops Theory and Applications 1st Edition Peter Stavroulakis
PDF
The Ims Ip Multimedia Concepts And Services 2nd Edition Miikka Poikselka Aki ...
PDF
Next Generation Network Services Technologies And Strategies Neill Wilkinsonauth
PDF
Error Control Coding From Theory to Practice 1st Edition Peter Sweeney
PDF
Digital Signal Processing and Applications Second Edition Dag Stranneby
PDF
Realtime Digital Signal Processing Fundamentals Implementations And Applicati...
PDF
Queueing Modelling Fundamentals With Applications In Communication Networks S...
PDF
Digital Audio Broadcasting Principles and Applications of Digital Radio 2nd E...
PDF
Software defined radio enabling technologies 1st Edition Tuttlebee
PDF
Interactive TV Technology Markets 1st Edition H.O. Srivastava
PDF
Interactive TV Technology Markets 1st Edition H.O. Srivastava
PDF
Satellite Networking Principles and Protocols 1st Edition Zhili Sun
PDF
Rapidio The Embedded System Interconnect 1st Edition Sam Fuller
Emerging Wireless Multimedia Services And Technologies Apostolis Salkintzis
Display Interfaces Fundamentals Standards 1st Edition Robert L Myers
Advances In Timedomain Computational Electromagnetic Methods Qiang Ren
Enabling Technologies for Mobile Services The MobiLife Book 1st Edition Mika ...
Programming Mobile Devices An Introduction for Practitioners 1st Edition Tomm...
The IMS IP Multimedia Concepts and Services Second Edition Miikka Poikselka
Understanding Digital Terrestrial Broadcasting Seamus Oleary
Wireless Local Loops Theory and Applications 1st Edition Peter Stavroulakis
The Ims Ip Multimedia Concepts And Services 2nd Edition Miikka Poikselka Aki ...
Next Generation Network Services Technologies And Strategies Neill Wilkinsonauth
Error Control Coding From Theory to Practice 1st Edition Peter Sweeney
Digital Signal Processing and Applications Second Edition Dag Stranneby
Realtime Digital Signal Processing Fundamentals Implementations And Applicati...
Queueing Modelling Fundamentals With Applications In Communication Networks S...
Digital Audio Broadcasting Principles and Applications of Digital Radio 2nd E...
Software defined radio enabling technologies 1st Edition Tuttlebee
Interactive TV Technology Markets 1st Edition H.O. Srivastava
Interactive TV Technology Markets 1st Edition H.O. Srivastava
Satellite Networking Principles and Protocols 1st Edition Zhili Sun
Rapidio The Embedded System Interconnect 1st Edition Sam Fuller
Ad

More from murisademol (6)

PDF
Real Time Leadership Development Paul R Yost Mary Mannion Plunkettauth
PDF
Recent Advances In Polyphenol Research Volume 1 Vincenzo Lattanzioeds
PDF
Recommendations For Design And Analysis Of Earth Structures Using Geosyntheti...
PDF
Recommendations Of The Committee For Waterfront Structures Harbours And Water...
PDF
Recent Advances In Polyphenol Research Volume 3 Stephane Quideaueds
PDF
Updating The Interpretive Turn New Arguments In Hermeneutics Michiel Meijer
Real Time Leadership Development Paul R Yost Mary Mannion Plunkettauth
Recent Advances In Polyphenol Research Volume 1 Vincenzo Lattanzioeds
Recommendations For Design And Analysis Of Earth Structures Using Geosyntheti...
Recommendations Of The Committee For Waterfront Structures Harbours And Water...
Recent Advances In Polyphenol Research Volume 3 Stephane Quideaueds
Updating The Interpretive Turn New Arguments In Hermeneutics Michiel Meijer
Ad

Recently uploaded (20)

PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Lesson notes of climatology university.
PPTX
Cell Structure & Organelles in detailed.
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
Computing-Curriculum for Schools in Ghana
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PPTX
GDM (1) (1).pptx small presentation for students
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
Final Presentation General Medicine 03-08-2024.pptx
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Insiders guide to clinical Medicine.pdf
Lesson notes of climatology university.
Cell Structure & Organelles in detailed.
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
O5-L3 Freight Transport Ops (International) V1.pdf
STATICS OF THE RIGID BODIES Hibbelers.pdf
Anesthesia in Laparoscopic Surgery in India
Computing-Curriculum for Schools in Ghana
Abdominal Access Techniques with Prof. Dr. R K Mishra
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Renaissance Architecture: A Journey from Faith to Humanism
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
GDM (1) (1).pptx small presentation for students
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
FourierSeries-QuestionsWithAnswers(Part-A).pdf

Real Time Digital Signal Processing Implementations Applications And Experiments With The Tms320c55x Sen M Kuo

  • 1. Real Time Digital Signal Processing Implementations Applications And Experiments With The Tms320c55x Sen M Kuo download https://ebookbell.com/product/real-time-digital-signal- processing-implementations-applications-and-experiments-with-the- tms320c55x-sen-m-kuo-4311340 Explore and download more ebooks at ebookbell.com
  • 2. Here are some recommended products that we believe you will be interested in. You can click the link to download. Realtime Digital Signal Processing Implementations And Applications 2nd Edition Sen M Kuo https://ebookbell.com/product/realtime-digital-signal-processing- implementations-and-applications-2nd-edition-sen-m-kuo-33786762 Realtime Digital Signal Processing Fundamentals Implementations And Applications 3rd Sen M Kuo https://ebookbell.com/product/realtime-digital-signal-processing- fundamentals-implementations-and-applications-3rd-sen-m-kuo-5331202 Realtime Digital Signal Processing From Matlab To C With The Tms320c6x Dsps 2nd Ed Wright https://ebookbell.com/product/realtime-digital-signal-processing-from- matlab-to-c-with-the-tms320c6x-dsps-2nd-ed-wright-5145054 Realtime Digital Signal Processing Based On The Tms320c6000 Nasser Kehtarnavaz https://ebookbell.com/product/realtime-digital-signal-processing- based-on-the-tms320c6000-nasser-kehtarnavaz-992478
  • 3. Realtime Digital Signal Processing From Matlab To C With The Tms320c6x Dsps Third Edition 3rd Ed Morrow https://ebookbell.com/product/realtime-digital-signal-processing-from- matlab-to-c-with-the-tms320c6x-dsps-third-edition-3rd-ed- morrow-9954322 Realtime Digital Signal Processing From Matlab To C With The Tms320c6x Dsk Welch https://ebookbell.com/product/realtime-digital-signal-processing-from- matlab-to-c-with-the-tms320c6x-dsk-welch-9955500 Realtime Digital Signal Processing From Matlab To C With The Tms320c6x Dsps Third Edition 3rd Edition Michael G Morrow Cameron Hg Wright Thad B Welch Michael G Morrow https://ebookbell.com/product/realtime-digital-signal-processing-from- matlab-to-c-with-the-tms320c6x-dsps-third-edition-3rd-edition-michael- g-morrow-cameron-hg-wright-thad-b-welch-michael-g-morrow-7384218 Architecting Highperformance Embedded Systems Design And Build Highperformance Realtime Digital Systems Based On Fpgas And Custom Circuits Ledin https://ebookbell.com/product/architecting-highperformance-embedded- systems-design-and-build-highperformance-realtime-digital-systems- based-on-fpgas-and-custom-circuits-ledin-34810328 Indigeneity In Real Time The Digital Making Of Oaxacalifornia Ingrid Kummels https://ebookbell.com/product/indigeneity-in-real-time-the-digital- making-of-oaxacalifornia-ingrid-kummels-51199030
  • 5. Real-Time Digital Signal Processing Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee Copyright # 2001 John Wiley & Sons Ltd ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
  • 6. Real-Time Digital Signal Processing Implementations, Applications, and Experiments with the TMS320C55X Sen M Kuo Northern Illinois University, DeKalb, Illinois, USA Bob H Lee Texas Instruments, Inc., Schaumburg, Illinois, USA JOHN WILEY & SONS, LTD. Chichester New York Weinheim Brisbane Singapore Toronto Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee Copyright # 2001 John Wiley Sons Ltd ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
  • 7. Copyright # 2001 by John Wiley Sons, Ltd Baffins Lane, Chichester, West Sussex, PO 19 1UD, England National 01243 779777 International (‡44) 1243 779777 e-mail (for orders and customer service enquiries): cs-books@wiley.co.uk Visit our Home Page on http://www.wiley.co.uk or http://www.wiley.com All Rights Reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted, in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except under the terms of the Copyright Designs and Patents Act 1988 or under the terms of a licence issued by the Copyright Licensing Agency, 90 Tottenham Court Road, London, W1P 9HE, UK, without the permission in writing of the Publisher, with the exception of any material supplied specifically for the purpose of being entered and executed on a computer system, for exclusive use by the purchaser of the publication. Neither the authors nor John Wiley Sons Ltd accept any responsibility or liability for loss or damage occasioned to any person or property through using the material, instructions, methods or ideas contained herein, or acting or refraining from acting as a result of such use. The authors and Publisher expressly disclaim all implied warranties, including merchantability of fitness for any particular purpose. There will be no duty on the authors or Publisher to correct any errors or defects in the software. Designations used by companies to distinguish their products are often claimed as trademarks. In all instances where John Wiley Sons is aware of a claim, the product names appear in initial capital or capital letters. Readers, however, should contact the appropriate companies for more complete information regarding trademarks and registration. Other Wiley Editorial Offices John Wiley Sons, Inc., 605 Third Avenue, New York, NY 10158±0012, USA Wiley-VCH Verlag GmbH Pappelallee 3, D-69469 Weinheim, Germany Jacaranda Wiley Ltd, 33 Park Road, Milton, Queensland 4064, Australia John Wiley Sons (Canada) Ltd, 22 Worcester Road Rexdale, Ontario, M9W 1L1, Canada John Wiley Sons (Asia) Pte Ltd, 2 Clementi Loop #02±01, Jin Xing Distripark, Singapore 129809 Library of Congress Cataloging-in-Publication Data Kuo, Sen M. (Sen-Maw) Real-time digital signal processing: implementations, applications, and experiments with the TMS320C55x / Sen M. Kuo, Bob H. Lee p. cm. Includes bibliographical references and index. ISBN 0±470±84137±0 1. Signal processingÐDigital techniques. 2. Texas Instruments TMS320 series microprocessors. I. Lee, Bob H. II. Title. TK5102.9 .K86 2001 621.3820 2Ðdc21 2001026651 British Library Cataloguing in Publication Data A catalogue record for this book is available from the British Library ISBN 0 470 84137 0 Typeset by Kolam Information Services Pvt. Ltd, Pondicherry, India Printed and bound in Great Britain by Antony Rowe Ltd This book is printed on acid-free paper responsibly manufactured from sustainable forestry, in which at least two trees are planted for each one used for paper production. Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee Copyright # 2001 John Wiley Sons Ltd ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
  • 8. To my wife Paolien, and children Jennifer, Kevin, and Kathleen. ± Sen M. Kuo To my dear wife Vikki and daughter Jenni. ± Bob H. Lee
  • 9. Contents Preface xv 1 Introduction to Real-Time Digital Signal Processing 1 1.1 Basic Elements of Real-Time DSP Systems 2 1.2 Input and Output Channels 3 1.2.1 Input Signal Conditioning 3 1.2.2 A/D Conversion 4 1.2.3 Sampling 5 1.2.4 Quantizing and Encoding 7 1.2.5 D/A Conversion 9 1.2.6 Input/Output Devices 9 1.3 DSP Hardware 11 1.3.1 DSP Hardware Options 11 1.3.2 Fixed- and Floating-Point Devices 13 1.3.3 Real-Time Constraints 14 1.4 DSP System Design 14 1.4.1 Algorithm Development 14 1.4.2 Selection of DSP Chips 16 1.4.3 Software Development 17 1.4.4 High-Level Software Development Tools 18 1.5 Experiments Using Code Composer Studio 19 1.5.1 Experiment 1A ± Using the CCS and the TMS320C55x Simulator 20 1.5.2 Experiment 1B ± Debugging Program on the CCS 25 1.5.3 Experiment 1C ± File Input and Output 28 1.5.4 Experiment 1D ± Code Efficiency Analysis 29 1.5.5 Experiment 1E ± General Extension Language 32 References 33 Exercises 33 2 Introduction to TMS320C55x Digital Signal Processor 35 2.1 Introduction 35 2.2 TMS320C55x Architecture 36 2.2.1 TMS320C55x Architecture Overview 36 2.2.2 TMS320C55x Buses 39 2.2.3 TMS320C55x Memory Map 40 Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee Copyright # 2001 John Wiley Sons Ltd ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
  • 10. 2.3 Software Development Tools 40 2.3.1 C Compiler 42 2.3.2 Assembler 44 2.3.3 Linker 46 2.3.4 Code Composer Studio 48 2.3.5 Assembly Statement Syntax 49 2.4 TMS320C55x Addressing Modes 50 2.4.1 Direct Addressing Mode 52 2.4.2 Indirect Addressing Mode 53 2.4.3 Absolute Addressing Mode 56 2.4.4 Memory-Mapped Register Addressing Mode 56 2.4.5 Register Bits Addressing Mode 57 2.4.6 Circular Addressing Mode 58 2.5 Pipeline and Parallelism 59 2.5.1 TMS320C55x Pipeline 59 2.5.2 Parallel Execution 60 2.6 TMS320C55x Instruction Set 63 2.6.1 Arithmetic Instructions 63 2.6.2 Logic and Bits Manipulation Instructions 64 2.6.3 Move Instruction 65 2.6.4 Program Flow Control Instructions 66 2.7 Mixed C and Assembly Language Programming 68 2.8 Experiments ± Assembly Programming Basics 70 2.8.1 Experiment 2A ± Interfacing C with Assembly Code 71 2.8.2 Experiment 2B ± Addressing Mode Experiments 72 References 75 Exercises 75 3 DSP Fundamentals and Implementation Considerations 77 3.1 Digital Signals and Systems 77 3.1.1 Elementary Digital Signals 77 3.1.2 Block Diagram Representation of Digital Systems 79 3.1.3 Impulse Response of Digital Systems 83 3.2 Introduction to Digital Filters 83 3.2.1 FIR Filters and Power Estimators 84 3.2.2 Response of Linear Systems 87 3.2.3 IIR Filters 88 3.3 Introduction to Random Variables 90 3.3.1 Review of Probability and Random Variables 90 3.3.2 Operations on Random Variables 92 3.4 Fixed-Point Representation and Arithmetic 95 3.5 Quantization Errors 98 3.5.1 Input Quantization Noise 98 3.5.2 Coefficient Quantization Noise 101 3.5.3 Roundoff Noise 102 3.6 Overflow and Solutions 103 3.6.1 Saturation Arithmetic 103 3.6.2 Overflow Handling 104 3.6.3 Scaling of Signals 105 3.7 Implementation Procedure for Real-Time Applications 107 viii CONTENTS
  • 11. 3.8 Experiments of Fixed-Point Implementations 108 3.8.1 Experiment 3A ± Quantization of Sinusoidal Signals 109 3.8.2 Experiment 3B ± Quantization of Speech Signals 111 3.8.3 Experiment 3C ± Overflow and Saturation Arithmetic 112 3.8.4 Experiment 3D ± Quantization of Coefficients 115 3.8.5 Experiment 3E ± Synthesizing Sine Function 117 References 121 Exercises 122 4 Frequency Analysis 127 4.1 Fourier Series and Transform 127 4.1.1 Fourier Series 127 4.1.2 Fourier Transform 130 4.2 The z-Transforms 133 4.2.1 Definitions and Basic Properties 133 4.2.2 Inverse z-Transform 136 4.3 System Concepts 141 4.3.1 Transfer Functions 141 4.3.2 Digital Filters 143 4.3.3 Poles and Zeros 144 4.3.4 Frequency Responses 148 4.4 Discrete Fourier Transform 152 4.4.1 Discrete-Time Fourier Series and Transform 152 4.4.2 Aliasing and Folding 154 4.4.3 Discrete Fourier Transform 157 4.4.4 Fast Fourier Transform 159 4.5 Applications 160 4.5.1 Design of Simple Notch Filters 160 4.5.2 Analysis of Room Acoustics 162 4.6 Experiments Using the TMS320C55x 165 4.6.1 Experiment 4A ± Twiddle Factor Generation 167 4.6.2 Experiment 4B ± Complex Data Operation 169 4.6.3 Experiment 4C ± Implementation of DFT 171 4.6.4 Experiment 4D ± Experiment Using Assembly Routines 173 References 176 Exercises 176 5 Design and Implementation of FIR Filters 181 5.1 Introduction to Digital Filters 181 5.1.1 Filter Characteristics 182 5.1.2 Filter Types 183 5.1.3 Filter Specifications 185 5.2 FIR Filtering 189 5.2.1 Linear Convolution 189 5.2.2 Some Simple FIR Filters 192 5.2.3 Linear Phase FIR Filters 194 5.2.4 Realization of FIR Filters 198 5.3 Design of FIR Filters 201 5.3.1 Filter Design Procedure 201 5.3.2 Fourier Series Method 202 5.3.3 Gibbs Phenomenon 205 CONTENTS ix
  • 12. 5.3.4 Window Functions 208 5.3.5 Frequency Sampling Method 214 5.4 Design of FIR Filters Using MATLAB 219 5.5 Implementation Considerations 221 5.5.1 Software Implementations 221 5.5.2 Quantization Effects in FIR Filters 223 5.6 Experiments Using the TMS320C55x 225 5.6.1 Experiment 5A ± Implementation of Block FIR Filter 227 5.6.2 Experiment 5B ± Implementation of Symmetric FIR Filter 230 5.6.3 Experiment 5C ± Implementation of FIR Filter Using Dual-MAC 233 References 235 Exercises 236 6 Design and Implementation of IIR Filters 241 6.1 Laplace Transform 241 6.1.1 Introduction to the Laplace Transform 241 6.1.2 Relationships between the Laplace and z-Transforms 245 6.1.3 Mapping Properties 246 6.2 Analog Filters 247 6.2.1 Introduction to Analog Filters 248 6.2.2 Characteristics of Analog Filters 249 6.2.3 Frequency Transforms 253 6.3 Design of IIR Filters 255 6.3.1 Review of IIR Filters 255 6.3.2 Impulse-Invariant Method 256 6.3.3 Bilinear Transform 259 6.3.4 Filter Design Using Bilinear Transform 261 6.4 Realization of IIR Filters 263 6.4.1 Direct Forms 263 6.4.2 Cascade Form 266 6.4.3 Parallel Form 268 6.4.4 Realization Using MATLAB 269 6.5 Design of IIR Filters Using MATLAB 271 6.6 Implementation Considerations 273 6.6.1 Stability 274 6.6.2 Finite-Precision Effects and Solutions 275 6.6.3 Software Implementations 279 6.6.4 Practical Applications 280 6.7 Software Developments and Experiments Using the TMS320C55x 284 6.7.1 Design of IIR Filter 285 6.7.2 Experiment 6A ± Floating-Point C Implementation 286 6.7.3 Experiment 6B ± Fixed-Point C Implementation Using Intrinsics 289 6.7.4 Experiment 6C ± Fixed-Point C Programming Considerations 292 6.7.5 Experiment 6D ± Assembly Language Implementations 295 References 297 Exercises 297 7 Fast Fourier Transform and Its Applications 303 7.1 Discrete Fourier Transform 303 7.1.1 Definitions 304 7.1.2 Important Properties of DFT 308 7.1.3 Circular Convolution 311 x CONTENTS
  • 13. 7.2 Fast Fourier Transforms 314 7.2.1 Decimation-in-Time 315 7.2.2 Decimation-in-Frequency 319 7.2.3 Inverse Fast Fourier Transform 320 7.2.4 MATLAB Implementations 321 7.3 Applications 322 7.3.1 Spectrum Estimation and Analysis 322 7.3.2 Spectral Leakage and Resolution 324 7.3.3 Power Density Spectrum 328 7.3.4 Fast Convolution 330 7.3.5 Spectrogram 332 7.4 Implementation Considerations 333 7.4.1 Computational Issues 334 7.4.2 Finite-Precision Effects 334 7.5 Experiments Using the TMS320C55x 336 7.5.1 Experiment 7A ± Radix-2 Complex FFT 336 7.5.2 Experiment 7B ± Radix-2 Complex FFT Using Assembly Language 341 7.5.3 Experiment 7C ± FFT and IFFT 344 7.5.4 Experiment 7D ± Fast Convolution 344 References 346 Exercises 347 8 Adaptive Filtering 351 8.1 Introduction to Random Processes 351 8.1.1 Correlation Functions 352 8.1.2 Frequency-Domain Representations 356 8.2 Adaptive Filters 359 8.2.1 Introduction to Adaptive Filtering 359 8.2.2 Performance Function 361 8.2.3 Method of Steepest Descent 365 8.2.4 The LMS Algorithm 366 8.3 Performance Analysis 367 8.3.1 Stability Constraint 367 8.3.2 Convergence Speed 368 8.3.3 Excess Mean-Square Error 369 8.4 Modified LMS Algorithms 370 8.4.1 Normalized LMS Algorithm 370 8.4.2 Leaky LMS Algorithm 371 8.5 Applications 372 8.5.1 Adaptive System Identification 372 8.5.2 Adaptive Linear Prediction 373 8.5.3 Adaptive Noise Cancellation 375 8.5.4 Adaptive Notch Filters 377 8.5.5 Adaptive Channel Equalization 379 8.6 Implementation Considerations 381 8.6.1 Computational Issues 381 8.6.2 Finite-Precision Effects 382 8.7 Experiments Using the TMS320C55x 385 8.7.1 Experiment 8A ± Adaptive System Identification 385 8.7.2 Experiment 8B ± Adaptive Predictor Using the Leaky LMS Algorithm 390 References 396 Exercises 396 CONTENTS xi
  • 14. 9 Practical DSP Applications in Communications 399 9.1 Sinewave Generators and Applications 399 9.1.1 Lookup-Table Method 400 9.1.2 Linear Chirp Signal 402 9.1.3 DTMF Tone Generator 403 9.2 Noise Generators and Applications 404 9.2.1 Linear Congruential Sequence Generator 404 9.2.2 Pseudo-Random Binary Sequence Generator 406 9.2.3 Comfort Noise in Communication Systems 408 9.2.4 Off-Line System Modeling 409 9.3 DTMF Tone Detection 410 9.3.1 Specifications 410 9.3.2 Goertzel Algorithm 411 9.3.3 Implementation Considerations 414 9.4 Adaptive Echo Cancellation 417 9.4.1 Line Echoes 417 9.4.2 Adaptive Echo Canceler 418 9.4.3 Practical Considerations 422 9.4.4 Double-Talk Effects and Solutions 423 9.4.5 Residual Echo Suppressor 425 9.5 Acoustic Echo Cancellation 426 9.5.1 Introduction 426 9.5.2 Acoustic Echo Canceler 427 9.5.3 Implementation Considerations 428 9.6 Speech Enhancement Techniques 429 9.6.1 Noise Reduction Techniques 429 9.6.2 Spectral Subtraction Techniques 431 9.6.3 Implementation Considerations 433 9.7 Projects Using the TMS320C55x 435 9.7.1 Project Suggestions 435 9.7.2 A Project Example ± Wireless Application 437 References 442 Appendix A Some Useful Formulas 445 A.1 Trigonometric Identities 445 A.2 Geometric Series 446 A.3 Complex Variables 447 A.4 Impulse Functions 449 A.5 Vector Concepts 449 A.6 Units of Power 450 Reference 451 Appendix B Introduction of MATLAB for DSP Applications 453 B.1 Elementary Operations 453 B.1.1 Initializing Variables and Vectors 453 B.1.2 Graphics 455 B.1.3 Basic Operators 457 B.1.4 Files 459 B.2 Generation and Processing of Digital Signals 460 B.3 DSP Applications 463 B.4 User-Written Functions 465 xii CONTENTS
  • 15. B.5 Summary of Useful MATLAB Functions 466 References 467 Appendix C Introduction of C Programming for DSP Applications 469 C.1 A Simple C Program 470 C.1.1 Variables and Assignment Operators 472 C.1.2 Numeric Data Types and Conversion 473 C.1.3 Arrays 474 C.2 Arithmetic and Bitwise Operators 475 C.2.1 Arithmetic Operators 475 C.2.2 Bitwise Operators 476 C.3 An FIR Filter Program 476 C.3.1 Command-Line Arguments 477 C.3.2 Pointers 477 C.3.3 C Functions 478 C.3.4 Files and I/O Operations 480 C.4 Control Structures and Loops 481 C.4.1 Control Structures 481 C.4.2 Logical Operators 483 C.4.3 Loops 484 C.5 Data Types Used by the TMS320C55x 485 References 486 Appendix D About the Software 487 Index 489 CONTENTS xiii
  • 16. Preface Real-time digital signal processing (DSP) using general-purpose DSP processors is very challenging work in today's engineering fields. It promises an effective way to design, experiment, and implement a variety of signal processing algorithms for real-world applications. With DSP penetrating into various applications, the demand for high- performance digital signal processors has expanded rapidly in recent years. Many industrial companies are currently engaged in real-time DSP research and development. It becomes increasingly important for today's students and practicing engineers to master not only the theory of DSP, but equally important, the skill of real-time DSP system design and implementation techniques. This book offers readers a hands-on approach to understanding real-time DSP principles, system design and implementation considerations, real-world applications, as well as many DSP experiments using MATLAB, C/C++, and the TMS320C55x. This is a practical book about DSP and using digital signal processors for DSP applications. This book is intended as a text for senior/graduate level college students with emphasis on real-time DSP implementations and applications. This book can also serve as a desktop reference for practicing engineer and embedded system programmer to learn DSP concepts and to develop real-time DSP applications at work. We use a practical approach that avoids a lot of theoretical derivations. Many useful DSP textbooks with solid mathematical proofs are listed at the end of each chapter. To efficiently develop a DSP system, the reader must understand DSP algorithms as well as basic DSP chip architecture and programming. It is helpful to have several manuals and application notes on the TMS320C55x from Texas Instruments at http://www.ti.com. The DSP processor we will use as an example in this book is the TMS320C55x, the newest 16-bit fixed-point DSP processor from Texas Instruments. To effectively illustrate real-time DSP concepts and applications, MATLAB will be introduced for analysis and filter design, C will be used for implementing DSP algorithms, and Code Composer Studio (CCS) of the TMS320C55x are integrated into lab experiments, projects, and applications. To efficiently utilize the advanced DSP architecture for fast software development and maintenance, the mixing of C and assembly programs are emphasized. Chapter 1 reviews the fundamentals of real-time DSP functional blocks, DSP hard- ware options, fixed- and floating-point DSP devices, real-time constraints, algorithm development, selection of DSP chips, and software development. In Chapter 2, we introduce the architecture and assembly programming of the TMS320C55x. Chapter 3 presents some fundamental DSP concepts in time domain and practical considerations for the implementation of digital filters and algorithms on DSP hardware. Readers who are familiar with these DSP fundamentals should be able to skip through some of these sections. However, most notations used throughout the book will be defined in this chapter. In Chapter 4, the Fourier series, the Fourier transform, the z-transform, and the discrete Fourier transforms are introduced. Frequency analysis is extremely helpful Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee Copyright # 2001 John Wiley Sons Ltd ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
  • 17. in understanding the characteristics of both signals and systems. Chapter 5 is focused on the design, implementation, and application of FIR filters; digital IIR filters are covered in Chapter 6, and adaptive filters are presented in Chapter 8. The development, implementation, and application of FFT algorithms are introduced in Chapter 7. In Chapter 9, we introduce some selected DSP applications in communications that have played an important role in the realization of the systems. As with any book attempting to capture the state of the art at a given time, there will necessarily be omissions that are necessitated by the rapidly evolving developments in this dynamic field of exciting practical interest. We hope, at least, that this book will serve as a guide for what has already come and as an inspiration for what will follow. To aid teaching of the course a Solution Manual that presents detailed solutions to most of the problems in the book is available from the publisher. Availability of Software The MATLAB, C, and assembly programs that implement many DSP examples and applications are listed in the book. These programs along with many other programs for DSP implementations and lab experiments are available in the software package at http://www.ceet.niu.edu/faculty/kuo/books/rtdsp.html and http://pages.prodigy.net/ sunheel/web/dspweb.htm. Several real-world data files for some applications introduced in the book also are included in the software package. The list of files in the software package is given in Appendix D. It is not critical you have this software as you read the book, but it will help you to gain insight into the implementation of DSP algorithms, and it will be required for doing experiments at the last section of each chapter. Some of these experiments involve minor modification of the example code. By examining, studying and modifyingtheexamplecode,thesoftwarecanalsobeusedasaprototypeforotherpractical applications.Everyattempthasbeenmadetoensurethecorrectnessofthecode.Wewould appreciate readers bringing to our attention (kuo@ceet.niu.edu) any coding errors so that we can correct and update the codes available in the software package on the web. Acknowledgments We are grateful to Maria Ho and Christina Peterson at Texas Instruments, and Naomi Fernandes at Math Works, who provided the necessary support to write the book in a shortperiod.ThefirstauthorthanksmanyofhisstudentswhohavetakenhisDSPcourses, Senior Design Projects, and Master Thesis courses. He is indebted to Gene Frentz, Dr. Qun S. Lin, and Dr. Panos Papamichalis of Texas Instruments, John Kronenburger of Tellabs, and Santo LaMantia of Shure Brothers, for their support of DSP activities at Northern Illinois University. He also thanks Jennifer Y. Kuo for the proofreading of the book.Thesecondauthorwishestothank Robert DeNardo,DavidBaughman,andChuck Brokish of Texas Instruments, for their valuable inputs, help, and encouragement during the course of writing this book. We would like to thank Peter Mitchell, editor at Wiley, for his support of this project. We also like to thank the staff at Wiley for the final preparation of the book. Finally, we thank our parents and families for their endless love, encourage- ment, and the understanding they have shown during the whole time. Sen M. Kuo and Bob H. Lee xvi PREFACE
  • 18. Index R2's complement, 96, 103, 118 3-dB bandwidth, 188, 281 3-dB cut-off frequency, 249±50 60 Hz hum, 6, 184 6-dB signal-to-quantization-noise gain, 8, 100, 105 accumulator (AC0±AC3), 27, 38, 57, 62, 97, 169, 382 acoustic echo, 427 echo cancellation, 163, 409, 417, 426, 427 echo path, 427 active noise control system, 373 adaptive algorithm, 351, 360, 368, 377, 385, 409, 420, 427 channel equalization, 379 echo cancellation, 417, 418, 419, 427 filter, 351, 359, 369, 419, 427 linear prediction (predictor), 373, 374, 390 noise cancellation (ANC), 375, 430 notch filter, 377 step size, 370, 371 system identification, 372, 373, 385 ADC, see analog-to-digital converter adders, 80 address-data flow unit (AU), 36, 38, 174 addressing modes, 50 aliasing, 6, 156, 260, 401 allpass filter, 185 all-pole model (system), 163 all-zero model (system), 145, 163 amplitude spectrum, see magnitude spectrum analog filter, 181, 241, 247 interface chip (AIC), 10 signal, 1, 241 analog-to-digital converter (ADC), 3, 6, 8, 10, 100 anti-aliasing filter, 6, 9, 156 anti-imaging filter, 9 anti-resonances, 163 anti-symmetry filter, 230 properties, 195 application specific integrated circuits (ASIC), 11, 437 arithmetic and logic unit (ALU), 36, 38, 39 arithmetic error, 98, 382 instruction, 63 ASIC, see Application specific integrated circuits ASCII (text) file, 18, 19 assembler directives, 44 assembly statement syntax, 49 autocorrelation, 352, 356, 361, 362 properties, 353 matrix, 361 autocovariance, 352 automatic gain controller (AGC), 4, 440 autopower spectrum, 356 auxiliary register (AR0±AR7), 36, 38, 62 averaging technique, 410 bandlimited, 5, 155, 259 bandpass filter, 184, 185, 254 bandstop (band-reject) filter, 185, 254 bandwidth, 2, 155, 188, 254 barrel shifter, 38 Bessel filter, 253 function, 212 bilinear transform, 259 binary file, 18 point, 95 bit manipulation instruction, 64 bit-reversal, 318, 343 Blackman window, 210 Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee Copyright # 2001 John Wiley Sons Ltd ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
  • 19. block FIR filter, 225 processing, 198, 225, 331 block-repeat counter, 168 instruction (RPTB), 168 breakpoint, 26 built-in parallel instruction, 60 bus contention, 232, 234 buses, 39 butterfly network (computation), 316, 317, 335 Butterworth filter, 249, 271 Cascade (series) form, 142, 199, 266, 269 Cauchy's integral (residue) theorem, 139 causal filter, 182, 203 signal, 78, 134 system, 88 C compiler, 19, 42 CD player, 3, 9 center clipper, 408, 425 frequency, 187, 254 central limit theorem, 95 channel coding, 437 equalization, 359, 399, 441 characteristic equation, 150 Chebyshev approximation, 118, 219 filter, 252, 271 circular buffer, 200, 217 convolution, 311, 330 pointer, 400 shift, 310 circular addressing mode, 36, 58, 227 buffer size registers (BK03, BK47, BKC), 58, 62 starting address registers (BSA01, BSA23, BSA45, BSA67, BSAC), 58, 62 clipping threshold, 408, 425 coefficient data pointer (CDP), 38 quantization, 101, 115, 223, 276 code composer studio (CCS), 19, 48 code conversion process, 41 code division multiple access (CDMA), 3, 353 code optimizer, 42 coder/decoder (CODEC), 10 comb filter, 192, 200, 216 combined parallel instruction, 61 comfort noise, 408, 431 common object file format (COFF), 41, 44 companding, 8 compiler optimization, 43, 294 complex arithmetic, 380, 414, 448 LMS algorithm, 380 variable, 165, 447 complex-conjugate property, 153, 309 complexity, 2 continuous-time signal, 1 convergence, 366, 368 factor, see step size speed, 368 convolution, 135, 330 sum, 87±8, 189 convolutional encoding, 438 correlation function, 94, 352 cosine and sine power series expansion, 117±18 CRC, see cyclic redundant check critical frequencies, 257, 261 crosscorrelation, 352, 354, 361 vector, 361 crosscovariance, 352±3 cross-power spectrum, 357 crosstalk effect, 376 C-to-ASM interlister, 42 cumulative probability distribution function, 90 cutoff frequency, 6, 184 cyclic redundant check (CRC), 437, 440 DAC, see digital-to-analog converter data buses, 39 computation unit (DU), 36, 38, 174 generation unit (DAGEN), 60 page pointer (DP), 52 dBm, 451 DC component, 128 offset, 6, 184 DCT, see discrete cosine transformation debugger, 19, 25 decibel (dB), 450 decimation, 8 decimation-in-frequency, 315, 319 decimation-in-time, 315 decision-directed algorithm, 380 delay equalizer, 185 property, 135 units, 81 delta function, 131, 207, 449 design of FIR filter, 201 deterministic signal, 77, 351 490 INDEX
  • 20. DFT, see discrete Fourier transform DFT matrix, 306 differentiator, 220 digital building block, 11, 12 digital filter, 143, 181 filter design, 181 resonator, 150 signal, 1 signal processing (DSP), 1 signal processors (DSP chips), 11, 35 digital-to-analog converter (DAC), 3, 9 digit decoder, 416 digitization, 4 direct addressing mode, 52 direct form, 198, 263±4 discrete cosine transformation (DCT), 436 Fourier transform, 152, 157, 171, 303, 308, 411 discrete-time Fourier transform (DTFT), 153, 304, 356 frequency, 79 signal, 1, 5, 152, 245 system, 77 dispersive delay, 419 dot product, 73 double-talk, 423 detector, 423, 427, 429 DSP, see digital signal processing chip selection, 16 hardware, 11 software development, 16 software development tool, 18 start kit (DSK), 48 system design, 14 DTMF (dual-tone multi-frequency) frequencies, 411 tone detection, 410 tone generator, 403 dual slope, see analog-to-digital converter echo cancellation, 399 path, 417, 419, 421 return loss (ERL), 424 return loss enhancement (ERLE), 421 eigenvalue spread, 369 elementary digital signal, 77 elliptic filter, 253±54, 271 encoding process, 7 energy, 85, 416, 450 ensemble average, 352, also see expectation operation equalizer, 379 ergodic, 352, 355 error coding, 437 contours, 363±64 surface, 363 Euler's formula, 129 theorem, 446 evaluation module (EVM), 48, 49 even function, 128, 131, 149, 309, 353, 356 excess mean-square error (MSE), 369, 370, 383, 420, 429 excitation signal, 372, 419 expectation operation, 92, 352 value, see mean far-end, 418, 419 fast convolution, 198, 330, 344 Fourier transform, 159, 314, 321, 336, 411 feedback coefficients, 144 feedforward coefficients, 144 FFT, see fast Fourier transform file header format, 111±12 filter, 181 coefficients (weights or taps), 83 design procedure, 201 specifications, 185 finite impulse response, see FIR filter finite precision (wordlength) effects, 107, 267, 334, 382 FIR filter, 83, 84, 89, 143, 144, 181, 189, 221, 227, 360 fixed-point, 13, 95, 223, 284 flash ADCs, see analog-to-digital converter flat delay, 419 flexibility, 1 floating-point, 13, 223, 284 folding frequency, see Nyquist frequency phenomenon, 156 forced response, 147, 245 forward error correction (FEC), 437 Fourier coefficient, 128, 152 series, 128, 152 series (window) method, 202 transform, 130, 132, 133, 153, 157, 158, 242 four-wire facility, 418 fractional number, 95, 97 frequency, 78, 127 offset test, 416 resolution, 159, 307, 322, 326 INDEX 491
  • 21. frequency (cont.) response, 148, 153 sampling method, 202, 214, 255 transform, 253 warping, 261 fundamental frequency, 129, 130, 156 G.165 (G.168), 422 gain, 4 Gaussian distribution function, 95 general extension language, 32 geometric series, 215, 446 Gibbs phenomenon, 205 Goertzel algorithm, 411 gradient, 365 estimate, 366 granulation noise, 100 group delay, 188, 196 guard bits, 106 half-wave rectification, 434 Hamming window, 209, 221 hands-free telephone, see speakerphone Hann (Hanning) window, 209 Hanning filter, 198 harmonics, 128, 192 Harvard architecture, 12 highpass filter, 184, 249, 253, 254 Hilbert transformer, 185, 197, 220, 378 hybrid, 418, 427 loss, see echo return loss ideal filter, 183 oscillator, 129 sampler, 4, 5 system, 107 IDCT, see inverse discrete cosine transformation IDFT, see inverse fast Fourier transform IFFT, see inverse fast Fourier transform IIR Filters, 88, 89, 143, 241, 255, 263, 271, 279, 360 image coding, 399 recognition, 2 impedance, 248, 417 implementation procedure, 107 implied parallel instructions, 60 impulse functions, 449 response, 83, 87, 202, 203, 255 train, 177, 245 impulse-invariant method, 255, 256 indirect addressing mode, 53 infinite impulse response, see IIR filters in-circuit emulator (XDS), 48, 49 in-place FFT algorithms, 315 input autocorrelation matrix, 361 channel, 3 quantization, 98, 277 signal conditioning, 3 vector, 360, 381 instantaneous normalized frequency, 402 power, 424 squared error, 366 instruction buffer queue (IBQ), 60, 341 buffer unit (IU), 36, 37 set, 63 interfacing C with assembly code, 71 interleave, 441 interpolation, 8, 401 filter, 198 interrupt, 174 service routine (ISR), 174 vector table, 174 intersymbol interference (ISI), 379 intrinsics, 289 inverse discrete cosine transformation (IDCT), 436 discrete Fourier transform (IDFT), 153, 158, 306 fast Fourier transform (IFFT), 320 filter, 198 Fourier transform, 130 Laplace transform, 242 z-transform, 136 JPEG (Joint Photographic Experts Group), 1, 437 Kaiser window, 212 Kronecker delta function, 78 Laplace transform, 133, 241 leakage (or smearing), 208 factor, 371, 372 leaky LMS algorithm, 371, 382, 390 learning curve, 368 least-mean-square, see LMS algorithm least significant bit (LSB), 8, 40, 96 limit cycle oscillation, 98 line echo, 417 spectrum, 129 linear chirp signal, 402, 409 492 INDEX
  • 22. congruential method, 404 convolution, 87±8, 135, 189, 198, 243±4, 314, 330 interpolation, 401 phase, 188 phase filter, 183, 194 prediction, 373, 374 system, 87 time-invariant (LTI) system, 133 linearity (superposition), 134, 182, 308 linker, 46 command file, 23 LMS algorithm, 351, 366 logarithmic quantizer, 10 logic instructions, 64 long division, 136, 137 lookup-table method, 400, 403 loop unrolling, 228 lowpass filter, 184, 204, 249, 250 LPC, 165 MAC unit, see multiply-accumulate magnitude, 447 bit, 95, 96, 382 distortion, 185 response, 148±9, 151, 154, 160, 164, 182 spectrum, 129, 130±31, 153±54, 308 test, 414 mainlobe, 207, 325 maintainability, 17 mapping properties, 246, 260, 261 marginally stable, 148, 245, 274 MATLAB (matrix laboratory), 2, 202, 453 basic Operators, 457 built-in function, 465 files, 459 functions, 466 graphics, 455 M-files, 459 Mat-files, 460 Mex-files, 460 script files, 459 user-written functions, 465 maximum-length sequence, 163 mean, 92 mean-square error (MSE), 361, 383 mean-squared value, 93, 353, 356 MEMORY directive, see linker memory map, 40 memory-mapped register addressing mode, 56 memory mapped registers (MMRs), 40 microprocessor and microcontrollers (mP), 11 minimum MSE, 362, 383 step size, 384 mixture of C and assembly programming, 68 MMR, see memory mapped registers mnemonic assembly code, 42 modulo operation, 293, 404±5 most significant bit (MSB), 95 move instruction, 65 moving average filter, 84, 89, 145, 149, 193, 194 MPEG (Moving Picture Experts Group), 437 MSE, see mean-square error surface, 363 time constant, 368±9 multipliers, 80 multiply±accumulate, 36, 227 multi-rate, 8 natural response, 147 near-end, 418 negative symmetry, see anti-symmetric network echo, 417 noise generators, 404 reduction, 399, 429 subtraction, 430 nonlinear phase, 194 non-causal filter, 182, 198, 203 non-parametric methods, 322 non-real-time DSP, 2 non-recursive filter, 89 non-uniform quantization, 8 normal distribution function, 95 normalized digital frequency, 155 frequency, 79, 271 LMS algorithm, 368, 371, 428 step size, 371 notch filter, 160, 185, 377 Nyquist frequency, 6, 156, 197 interval, 6 rate, 6 odd function, 128, 129, 131, 149, 309 off-line system modeling, 373, 409, 428 one-sided z-transform, 134 operand types, 51 optimum filter, 362 step size, 383 weight vector, 362 oscillatory behavior, 205 output channel, 3 overflow, 103, 112 overlap-add, 332 INDEX 493
  • 23. overlap-save, 331 oversampling, 6 overshoot, 182 parallel connection, 141 converter, 9 execution, 60 form, 268 parallelism, 59 parametric equalizer, 283 parametric methods, 322 Park±McClellan algorithm, 202, 219 Parseval's theorem, 129, 131, 328 partial-fraction expansion, 137 passband, 183, 271 edge (cutoff) frequency, 185 ripple, 186 PDS, see power density spectrum peak value, 85 performance (or cost) function, 361 surface, 363 periodic signal, 127, 152, 153, 177, 304 periodicity, 305, 310 periodogram, 328 peripheral data-page pointer (PDP), 52 phase, 432±3, 447 distortion, 185 response (shift), 149, 154, 160, 182, 188 spectrum, 129, 131, 154, 188, 308 pipeline, 59 break down, 60 protection unit, 38 PN sequence, see pseudo-random number polar form, 447 pole, 134, 144, 150, 163, 244, 251, 269, 276, 277 pole±zero cancellation, 146, 147, 193, 216 plot (diagram), 134, 145, 147, 150 system (model), 145, 163, 165 polynomial approximation, 117, 249, 399 positive symmetric, see symmetric power, 85, 93, 128, 129, 354, 356, 368, 450 density spectrum (PDS), 129, 131, 328, 356 estimator, 84, 147, 424 spectral density, see PDS spectrum, see PDS practical system, 107 prediction delay, 374 pre-warping, 261 probability, 90 density function, 91 probe point, 28 processing time, 381 profiler (profiling), 29 program address generator, 57 counter (PC), 38, 174 execution pipeline, 59 fetch pipeline, 59 flow control instructions, 66 flow unit (PU), 36, 38 program-read address bus (PAB), 39 program-read data bus (PB), 39 Prony's method, 165 pseudo-random binary sequence generator, 406 numbers (noise), 94, 404 Q format, 97, 118, 291, 296 quadrants, 118, 401 quadrature amplitude modulation (QAM), 380, 437 quadrature phase, 402 quality factor, 188 quantization, 4 effect, 223 errors (noise), 7, 98, 99, 100, 107, 223, 276, 278, 335, 401 process, 7, 99, 109, 111, 223 step (interval, width, resolution), 98 radix-2 FFT, 159, 336 raised cosine function, 209 random number generation, 399, 404 process (signals), 78, 89, 351 variable, 90, 352 Rayleigh fading, 441 realization of IIR filter, 263 real-time constraint, 14 emulator, 18 signal processing, 2, 381 reconstruction filter, 9, 10 rectangular pulse train, 128 window, 207, 324, 327 recursive oscillator, 281 power estimator, 147 region of convergence (ROC), 134 register, 95, 406 reliability, 2 Remez algorithm, 219 repeat operation, 36, 293 reproducibility, 2 494 INDEX
  • 24. residual echo, 420 echo suppressor, 408, 425 method, 139 noise reduction, 434 resonator (peaking) filter, 185, 217, 280 reverberation, 163, 426, 427 rise time, 182 room transfer function (RTF), 162, 165 roots, 244 of polynomials, 145, 146 rounding and saturation control logic, 38 rounding and truncation, 98 roundoff error (noise), 102, 267, 382, 383, 429 running averaging filter see moving averaging filter run-time support library, 24, 293 sample autocorrelation function, 355 function, 245, 352 mean, 355 space, 90 variance, 355 sample and hold, 4 sampling frequency (rate), 5, 6, 283, 330, 413 function, 4, 245 process, 4 theorem, 5, 6, 156 saturation arithmetic, 103, 112 scaling factor, 106, 193, 224, 278, 382 signal, 105 Schur±Cohn stability test, 275 second harmonic test, 416 SECTION directive, see linker serial converter, 9 settling time, 182 Shannon's sampling theorem, 5 sidelobes, 207, 325 sigma-delta ADC, see analog-to-digital converter signal buffer, 199, 222, 227 signal-to-quantization-noise ratio, 7±8, 100 sign bit, 96, 382 simulator, 17, 48 sinc function, 204 sinewave generation, 167, 226, 281, 399 table address increment, 400 single-repeat instruction (RPT), 168 sinusoidal signal, 78 steady-state response, 245 sirens, 403 slicer, 380 smearing, 208, 325 smoothing filter, 9, 198 software development tools, 40 SP, see stack pointer speakerphone, 426 spectral dynamic range, 369 estimator, 433 leakage, 324 magnitude averaging, 433 resolution, 324 smearing, 326 subtraction, 375, 431 spectrogram, 332 spectrum, 131, 161, 309, 322, 325 speech enhancement, 429 (source) coding, 375, 399, 437 recognition, 2, 375 square wave, 176 squared-magnitude response, 149 stability, 182, 274 condition, 148, 245, 274 constraint, 367, 369 triangle, 275 stack, 174 stack pointer (SP), 52 stalling, 384 standard deviation, 93 stationary, 369 statistical independence, 94 status registers, 57 steady-state response, 147, 154, 182, 188, 245 steepest descent, 365 step size, 365, 370, 383, 421, 429 stochastic gradient algorithm, see LMS algorithm stochastic process, see random process stopband, 183 edge frequency, 185 ripple (or attenuation), 186 subband acoustic echo canceler, 427 successive approximation, see analog-to-digital converter sum of products, 73 superposition, 182 switched capacitor filter, 9 symmetry, 195, 230, 305 synthesis equation, 158 synthesizes sine function, 117 system gain, 149, 154 identification, 372 INDEX 495
  • 25. system (cont.) stack pointer (SSP), 175 tail delay, 420 talk-off, 411 tapped-delay-line, 84, 200 Taylor series expansion, 117 temporal, 352 temporary register (T0±T3), 38 time average, 352 delay, 188, 353 shifting, 135 time-invariant filter (system), 181 time-quantization error, 401 TMS320C3x, 13 TMS320C55x, 13, 35 tolerance (or ripple) scheme, 185 tone generation and detection, 399, 403 tone-to-total energy test, 416 total harmonic distortion, 399 trace, 368 training signal, 409 stage, 380, 409 transfer function, 141, 143, 189, 198, 244 transformer, 192 transient response, 147, 182, 191, 245 transition band, 185, 187 discontinuity, 205 transversal filter, see FIR filter trellis, 439 trigonometric function, 399 identities, 445 truncation, 203, 205 twiddle factor, 158, 165, 167, 305, 314, 334 matrix, 306 twist, 411 test, 415 two-sided z-transform, 134 two-wire facility, 418 uncorrelated, 94 uniform density function, 91, 92, 93 unit circle, 133 delay, 81, 135 unit-impulse sequence, 78, 449 units of power, 450 unit-step sequence, 78 unstable condition, 148, 245 user-built parallel instruction, 61 variable watch, 20 variance, 93, 100 vector concept, 449 Viterbi decoding, 437, 439 voice activity detector (VAD), 430, 431 von Neumann architecture, 12 weight vector, 220, 361, 365, 366 white noise, 357, 409 wide-sense stationary (WSS), 353 window functions, 208, 326 wireless application, 437 wordlength, 2, 7, 96, 224 zero, 134, 144, 151, 163, 244 padding, 313, 326, 330 zero-mean, 92, 357 zero-order-hold, 9 zero-order modified Bessel function, 212 zero-overhead looping, 36, 227 z-plane, 133, 246 z-transform, 133, 136, 153, 246, 311, 356 496 INDEX
  • 26. 1 Introduction to Real-Time Digital Signal Processing Signals can be divided into three categories ± continuous-time (analog) signals, discrete-time signals, and digital signals. The signals that we encounter daily are mostly analog signals. These signals are defined continuously in time, have an infinite range of amplitude values, and can be processed using electrical devices containing both active and passive circuit elements. Discrete-time signals are defined only at a particular set of time instances. Therefore they can be represented as a sequence of numbers that have a continuous range of values. On the other hand, digital signals have discrete values in both time and amplitude. In this book, we design and implement digital systems for processing digital signals using digital hardware. However, the analysis of such signals and systems usually uses discrete-time signals and systems for math- ematical convenience. Therefore we use the term `discrete-time' and `digital' inter- changeably. Digital signal processing (DSP) is concerned with the digital representation of signals and the use of digital hardware to analyze, modify, or extract information from these signals. The rapid advancement in digital technology in recent years has created the implementation of sophisticated DSP algorithms that make real-time tasks feasible. A great deal of research has been conducted to develop DSP algorithms and applications. DSP is now used not only in areas where analog methods were used previously, but also in areas where applying analog techniques is difficult or impossible. There are many advantages in using digital techniques for signal processing rather than traditional analog devices (such as amplifiers, modulators, and filters). Some of the advantages of a DSP system over analog circuitry are summarized as follows: 1. Flexibility. Functions of a DSP system can be easily modified and upgraded with software that has implemented the specific algorithm for using the same hardware. One can design a DSP system that can be programmed to perform a wide variety of tasks by executing different software modules. For example, a digital camera may be easily updated (reprogrammed) from using JPEG ( joint photographic experts group) image processing to a higher quality JPEG2000 image without actually changing the hardware. In an analog system, however, the whole circuit design would need to be changed. Real-Time Digital Signal Processing. Sen M Kuo, Bob H Lee Copyright # 2001 John Wiley Sons Ltd ISBNs: 0-470-84137-0 (Hardback); 0-470-84534-1 (Electronic)
  • 27. 2. Reproducibility. The performance of a DSP system can be repeated precisely from one unit to another. This is because the signal processing of DSP systems work directly with binary sequences. Analog circuits will not perform as well from each circuit, even if they are built following identical specifications, due to component tolerances in analog components. In addition, by using DSP techniques, a digital signal can be transferred or reproduced many times without degrading its signal quality. 3. Reliability. The memory and logic of DSP hardware does not deteriorate with age. Therefore the field performance of DSP systems will not drift with changing environmental conditions or aged electronic components as their analog counter- parts do. However, the data size (wordlength) determines the accuracy of a DSP system. Thus the system performance might be different from the theoretical expect- ation. 4. Complexity. Using DSP allows sophisticated applications such as speech or image recognition to be implemented for lightweight and low power portable devices. This is impractical using traditional analog techniques. Furthermore, there are some important signal processing algorithms that rely on DSP, such as error correcting codes, data transmission and storage, data compression, perfect linear phase filters, etc., which can barely be performed by analog systems. With the rapid evolution in semiconductor technology in the past several years, DSP systems have a lower overall cost compared to analog systems. DSP algorithms can be developed, analyzed, and simulated using high-level language and software tools such as C=C‡‡ and MATLAB (matrix laboratory). The performance of the algorithms can be verified using a low-cost general-purpose computer such as a personal computer (PC). Therefore a DSP system is relatively easy to develop, analyze, simulate, and test. There are limitations, however. For example, the bandwidth of a DSP system is limited by the sampling rate and hardware peripherals. The initial design cost of a DSP system may be expensive, especially when large bandwidth signals are involved. For real-time applications, DSP algorithms are implemented using a fixed number of bits, which results in a limited dynamic range and produces quantization and arithmetic errors. 1.1 Basic Elements of Real-Time DSP Systems There are two types of DSP applications ± non-real-time and real time. Non-real-time signal processing involves manipulating signals that have already been collected and digitized. This may or may not represent a current action and the need for the result is not a function of real time. Real-time signal processing places stringent demands on DSP hardware and software design to complete predefined tasks within a certain time frame. This chapter reviews the fundamental functional blocks of real-time DSP systems. The basic functional blocks of DSP systems are illustrated in Figure 1.1, where a real- world analog signal is converted to a digital signal, processed by DSP hardware in 2 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 28. Other digital systems Anti-aliasing filter ADC x(n) DSP hardware Other digital systems DAC Reconstruction filter y(n) x(t) x⬘(t) Amplifier Amplifier y(t) y⬘(t) Input channels Output channels Figure 1.1 Basic functional blocks of real-time DSP system digital form, and converted back into an analog signal. Each of the functional blocks in Figure 1.1 will be introduced in the subsequent sections. For some real-time applica- tions, the input data may already be in digital form and/or the output data may not need to be converted to an analog signal. For example, the processed digital information may be stored in computer memory for later use, or it may be displayed graphically. In other applications, the DSP system may be required to generate signals digitally, such as speech synthesis used for cellular phones or pseudo-random number generators for CDMA (code division multiple access) systems. 1.2 Input and Output Channels In this book, a time-domain signal is denoted with a lowercase letter. For example, x t† in Figure 1.1 is used to name an analog signal of x with a relationship to time t. The time variable t takes on a continuum of values between 1 and 1. For this reason we say x t† is a continuous-time signal. In this section, we first discuss how to convert analog signals into digital signals so that they can be processed using DSP hardware. The process of changing an analog signal to a xdigital signal is called analog-to-digital (A/D) conversion. An A/D converter (ADC) is usually used to perform the signal conversion. Once the input digital signal has been processed by the DSP device, the result, y n†, is still in digital form, as shown in Figure 1.1. In many DSP applications, we need to reconstruct the analog signal after the digital processing stage. In other words, we must convert the digital signal y n† back to the analog signal y t† before it is passed to an appropriate device. This process is called the digital-to-analog (D/A) conversion, typi- cally performed by a D/A converter (DAC). One example would be CD (compact disk) players, for which the music is in a digital form. The CD players reconstruct the analog waveform that we listen to. Because of the complexity of sampling and synchronization processes, the cost of an ADC is usually considerably higher than that of a DAC. 1.2.1 Input Signal Conditioning As shown in Figure 1.1, the analog signal, x0 t†, is picked up by an appropriate electronic sensor that converts pressure, temperature, or sound into electrical signals. INPUT AND OUTPUT CHANNELS 3
  • 29. For example, a microphone can be used to pick up sound signals. The sensor output, x0 t†, is amplified by an amplifier with gain value g. The amplified signal is x t† ˆ gx0 t†: 1:2:1† The gain value g is determined such that x t† has a dynamic range that matches the ADC. For example, if the peak-to-peak range of the ADC is 5 volts (V), then g may be set so that the amplitude of signal x t† to the ADC is scaled between 5V. In practice, it is very difficult to set an appropriate fixed gain because the level of x0 t† may be unknown and changing with time, especially for signals with a larger dynamic range such as speech. Therefore an automatic gain controller (AGC) with time-varying gain determined by DSP hardware can be used to effectively solve this problem. 1.2.2 A/D Conversion As shown in Figure 1.1, the ADC converts the analog signal x t† into the digital signal sequence x n†. Analog-to-digital conversion, commonly referred as digitization, consists of the sampling and quantization processes as illustrated in Figure 1.2. The sampling process depicts a continuously varying analog signal as a sequence of values. The basic sampling function can be done with a `sample and hold' circuit, which maintains the sampled level until the next sample is taken. Quantization process approximates a waveform by assigning an actual number for each sample. Therefore an ADC consists of two functional blocks ± an ideal sampler (sample and hold) and a quantizer (includ- ing an encoder). Analog-to-digital conversion carries out the following steps: 1. The bandlimited signal x t† is sampled at uniformly spaced instants of time, nT, where n is a positive integer, and T is the sampling period in seconds. This sampling process converts an analog signal into a discrete-time signal, x nT†, with continuous amplitude value. 2. The amplitude of each discrete-time sample is quantized into one of the 2B levels, where B is the number of bits the ADC has to represent for each sample. The discrete amplitude levels are represented (or encoded) into distinct binary words x n† with a fixed wordlength B. This binary sequence, x n†, is the digital signal for DSP hardware. x(t) Ideal sampler x(nT) Quantizer x(n) A/D converter Figure 1.2 Block diagram of A/D converter 4 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 30. The reason for making this distinction is that each process introduces different distor- tions. The sampling process brings in aliasing or folding distortions, while the encoding process results in quantization noise. 1.2.3 Sampling An ideal sampler can be considered as a switch that is periodically open and closed every T seconds and T ˆ 1 fs , 1:2:2† where fs is the sampling frequency (or sampling rate) in hertz (Hz, or cycles per second). The intermediate signal, x nT†, is a discrete-time signal with a continuous- value (a number has infinite precision) at discrete time nT, n ˆ 0, 1, . . ., 1 as illustrated in Figure 1.3. The signal x nT† is an impulse train with values equal to the amplitude of x t† at time nT. The analog input signal x t† is continuous in both time and amplitude. The sampled signal x nT† is continuous in amplitude, but it is defined only at discrete points in time. Thus the signal is zero except at the sampling instants t ˆ nT. In order to represent an analog signal x t† by a discrete-time signal x nT† accurately, two conditions must be met: 1. The analog signal, x t†, must be bandlimited by the bandwidth of the signal fM. 2. The sampling frequency, fs, must be at least twice the maximum frequency com- ponent fM in the analog signal x t†. That is, fs 2 fM: 1:2:3† This is Shannon's sampling theorem. It states that when the sampling frequency is greater than twice the highest frequency component contained in the analog signal, the original signal x t† can be perfectly reconstructed from the discrete-time sample x nT†. The sampling theorem provides a basis for relating a continuous-time signal x t† with Time, t x(nT) 0 T 2T 3T 4T x(t) Figure 1.3 Example of analog signal x t† and discrete-time signal x nT† INPUT AND OUTPUT CHANNELS 5
  • 31. the discrete-time signal x nT† obtained from the values of x t† taken T seconds apart. It also provides the underlying theory for relating operations performed on the sequence to equivalent operations on the signal x t† directly. The minimum sampling frequency fs ˆ 2fM is the Nyquist rate, while fN ˆ fs=2 is the Nyquist frequency (or folding frequency). The frequency interval ‰ fs=2, fs=2Š is called the Nyquist interval. When an analog signal is sampled at sampling frequency, fs, frequency components higher than fs=2 fold back into the frequency range ‰0, fs=2Š. This undesired effect is known as aliasing. That is, when a signal is sampled perversely to the sampling theorem, image frequencies are folded back into the desired frequency band. Therefore the original analog signal cannot be recovered from the sampled data. This undesired distortion could be clearly explained in the frequency domain, which will be discussed in Chapter 4. Another potential degradation is due to timing jitters on the sampling pulses for the ADC. This can be negligible if a higher precision clock is used. For most practical applications, the incoming analog signal x t† may not be band- limited. Thus the signal has significant energies outside the highest frequency of interest, and may contain noise with a wide bandwidth. In other cases, the sampling rate may be pre-determined for a given application. For example, most voice commu- nication systems use an 8 kHz (kilohertz) sampling rate. Unfortunately, the maximum frequency component in a speech signal is much higher than 4 kHz. Out-of-band signal components at the input of an ADC can become in-band signals after conversion because of the folding over of the spectrum of signals and distortions in the discrete domain. To guarantee that the sampling theorem defined in Equation (1.2.3) can be fulfilled, an anti-aliasing filter is used to band-limit the input signal. The anti-aliasing filter is an analog lowpass filter with the cut-off frequency of fc fs 2 : 1:2:4† Ideally, an anti-aliasing filter should remove all frequency components above the Nyquist frequency. In many practical systems, a bandpass filter is preferred in order to prevent undesired DC offset, 60 Hz hum, or other low frequency noises. For example, a bandpass filter with passband from 300 Hz to 3200 Hz is used in most telecommunica- tion systems. Since anti-aliasing filters used in real applications are not ideal filters, they cannot completely remove all frequency components outside the Nyquist interval. Any fre- quency components and noises beyond half of the sampling rate will alias into the desired band. In addition, since the phase response of the filter may not be linear, the components of the desired signal will be shifted in phase by amounts not proportional to their frequencies. In general, the steeper the roll-off, the worse the phase distortion introduced by a filter. To accommodate practical specifications for anti-aliasing filters, the sampling rate must be higher than the minimum Nyquist rate. This technique is known as oversampling. When a higher sampling rate is used, a simple low-cost anti- aliasing filter with minimum phase distortion can be used. Example 1.1: Given a sampling rate for a specific application, the sampling period can be determined by (1.2.2). 6 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 32. (a) In narrowband telecommunication systems, the sampling rate fs ˆ 8 kHz, thus the sampling period T ˆ 1=8 000 seconds ˆ 125 ms (microseconds). Note that 1 ms ˆ 10 6 seconds. (b) In wideband telecommunication systems, the sampling is given as fs ˆ 16 kHz, thus T ˆ 1=16 000 seconds ˆ 62:5 ms. (c) In audio CDs, the sampling rate is fs ˆ 44:1 kHz, thus T ˆ 1=44 100 seconds ˆ 22:676 ms. (d) In professional audio systems, the sampling rate fs ˆ 48 kHz, thus T ˆ 1=48 000 seconds ˆ 20:833 ms. 1.2.4 Quantizing and Encoding In the previous sections, we assumed that the sample values x nT† are represented exactly with infinite precision. An obvious constraint of physically realizable digital systems is that sample values can only be represented by a finite number of bits. The fundamental distinction between discrete-time signal processing and DSP is the wordlength. The former assumes that discrete-time signal values x nT† have infinite wordlength, while the latter assumes that digital signal values x n† only have a limited B-bit. We now discuss a method of representing the sampled discrete-time signal x nT† as a binary number that can be processed with DSP hardware. This is the quantizing and encoding process. As shown in Figure 1.3, the discrete-time signal x nT† has an analog amplitude (infinite precision) at time t ˆ nT. To process or store this signal with DSP hardware, the discrete-time signal must be quantized to a digital signal x n† with a finite number of bits. If the wordlength of an ADC is B bits, there are 2B different values (levels) that can be used to represent a sample. The entire continuous amplitude range is divided into 2B subranges. Amplitudes of waveform that are in the same subrange are assigned the same amplitude values. Therefore quantization is a process that represents an analog-valued sample x nT† with its nearest level that corresponds to the digital signal x n†. The discrete-time signal x nT† is a sequence of real numbers using infinite bits, while the digital signal x n† represents each sample value by a finite number of bits which can be stored and processed using DSP hardware. The quantization process introduces errors that cannot be removed. For example, we can use two bits to define four equally spaced levels (00, 01, 10, and 11) to classify the signal into the four subranges as illustrated in Figure 1.4. In this figure, the symbol `o' represents the discrete-time signal x nT†, and the symbol `' represents the digital signal x n†. In Figure 1.4, the difference between the quantized number and the original value is defined as the quantization error, which appears as noise in the output. It is also called quantization noise. The quantization noise is assumed to be random variables that are uniformly distributed in the intervals of quantization levels. If a B-bit quantizer is used, the signal-to-quantization-noise ratio (SNR) is approximated by (will be derived in Chapter 3) INPUT AND OUTPUT CHANNELS 7
  • 33. T 2T 3T 00 01 10 11 Quantization level Time, t x(t) 0 Quantization errors Figure 1.4 Digital samples using a 2-bit quantizer SNR 6B dB: 1:2:5† This is a theoretical maximum. When real input signals and converters are used, the achievable SNR will be less than this value due to imperfections in the fabrication of A/D converters. As a result, the effective number of bits may be less than the number of bits in the ADC. However, Equation (1.2.5) provides a simple guideline for determin- ing the required bits for a given application. For each additional bit, a digital signal has about a 6-dB gain in SNR. For example, a 16-bit ADC provides about 96 dB SNR. The more bits used to represent a waveform sample, the smaller the quantization noise will be. If we had an input signal that varied between 0 and 5 V, using a 12-bit ADC, which has 4096 212 † levels, the least significant bit (LSB) would correspond to 1.22 mV resolution. An 8-bit ADC with 256 levels can only provide up to 19.5 mV resolution. Obviously with more quantization levels, one can represent the analog signal more accurately. The problems of quantization and their solutions will be further discussed in Chapter 3. If the uniform quantization scheme shown in Figure 1.4 can adequately represent loud sounds, most of the softer sounds may be pushed into the same small value. This means soft sounds may not be distinguishable. To solve this problem, a quantizer whose quantization step size varies according to the signal amplitude can be used. In practice, the non-uniform quantizer uses a uniform step size, but the input signal is compressed first. The overall effect is identical to the non-uniform quantization. For example, the logarithm-scaled input signal, rather than the input signal itself, will be quantized. After processing, the signal is reconstructed at the output by expanding it. The process of compression and expansion is called companding (compressing and expanding). For example, the m-law (used in North America and parts of Northeast Asia) and A-law (used in Europe and most of the rest of the world) companding schemes are used in most digital communications. As shown in Figure 1.1, the input signal to DSP hardware may be a digital signal from other DSP systems. In this case, the sampling rate of digital signals from other digital systems must be known. The signal processing techniques called interpolation or decimation can be used to increase or decrease the existing digital signals' sampling rates. Sampling rate changes are useful in many applications such as interconnecting DSP systems operating at different rates. A multirate DSP system uses more than one sampling frequency to perform its tasks. 8 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 34. 1.2.5 D/A Conversion Most commercial DACs are zero-order-hold, which means they convert the binary input to the analog level and then simply hold that value for T seconds until the next sampling instant. Therefore the DAC produces a staircase shape analog waveform y0 t†, which is shown as a solid line in Figure 1.5. The reconstruction (anti-imaging and smoothing) filter shown in Figure 1.1 smoothes the staircase-like output signal gener- ated by the DAC. This analog lowpass filter may be the same as the anti-aliasing filter with cut-off frequency fc fs=2, which has the effect of rounding off the corners of the staircase signal and making it smoother, which is shown as a dotted line in Figure 1.5. High quality DSP applications, such as professional digital audio, require the use of reconstruction filters with very stringent specifications. From the frequency-domain viewpoint (will be presented in Chapter 4), the output of the DAC contains unwanted high frequency or image components centered at multiples of the sampling frequency. Depending on the application, these high-frequency compon- ents may cause undesired side effects. Take an audio CD player for example. Although the image frequencies may not be audible, they could overload the amplifier and cause inter-modulation with the desired baseband frequency components. The result is an unacceptable degradation in audio signal quality. The ideal reconstruction filter has a flat magnitude response and linear phase in the passband extending from the DC to its cut-off frequency and infinite attenuation in the stopband. The roll-off requirements of the reconstruction filter are similar to those of the anti-aliasing filter. In practice, switched capacitor filters are preferred because of their programmable cut-off frequency and physical compactness. 1.2.6 Input/Output Devices There are two basic ways of connecting A/D and D/A converters to DSP devices: serial and parallel. A parallel converter receives or transmits all the B bits in one pass, while the serial converters receive or transmit B bits in a serial data stream. Converters with parallel input and output ports must be attached to the DSP's address and data buses, y⬘(t) Time, t 0 T 2T 3T 4T 5T Smoothed output signal Figure 1.5 Staircase waveform generated by a DAC INPUT AND OUTPUT CHANNELS 9
  • 35. which are also attached to many different types of devices. With different memory devices (RAM, EPROM, EEPROM, or flash memory) at different speeds hanging on DSP's data bus, driving the bus may become a problem. Serial converters can be connected directly to the built-in serial ports of DSP devices. This is why many practical DSP systems use serial ADCs and DACs. Many applications use a single-chip device called an analog interface chip (AIC) or coder/decoder (CODEC), which integrates an anti-aliasing filter, an ADC, a DAC, and a reconstruction filter all on a single piece of silicon. Typical applications include modems, speech systems, and industrial controllers. Many standards that specify the nature of the CODEC have evolved for the purposes of switching and transmission. These devices usually use a logarithmic quantizer, i.e., A-law or m-law, which must be converted into a linear format for processing. The availability of inexpensive companded CODEC justi- fies their use as front-end devices for DSP systems. DSP chips implement this format conversion in hardware or in software by using a table lookup or calculation. The most popular commercially available ADCs are successive approximation, dual slope, flash, and sigma-delta. The successive-approximation ADC produces a B-bit output in B cycles of its clock by comparing the input waveform with the output of a digital-to-analog converter. This device uses a successive-approximation register to split the voltage range in half in order to determine where the input signal lies. According to the comparator result, one bit will be set or reset each time. This process proceeds from the most significant bit (MSB) to the LSB. The successive-approximation type of ADC is generally accurate and fast at a relatively low cost. However, its ability to follow changes in the input signal is limited by its internal clock rate, so that it may be slow to respond to sudden changes in the input signal. The dual-slope ADC uses an integrator connected to the input voltage and a reference voltage. The integrator starts at zero condition, and it is charged for a limited time. The integrator is then switched to a known negative reference voltage and charged in the opposite direction until it reaches zero volts again. At the same time, a digital counter starts to record the clock cycles. The number of counts required for the integrator output voltage to get back to zero is directly proportional to the input voltage. This technique is very precise and can produce ADCs with high resolution. Since the integrator is used for input and reference voltages, any small variations in temperature and aging of components have little or no effect on these types of converters. However, they are very slow and generally cost more than successive-approximation ADCs. A voltage divider made by resistors is used to set reference voltages at the flash ADC inputs. The major advantage of a flash ADC is its speed of conversion, which is simply the propagation delay time of the comparators. Unfortunately, a B-bit ADC needs 2B 1† comparators and laser-trimmed resistors. Therefore commercially available flash ADCs usually have lower bits. The block diagram of a sigma±delta ADC is illustrated in Figure 1.6. Sigma±delta ADCs use a 1-bit quantizer with a very high sampling rate. Thus the requirements for an anti-aliasing filter are significantly relaxed (i.e., the lower roll-off rate and smaller flat response in passband). In the process of quantization, the resulting noise power is spread evenly over the entire spectrum. As a result, the noise power within the band of interest is lower. In order to match the output frequency with the system and increase its resolution, a decimator is used. The advantages of the sigma±delta ADCs are high resolution and good noise characteristics at a competitive price because they use digital filters. 10 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 36. Analog input − Σ Sigma Delta 1-bit B-bit 1-bit DAC 1-bit ADC ∫ + Digital decimator Figure 1.6 A block of a sigma-delta ADC 1.3 DSP Hardware DSP systems require intensive arithmetic operations, especially multiplication and addition. In this section, different digital hardware architectures for DSP applications will be discussed. 1.3.1 DSP Hardware Options As shown in Figure 1.1, the processing of the digital signal x n† is carried out using the DSP hardware. Although it is possible to implement DSP algorithms on any digital computer, the throughput (processing rate) determines the optimum hardware plat- form. Four DSP hardware platforms are widely used for DSP applications: 1. general-purpose microprocessors and microcontrollers mP†, 2. general-purpose digital signal processors (DSP chips), 3. digital building blocks (DBB) such as multiplier, adder, program controller, and 4. special-purpose (custom) devices such as application specific integrated circuits (ASIC). The hardware characteristics are summarized in Table 1.1. ASIC devices are usually designed for specific tasks that require a lot of DSP MIPS (million instructions per second), such as fast Fourier transform (FFT) devices and Reed±Solomon coders used by digital subscriber loop (xDSL) modems. These devices are able to perform their limited functions much faster than general-purpose DSP chips because of their dedicated architecture. These application-specific products enable the use of high-speed functions optimized in hardware, but they lack the programmability to modify the algorithm, so they are suitable for implementing well-defined and well- tested DSP algorithms. Therefore applications demanding high speeds typically employ ASICs, which allow critical DSP functions to be implemented in the hardware. The availability of core modules for common DSP functions has simplified the ASIC design tasks, but the cost of prototyping an ASIC device, a longer design cycle, insufficient DSP HARDWARE 11
  • 37. Table 1.1 Summary of DSP hardware implementations ASIC DBB mP DSP chips Chip count 1 1 1 1 Flexibility none limited programmable programmable Design time long medium short short Power consumption low medium±high medium low±medium Processing speed high high low±medium medium±high Reliability high low±medium high high Development cost high medium low low Production cost low high low±medium low±medium Processor Address bus Data bus Memory Processor Address bus 1 Address bus 2 Data bus 1 Data bus 2 Memory 1 Memory 2 (a) (b) Figure 1.7 Different memory architectures: (a) Harvard architecture, and (b) von Newmann architecture standard development tools support, and the lack of reprogramming flexibility some- times outweigh their benefits. Digital building blocks offer a more general-purpose approach to high-speed DSP design. These components, including multipliers, arithmetic logic units (ALUs), sequen- cers, etc., are joined together to build a custom DSP architecture for a specific applica- tion. Performance can be significantly higher than general-purpose DSP devices. However, the disadvantages are similar to those of the special-purpose DSP devices ± lack of standard design tools, extended design cycles, and high component cost. General architectures for computers and microprocessors fall into two categories: Harvard architecture and von Neumann architecture. Harvard architecture has a separate memory space for the program and the data, so that both memories can be accessed simultaneously, see Figure 1.7(a). The von Neumann architecture assumes that 12 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 38. there is no intrinsic difference between the instructions and the data, and that the instructions can be partitioned into two major fields containing the operation command and the address of the operand. Figure 1.7(b) shows the memory architecture of the von Neumann model. Most general-purpose microprocessors use the von Neumann archi- tecture. Operations such as add, move, and subtract are easy to perform. However, complex instructions such as multiplication and division are slow since they need a series of shift, addition, or subtraction operations. These devices do not have the architecture or the on-chip facilities required for efficient DSP operations. They may be used when a small amount of signal processing work is required in a much larger system. Their real-time DSP performance does not compare well with even the cheaper general-purpose DSP devices, and they would not be a cost-effective solution for many DSP tasks. A DSP chip (digital signal processor) is basically a microprocessor whose architecture is optimized for processing specific operations at high rates. DSP chips with architec- tures and instruction sets specifically designed for DSP applications have been launched by Texas Instruments, Motorola, Lucent Technologies, Analog Devices, and many other companies. The rapid growth and the exploitation of DSP semiconductor tech- nology are not a surprise, considering the commercial advantages in terms of the fast, flexible, and potentially low-cost design capabilities offered by these devices. General- purpose-programmable DSP chip developments are supported by software develop- ment tools such as C compilers, assemblers, optimizers, linkers, debuggers, simulators, and emulators. Texas Instruments' TMS320C55x, a programmable, high efficiency, and ultra low-power DSP chip, will be discussed in the next chapter. 1.3.2 Fixed- and Floating-Point Devices A basic distinction between DSP chips is their fixed-point or floating-point architectures. The fixed-point representation of signals and arithmetic will be discussed in Chapter 3. Fixed-point processors are either 16-bit or 24-bit devices, while floating-point processors are usually 32-bit devices. A typical 16-bit fixed-point processor, such as the TMS320C55x, stores numbers in a 16-bit integer format. Although coefficients and signals are only stored with 16-bit precision, intermediate values (products) may be kept at 32-bit precision within the internal accumulators in order to reduce cumulative round- ing errors. Fixed-point DSP devices are usually cheaper and faster than their floating- point counterparts because they use less silicon and have fewer external pins. A typical 32-bit floating-point DSP device, such as the TMS320C3x, stores a 24-bit mantissa and an 8-bit exponent. A 32-bit floating-point format gives a large dynamic range. However, the resolution is still only 24 bits. Dynamic range limitations may be virtually ignored in a design using floating-point DSP chips. This is in contrast to fixed- point designs, where the designer has to apply scaling factors to prevent arithmetic overflow, which is a very difficult and time-consuming process. Floating-point devices may be needed in applications where coefficients vary in time, signals and coefficients have a large dynamic range, or where large memory structures are required, such as in image processing. Other cases where floating-point devices can be justified are where development costs are high and production volumes are low. The faster development cycle for a floating-point device may easily outweigh the extra cost DSP HARDWARE 13
  • 39. of the DSP device itself. Floating-point DSP chips also allow the efficient use of the high-level C compilers and reduce the need to identify the system's dynamic range. 1.3.3 Real-Time Constraints A limitation of DSP systems for real-time applications is that the bandwidth of the system is limited by the sampling rate. The processing speed determines the rate at which the analog signal can be sampled. For example, a real-time DSP system demands that the signal processing time, tp, must be less than the sampling period, T, in order to complete the processing task before the new sample comes in. That is, tp T: 1:3:1† This real-time constraint limits the highest frequency signal that can be processed by a DSP system. This is given as fM fs 2 1 2tp : 1:3:2† It is clear that the longer the processing time tp, the lower the signal bandwidth fM. Although new and faster DSP devices are introduced, there is still a limit to the processing that can be done in real time. This limit becomes even more apparent when system cost is taken into consideration. Generally, the real-time bandwidth can be increased by using faster DSP chips, simplified DSP algorithms, optimized DSP pro- grams, and parallel processing using multiple DSP chips, etc. However, there is still a trade-off between costs and system performances, with many applications simply not being economical at present. 1.4 DSP System Design A generalized DSP system design is illustrated in Figure 1.8. For a given application, the theoretical aspects of DSP system specifications such as system requirements, signal analysis, resource analysis, and configuration analysis are first performed to define the system requirements. 1.4.1 Algorithm Development The algorithm for a given application is initially described using difference equations or signal-flow block diagrams with symbolic names for the inputs and outputs. In docu- menting the algorithm, it is sometimes helpful to further clarify which inputs and outputs are involved by means of a data flow diagram. The next stage of the develop- ment process is to provide more details on the sequence of operations that must be performed in order to derive the output from the input. There are two methods for characterizing the sequence of steps in a program: flowcharts or structured descriptions. 14 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 40. H A R D W A R E S O F T W A R E System requirements specifications Algorithm development and simulation Select DSP devices System integration and debug System testing and release Application Software architecture Coding and Debugging Hardware Schematic Hardware Prototype Figure 1.8 Simplified DSP system design flow MATLAB or C/C++ ADC Other computers Other computers DAC Signal generators DSP algorithms DSP software Data files Data files Figure 1.9 DSP software development using a general-purpose computer At the algorithm development stage, we most likely work with high-level DSP tools (such as MATLAB or C=C‡‡) that enable algorithmic-level system simulations. We then migrate the algorithm to software, hardware, or both, depending on our specific needs. A DSP application or algorithm can be first simulated using a general-purpose computer, such as a PC, so that it can be analyzed and tested off-line using simulated input data. A block diagram of general-purpose computer implementation is illustrated in Figure 1.9. The test signals may be internally generated by signal generators or digitized from an experimental setup based on the given application. The program uses the stored signal samples in data file(s) as input(s) to produce output signals that will be saved in data file(s). DSP SYSTEM DESIGN 15
  • 41. Advantages of developing DSP software on a general-purpose computer are: 1. Using the high-level languages such as MATLAB, C=C‡‡, or other DSP software packages can significantly save algorithm and software development time. In add- ition, C programs are portable to different DSP hardware platforms. 2. It is easy to debug and modify programs. 3. Input/output operations based on disk files are simple to implement and the behav- iors of the system are easy to analyze. 4. Using the floating-point data format can achieve higher precision. 5. With fixed-point simulation, bit-true verification of an algorithm against fixed- point DSP implementation can easily be compared. 1.4.2 Selection of DSP Chips A choice of DSP chip from many available devices requires a full understanding of the processing requirements of the DSP system under design. The objective is to select the device that meets the project's time-scales and provides the most cost-effective solution. Some decisions can be made at an early stage based on computational power, resolu- tion, cost, etc. In real-time DSP, the efficient flow of data into and out of the processor is also critical. However, these criteria will probably still leave a number of candidate devices for further analysis. For high-volume applications, the cheapest device that can do the job should be chosen. For low- to medium-volume applications, there will be a trade-off between development time, development tool cost, and the cost of the DSP device itself. The likelihood of having higher-performance devices with upwards- compatible software in the future is also an important factor. When processing speed is at a premium, the only valid comparison between devices is on an algorithm-implementation basis. Optimum code must be written for both devices and then the execution time must be compared. Other important factors are memory size and peripheral devices, such as serial and parallel interfaces, which are available on-chip. In addition, a full set of development tools and supports are important for DSP chip selection, including: 1. Software development tools, such as assemblers, linkers, simulators, and C com- pilers. 2. Commercially available DSP boards for software development and testing before the target DSP hardware is available. 3. Hardware testing tools, such as in-circuit emulators and logic analyzers. 4. Development assistance, such as application notes, application libraries, data books, real-time debugging hardware, low-cost prototyping, etc. 16 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 42. 1.4.3 Software Development The four common measures of good DSP software are reliability, maintainability, extensibility, and efficiency. A reliable program is one that seldom (or never) fails. Since most programs will occasionally fail, a maintainable program is one that is easy to fix. A truly maintainable program is one that can be fixed by someone other than the original programmer. In order for a program to be truly maintainable, it must be portable on more than one type of hardware. An extensible program is one that can be easily modified when the requirements change, new functions need to be added, or new hardware features need to be exploited. An efficient DSP program will use the processing capabilities of the target hardware to minimize execution time. A program is usually tested in a finite number of ways much smaller than the number of input data conditions. This means that a program can be considered reliable only after years of bug-free use in many different environments. A good DSP program often contains many small functions with only one purpose, which can be easily reused by other programs for different purposes. Programming tricks should be avoided at all costs as they will often not be reliable and will almost always be difficult for someone else to understand even with lots of comments. In addition, use variable names that are meaningful in the context of the program. As shown in Figure 1.8, the hardware and software design can be conducted at the same time for a given DSP application. Since there is a lot of interdependence factors between hardware and software, the ideal DSP designer will be a true `system' engineer, capable of understanding issues with both hardware and software. The cost of hardware has gone down dramatically in recent years. The majority of the cost of a DSP solution now resides in software development. This section discussed some issues regarding software development. The software life cycle involves the completion of a software project: the project definition, the detailed specification, coding and modular testing, integration, and maintenance. Software maintenance is a significant part of the cost of a software system. Maintenance includes enhancing the software, fixing errors identified as the software is used, and modifying the software to work with new hardware and software. It is essential to document programs thoroughly with titles and comment statements because this greatly simplifies the task of software maintenance. As discussed earlier, good programming technique plays an essential part in success- ful DSP application. A structured and well-documented approach to programming should be initiated from the beginning. It is important to develop an overall specifica- tion for signal processing tasks prior to writing any program. The specification includes the basic algorithm/task description, memory requirements, constraints on the program size, execution time, etc. Specification review is an important component of the software development process. A thoroughly reviewed specification can catch mistakes before code is written and reduce potential code rework risk at system integration stage. The potential use of subroutines for repetitive processes should also be noted. A flow diagram will be a very helpful design tool to adopt at this stage. Program and data blocks should be allocated to specific tasks that optimize data access time and address- ing functions. A software simulator or a hardware platform can be used for testing DSP code. Software simulators run on a host computer to mimic the behavior of a DSP chip. The DSP SYSTEM DESIGN 17
  • 43. simulator is able to show memory contents, all the internal registers, I/O, etc., and the effect on these after each instruction is performed. Input/output operations are simu- lated using disk files, which require some format conversion. This approach reduces the development process for software design only. Full real-time emulators are normally used when the software is to be tested on prototype target hardware. Writing and testing DSP code is a highly iterative process. With the use of a simulator or an evaluation board, code may be tested regularly as it is written. Writing code in modules or sections can help this process, as each module can be tested individually, with a greater chance of the whole system working at the system integration stage. There are two commonly used methods in developing software for DSP devices: an assembly program or a C=C‡‡ program. Assembly language is one step removed from the machine code actually used by the processor. Programming in assembly language gives the engineers full control of processor functions, thus resulting in the most efficient program for mapping the algorithm by hand. However, this is a very time-consuming and laborious task, especially for today's highly paralleled DSP architectures. A C program is easier for software upgrades and maintenance. However, the machine code generated by a C compiler is inefficient in both processing speed and memory usage. Recently, DSP manufactures have improved C compiler efficiency dramatically. Often the ideal solution is to work with a mixture of C and assembly code. The overall program is controlled by C code and the run-time critical loops are written in assembly language. In a mixed programming environment, an assembly routine may be either called as a function, or in-line coded into the C program. A library of hand-optimized functions may be built up and brought into the code when required. The fundamentals of C language for DSP applications will be introduced in Appendix C, while the assembly programming for the TMS320C55x will be discussed in Chapter 2. Mixed C and assembly programming will be introduced in Chapter 3. Alternatively, there are many high-level system design tools that can automatically generate an implementation in software, such as C and assembly language. 1.4.4 High-Level Software Development Tools Software tools are computer programs that have been written to perform specific operations. Most DSP operations can be categorized as being either analysis tasks or filtering tasks. Signal analysis deals with the measurement of signal properties. MATLAB is a powerful environment for signal analysis and visualization, which are critical components in understanding and developing a DSP system. Signal filtering, such as removal of unwanted background noise and interference, is usually a time- domain operation. C programming is an efficient tool for performing signal filtering and is portable over different DSP platforms. In general, there are two different types of data files: binary files and ASCII (text) files. A binary file contains data stored in a memory-efficient binary format, whereas an ASCII file contains information stored in ASCII characters. A binary file may be viewed as a sequence of characters, each addressable as an offset from the first position in the file. The system does not add any special characters to the data except null characters appended at the end of the file. Binary files are preferable for data that is going to be generated and used by application programs. ASCII files are necessary if the 18 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 44. C program (Source) C compiler Machine code (Object) Linker/loader Execution Program output Libraries Data Figure 1.10 Program compilation, linking, and execution data is to be shared by programs using different languages and different computer platforms, especially for data transfer over computer networks. In addition, an ASCII file can be generated using a word processor program or an editor. MATLAB is an interactive, technical computing environment for scientific and engineering numerical analysis, computation, and visualization. Its strength lies in the fact that complex numerical problems can be solved easily in a fraction of the time required with a programming language such as C. By using its relatively simple pro- gramming capability, MATLAB can be easily extended to create new functions, and is further enhanced by numerous toolboxes such as the Signal Processing Toolbox. MATLAB is available on most commonly used computers such as PCs, workstations, Macintosh, and others. The version we use in this book is based on MATLAB for Windows, version 5.1. The brief introduction of using MATLAB for DSP is given in Appendix B. The purpose of a programming language is to solve a problem involving the manip- ulation of information. The purpose of a DSP program is to manipulate signals in order to solve a specific signal-processing problem. High-level languages are computer lan- guages that have English-like commands and instructions. They include languages such as C=C‡‡, FORTRAN, Basic, and Pascal. High-level language programs are usually portable, so they can be recompiled and run on many different computers. Although C is categorized as a high-level language, it also allows access to low-level routines. In addition, a C compiler is available for most modern DSP devices such as the TMS320C55x. Thus C programming is the most commonly used high-level language for DSP applications. C has become the language of choice for many DSP software development engineers not only because it has powerful commands and data structures, but also because it can easily be ported on different DSP platforms and devices. The processes of compilation, linking/loading, and execution are outlined in Figure 1.10. A C compiler translates a high-level C program into machine language that can be executed by the computer. C compilers are available for a wide range of computer platforms and DSP chips, thus making the C program the most portable software for DSP applications. Many C programming environments include debugger programs, which are useful in identifying errors in a source program. Debugger programs allow us to see values stored in variables at different points in a program, and to step through the program line by line. 1.5 Experiments Using Code Composer Studio The code composer studio (CCS) is a useful utility that allows users to create, edit, build, debug, and analyze DSP programs. The CCS development environment supports EXPERIMENTS USING CODE COMPOSER STUDIO 19
  • 45. several Texas Instruments DSP processors, including the TMS320C55x. For building applications, the CCS provides a project manager to handle the programming tasks. For debugging purposes, it provides breakpoint, variable watch, memory/register/stack viewing, probe point to stream data to and from the target, graphical analysis, execution profiling, and the capability to display mixed disassembled and C instructions. One important feature of the CCS is its ability to create and manage large projects from a graphic-user-interface environment. In this section, we will use a simple sinewave example to introduce the basic built-in editing features, major CCS components, and the use of the C55x development tools. We will also demonstrate simple approaches to software development and debugging process using the TMS320C55x simulator. The CCS version 1.8 was used in this book. Installation of the CCS on a PC or a workstation is detailed in the Code Composer Studio Quick Start Guide [8]. If the C55x simulator has not been installed, use the CCS setup program to configure and set up the TMS320C55x simulator. We can start the CCS setup utility, either from the Windows start menu, or by clicking the Code Composer Studio Setup icon. When the setup dialogue box is displayed as shown in Figure 1.11(a), follow these steps to set up the simulator: ± Choose Install a Device Driver and select the C55x simulator device driver, tisimc55.dvr for the TMS320C55x simulator. The C55x simulator will appear in the middle window named as Available Board/Simulator Types if the installation is successful, as shown in Figure 1.11(b). ± Drag the C55x simulator from Available Board/Simulator Types window to the System Configuration window and save the change. When the system configuration is completed, the window label will be changed to Available Processor Types as shown in Figure 1.11(c). 1.5.1 Experiment 1A ± Using the CCS and the TMS320C55x Simulator This experiment introduces the basic features to build a project with the CCS. The purposes of the experiment are to: (a) create projects, (b) create source files, (c) create linker command file for mapping the program to DSP memory space, (d) set paths for C compiler and linker to search include files and libraries, and (e) build and load program for simulation. Let us begin with the simple sinewave example to get familiar with the TMS320C55x simulator. In this book, we assume all the experiment files are stored on a disk in the computer's A drive to make them portable for users, especially for students who may share the laboratory equipment. 20 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 46. (a) (b) (c) Figure 1.11 CCS setup dialogue boxes: (a) install the C55x simulator driver, (b) drag the C55x simulator to system configuration window, and (c) save the configuration The best way to learn a new software tool is by using it. This experiment is partitioned into following six steps: 1. Start the CCS and simulator: ± Invoke the CCS from the Start menu or by clicking on the Code Composer Studio icon on the PC. The CCS with the C55x simulator will appear on the computer screen as shown in Figure 1.12. 2. Create a project for the CCS: ± Choose Project!New to create a new project file and save it as exp1 to A:Experiment1. The CCS uses the project to operate its built-in utilities to create a full build application. 3. Create a C program file using the CCS: ± Choose File!New to create a new file, then type in the example C code listed in Table 1.2, and save it as exp1.c to A:Experiment1. This example reads EXPERIMENTS USING CODE COMPOSER STUDIO 21
  • 47. Figure 1.12 CCS integrated development environment Table 1.2 List of sinewave example code, exp1.c #define BUF_SIZE 40 const int sineTable[ BUF_SIZE]ˆ {0x0000,0x000f,0x001e,0x002d,0x003a,0x0046,0x0050,0x0059, 0x005f,0x0062,0x0063,0x0062,0x005f,0x0059,0x0050,0x0046, 0x003a,0x002d,0x001e,0x000f,0x0000,0xfff1,0xffe2,0xffd3, 0xffc6,0xffba,0xffb0,0xffa7,0xffa1,0xff9e,0xff9d,0xff9e, 0xffa1,0xffa7,0xffb0,0xffba,0xffc6,0xffd3,0xffe2,0xfff1} ; int in_buffer[ BUF_SIZE]; int out_buffer[ BUF_SIZE]; int Gain; void main () { int i,j; Gain ˆ 0x20; 22 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 48. Table 1.2 (continued ) while (1) { /* - set profile point on this line */ for (i ˆ BUF_SIZE 1; i ˆ 0; i ) { j ˆ BUF_SIZE 1 i; out_buffer[ j]ˆ 0; in_buffer[ j]ˆ 0; } for (i ˆ BUF_SIZE 1; i ˆ 0; i ) { j ˆ BUF_SIZE 1 i; in_buffer[ i]ˆ sineTable[ i]; /* - set breakpoint */ in_buffer[ i]ˆ 0 in_buffer[ i]; out_buffer[ j]ˆ Gain*in_buffer[ i]; } } /* - set probe and profile points on this line */ } pre-calculated sinewave values from a table, negates, and stores the values in a reversed order to an output buffer. Note that the program exp1.c is included in the experimental software package. However, it is recommended that we create this program with the editor to get familiar with the CCS editing functions. 4. Create a linker command file for the simulator: ± Choose File!New to create another new file and type in the linker command file listed in Table 1.3 (or copy the file exp1.cmd from the experi- mental software package). Save this file as exp1.cmd to A:Experiment1. Linker uses a command file to map different program segments into a pre- partitioned system memory space. A detailed description on how to define and use the linker command file will be presented in Chapter 2. 5. Setting up the project: ± After exp1.c and exp1.cmd are created, add them to the project by choosing Project!Add Files, and select files exp1.c and exp1.cmd from A:Experiment1. ± Before building a project, the search paths should be set up for the C compiler, assembler, and linker. To set up options for the C compiler, assembler, and linker, choose Project!Options. The paths for the C55x tools should be set up during the CCS installation process. We will need to add search paths in order to include files and libraries that are not included in the C55x tools directories, such as the libraries and included files we have created in EXPERIMENTS USING CODE COMPOSER STUDIO 23
  • 49. Table 1.3 Linker command file /* Specify the system memory map */ MEMORY { RAM (RWIX): origin ˆ 000100h, length ˆ 01feffh /* Data memory */ RAM2 (RWIX): origin ˆ 040100h, length ˆ 040000h /* Program memory */ ROM (RIX) : origin ˆ 020100h, length ˆ 020000h /* Program memory */ VECS (RIX) : origin ˆ 0ffff00h, length ˆ 00100h /* Reset vector */ } /* Specify the sections allocation into memory */ SECTIONS { vectors VECS /* Interrupt vector table */ .text ROM /* Code */ .switch RAM /* Switch table information */ .const RAM /* Constant data */ .cinit RAM2 /* Initialization tables */ .data RAM /* Initialized data */ .bss RAM /* Global static variables */ .sysmem RAM /* Dynamic memory allocation area */ .stack RAM /* Primary system stack */ } ± the working directory. For programs written in C language, it requires using the run-time support library, rts55.lib for DSP system initialization. This can be done by selecting Libraries under Category in the Linker dialogue box, and enter the C55x run-time support library, rts55.lib. We can also specify different directories to store the output executable file and map file. Figure 1.13 shows an example of how to set the search paths for compiler, assembler, or linker. 6. Build and run the program: ± Once all the options are set, use Project!Rebuild All command to build the project. If there are no errors, the CCS will generate the executable output file, exp1.out. Before we can run the program, we need to load the executable output file to the simulator from File!Load Program menu. Pick the file exp1.out in A:Experiment1 and open it. ± Execute this program by choosing Debug!Run. DSP status at the bottom left-hand corner of the simulator will be changed from DSP HALTED to DSP RUNNING. The simulation process can be stopped withthe Debug!Halt command. We can continue the program by reissuing the run command or exiting the simulator by choosing File!Exit menu. 24 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 50. Figure 1.13 Setup search paths for C compiler, assembler, or linker 1.5.2 Experiment 1B ± Debugging Program on the CCS The CCS has extended traditional DSP code generation tools by integrating a set of editing, emulating, debugging, and analyzing capabilities in one entity. In this section of the experiment, we will introduce some DSP program building steps and software debugging capabilities including: (a) the CCS standard tools, (b) the advanced editing features, (c) the CCS project environment, and (d) the CCS debugging settings. For a more detailed description of the CCS features and sophisticated configuration settings, please refer to Code Composer Studio User's Guide [7]. Like most editors, the standard tool bar in Figure 1.12 allows users to create and open files, cut, copy, and paste texts within and between files. It also has undo and re-do capabilities to aid file editing. Finding or replacing texts can be done within one file or in different files. The CCS built-in context-sensitive help menu is also located in the standard toolbar menu. More advanced editing features are in the edit toolbar menu, refer to Figure 1.12. It includes mark to, mark next, find match, and find next open parenthesis capabilities for C programs. The features of out-indent and in-indent can be used to move a selected block of text horizontally. There are four bookmarks that allow users to create, remove, edit, and search bookmarks. EXPERIMENTS USING CODE COMPOSER STUDIO 25
  • 51. The project environment contains a C compiler, assembler, and linker for users to build projects. The project toolbar menu (see Figure 1.12) gives users different choices while working on projects. The compile only, incremental build, and build all functions allow users to build the program more efficiently. Breakpoints permit users to set stop points in the program and halt the DSP whenever the program executes at those breakpoint locations. Probe points are used to transfer data files in and out of pro- grams. The profiler can be used to measure the execution time of the program. It provides program execution information, which can be used to analyze and identify critical run-time blocks of the program. Both the probe point and profile will be discussed in detail in the next section. The debug toolbar menu illustrated in Figure 1.12 contains several step operations: single step, step into a function, step over a function, and step out from a function back to its caller function. It can also perform the run-to-cursor operation, which is a very convenient feature that allows users to step through the code. The next three hot buttons in the debug tool bar are run, halt, and animate. They allow users to execute, stop, and animate the program at anytime. The watch-windows are used to monitor variable contents. DSP CPU registers, data memory, and stack viewing windows provide additional information for debugging programs. More custom options are available from the pull-down menus, such as graphing data directly from memory locations. When we are developing and testing programs, we often need to check the values of variables during program execution. In this experiment, we will apply debugging settings such as breakpoints, step commands, and watch-window to understand the CCS. The experiment can be divided into the following four steps. 1. Add and remove breakpoints: ± Start with Project!Open, select exp1 in the A:Experiment1 directory. Build and load the experiment exp1.out. Double-click on the C file exp1.c in the project-viewing window to open it from the source folder. ± Adding and removing a breakpoint to a specific line is quite simple. To add a breakpoint, move the cursor to the line where we want to set a breakpoint. The command to enable a breakpoint can be given from the Toggle Breakpoint hot button on the project toolbar or by clicking the right mouse button and choosing toggle breakpoint. The function key F9 is a shortcut key that also enables breakpoints. Once a breakpoint is enabled, a red dot will appear on the left to indicate where the breakpoint is set. The program will run up to that line without exceeding it. To remove breakpoints, we can either toggle breakpoints one by one, or we can select the Delete All tap from the debug tool bar to clear all the break- points at once. Now put the cursor on the following line: in_buffer[ i] ˆ sineTable[ i]; /* - set breakpoint */ and click the Toggle Breakpoint toolbar button (or press F9). 2. Set up viewing windows: ± On the standard tool menu bar click View!CPU Registers!CPU Registers to open the CPU registers window. We can edit the contents of any 26 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 52. CPU register by double clicking on it. Right click on the CPU Register window and select Allow Docking. We can now move and resize the window. Try to change the temporary register T0 and accumulator AC0 to T0 ˆ 0x1234 and AC0 ˆ 0x56789ABC. ± On the CCS menu bar click Tools!Command Window to add the Command Window. We can resize and dock it as in the previous step. The command window will appear each time we rebuild the project. ± We can customize the CCS display and settings using the workspace feature. To save a workspace, click File!Workspace!Save Workspace and give the workspace a name. When we restart CCS, we can reload that workspace by clicking File!Workspace!Load Workspace and select the proper workspace filename. ± Click View!Dis-Assembly on the menu bar to see the disassembly window. Every time we reload an executable file, the disassembly window will appear automatically. 3. Using the single step features: ± When using C programs, the C55x system uses a function called boot from the run-time support library rts55.lib to initialize the system. After we load the exp1.out, the program counter (PC) should be at the start of the boot function and the assembly code, boot.asm, should be displayed in the disassembly window. For a project starting with C programs, there must be a function called main() from which the C functions logically begin to execute. We can issue the command, Go Main, from the Debug menu to start the C program. ± After the Go Main command, the DSP will be halted at the location where the function main() is. Hit the F8 key or click the single step button on the debug toolbar repeatedly and single-step through the program exp1.c, watching the values of the CPU registers change. Move the cursor to a different location in the code and try the run-to-cursor command (hold down the Ctrl and F10 keys simultaneously). 4. Resource monitoring: ± From View!Watch Window, open the Watch Window area. At run time, this area shows the values of watched variables. Right-click on the Watch Window area and choose Insert New Expression from the pop-up list. Type the output buffer name, out_buffer, into the expression box and click OK, expand the out_buffer to view each individual element of the buffer. ± From View!Memory, open a memory window and enter the starting address of the in_buffer in data page to view the data in the input and output buffers. Since global variables are defined globally, we can use the variable name as the address for memory viewing. ± From View!Graph!Time/Frequency, open the Graphic Property dialogue. Set the display parameters as shown in Figure 1.14. The CCS allows the user to plot data directly from memory by specifying the memory location and its length. ± Set a breakpoint on the line of the following C statement: EXPERIMENTS USING CODE COMPOSER STUDIO 27
  • 53. Figure 1.14 Graphics display settings in_buffer[ i] ˆ sineTable[ i]; /* - set breakpoint */ Start animation execution, and view CPU registers, in_buffer and out_buffer data in both the watch-window and the memory window. Figure 1.15 shows one instant snapshot of the animation. The yellow arrow represents the current program counter's location, and the red dot shows where the breakpoint is set. The data and register values in red color are the ones that have just been updated. 1.5.3 Experiment 1C ± File Input and Output Probe point is a useful tool for algorithm development, such as simulating real-time input and output operations. When a probe point is reached, the CCS can either read a selected amount of data samples from a file on the host PC to DSP memory on the target, or write processed data samples to the host PC. In the following experiment, we will learn how to set up a probe point to transfer data from the example program to a file on the host computer. ± Set the probe point at the end of the while {} loop at the line of the close bracket as: while(1) { ... ... } /* - set probe point on this line */ ± where the data in the output buffer is ready to be transferred out. Put the cursor on the line and click Toggle Probe Point. A blue dot on the left indicates the probe point is set (refer to Figure 1.15). 28 INTRODUCTION TO REAL-TIME DIGITAL SIGNAL PROCESSING
  • 54. Figure 1.15 CCS screen snapshot of the Experiment 1B ± From File!File I/O, open the file I/O dialogue box and select File Output tab. From the Add File tab, enter exp1_out.dat as file name, then select Open. Using the output variable name, out_buffer, as the address and 40 (BUF_SIZE) as the length of the data block for transferring 40 data samples to the host computer from the buffer every time the probe point is reached. Now select Add Probe Point tab to connect the probe point with the output file exp1_out.dat as shown in Figure 1.16. ± Restart the program. After execution, we can view the data file exp1_out.dat using the built-in editor by issue File!Open command. If we want to view or edit the data file using other editors/viewers, we need to exit the CCS or disconnect the file from the File I/O. An example data file is shown in Table 1.4. The first line contains the header information in TI Hexadecimal format, which uses the syntax illustrated in Figure 1.17. For the example given in Table 1.4, the data stored is in hexadecimal format with the address of out_buffer at 0xa8 on data page and each block containing 40 (0x28) data values. If we want to use probe to connect an input data file to the program, we will need to use the same hex format to include a header in the input data file. 1.5.4 Experiment 1D ± Code Efficiency Analysis The profiler can be used to measure the system execution status of specific segments of the code. This feature gives users an immediate result about the program's performance. EXPERIMENTS USING CODE COMPOSER STUDIO 29
  • 55. Another Random Document on Scribd Without Any Related Topics
  • 56. I can sew better myself, was Hal's usual comment. And it was true. Hal had a bedquilt nearly pieced, which he had done on rainy days and by odd spells. I expect you think he was something of a girl-boy. But then he was very sweet and nice. Florence stood by the gate one afternoon, looking extremely lovely in her blue and white gingham, and her curls tied back with a bit of blue ribbon. Dot had been in the mud-pie business; and, if it had proved profitable, she would no doubt have made a fortune for the family. Go in the house this minute, and get washed, commanded Florence. What a naughty, dirty child you are! Then a carriage passed by very slowly. A young man was driving, and two ladies sat on the back seat. They looked as if they were going to halt. Florence's heart was in her mouth. She drew herself up in her most stately attitude. The young man turned; and the lady nearer her beckoned. Florence stepped out slowly. She thought, with some pride, that, if they wanted a drink, she had a goblet to offer them. My little girl, said the lady, in a soft, clear voice, can you direct us to a blacksmith's? There is one on this road, rather more than a quarter of a mile farther. Thank you. The other lady leaned over, and studied Florence. She had a worn, faded, and fretful look; but some new expression lighted up her sallow face.
  • 57. Oh, she sighed, what a beautiful girl! Now, if I had a daughter like that! I wonder if she lives in that forlorn old rookery? A princess in disguise; and the young man laughed. She was unusually lovely. At her age I had just such hair. But ah, how one fades! The straggling auburn hair, very thin on the top, hardly looked as if it had once been like fine spun gold. The trial of my life has been not having a daughter. Mrs. Duncan had heard this plaint very often from her half-sister, who had married a widower nearly three times her age. He had made a very liberal provision for her during her life, but at her death the fortune reverted to his family again. She had always bewailed the fact of having no children; but boys were her abomination. Mrs. Duncan's house was too noisy, with its four rollicking boys; but now that George was growing to manhood he became rather more endurable. I do not believe the child could have belonged there, she commenced again. Because she was so pretty? asked George. She doesn't look like a country girl. But some country girls are very handsome, said Mrs. Duncan. They do not possess this air of refinement generally. And did you observe that she answered in a correct and ladylike manner? Aunt Sophie is captivated. A clear case of love at first sight. Why not adopt her? It would be a charity to take her out of that hovel, if it is her home.
  • 58. I shouldn't think of such a thing now, Sophie, with your poor health, said her sister. There are some natures on which the least contradiction or opposition acts instantly, rousing them to a spirit of defiance. For several years Mrs. Duncan had urged her sister to adopt a child; but she had never found one that answered her requirements. She was not fond of the trouble of small children. Now that Mrs. Duncan had advised contrarywise, Mrs. Osgood was seized with a perverse fit. I am sure I need a companion, she returned with martyr-like air. Take a young woman then, who can be a companion. Here is the blacksmith's, announced George. I suppose you will have to find some place of refuge; and he laughed again gayly. Where can we go? George held a short conversation with the smith. My house is just opposite, and the ladies will be welcome, the latter said. It will take me about half an hour to repair your mishap. George conducted them thither. The good woman would fain have invited them in; but they preferred sitting on the vine-covered porch. Mrs. Osgood asked for a glass of water. O Florence! if you had been there! It happened after a while, that George and his mother walked down the garden. Mrs. Green felt bound to entertain this stranger cast upon her care, as she considered it. Mrs. Osgood made some inquiries presently about the house they had passed, with a small stream of water just below it. Why, that's Granny Kenneth's, said Mrs. Green.
  • 59. And who is the child,—almost a young lady? Why, that must be Florence. Did she have long yeller curls? If she was my gal she should braid 'em up decently. I wouldn't have 'em flyin' about. And who is Florence? Mrs. Osgood's curiosity must have been very great to induce her to listen to the faulty grammar and country pronunciations. But she listened to the story from beginning to end,—Joe, and Joe's wife, and all the children, figuring largely in it. And if Granny Kenneth'd had any sense, she would a bundled 'em all off to the poor-house. One of the neighbors here did want to take Florence; but law! what a time they made! She's a peart, stuck- up thing! If Florence had heard this verdict against all her small industries and neatnesses and ladylike habits, her heart would have been almost broken. But there are a great many narrow-minded people in this world, who can see no good except in their own way. Mrs. Osgood made no comments. Presently the carriage was repaired, and the accidental guests departed. They had a long ride yet to take. George asked if there was any nearer way of getting to Seabury. There's a narrer road just below Granny Kenneth's,—the little shanty by the crick. It's ruther hard trav'lin', but it cuts off nigh on ter three miles. I think we had better take it, said George. Even that will give us a five-miles drive. So they passed the cottage again. This time Hal was feeding the chickens; Kit and Charlie swinging upon an old dilapidated apple- tree; and Florence sat by the open window, sewing.
  • 60. There's your princess! exclaimed George with a laugh. Florence colored a little at beholding the party again. Mrs. Duncan had come to Seabury, a rather mountainous place, remarkable for its pure air, for the sake of her youngest son, Arthur, who had been ill with a fever. Mrs. Osgood took an odd fancy to accompany her. The seven years of her widowhood had not been happy years, though she had a house like a palace. When she first laid off mourning, she tried Newport and Saratoga; but somehow she did not succeed in making a belle of herself, and that rather mortified her. Then she sank into invalidism; which tried everybody's patience sorely. Leaning back in the carriage now, she thought to herself, Yes, if I only had some one of my own! Sister Duncan never did understand me, or appreciate the delicacy of my constitution. Her nerves have been blunted by those great rude boys. And that girl looks so refined and graceful,—she would make a pleasant companion I am sure. But I should want to take her away from her family: I never could consent to any intimacy with them. She ventured to broach her subject to Mrs. Duncan the next day. Perhaps Mrs. Duncan had grown rather impatient with her sister's whims and fancies; and she discouraged the plan on some very sensible grounds. Mrs. Osgood felt like a martyr. Yet the opposition roused her to attempt it. One day, a week afterward perhaps, she hired a carriage, and was driven over to Madison. George had gone back to the city, so there was no question of having him for escort. Granny Kenneth was much surprised at the appearance of so fine a lady. She seized Dot, and scrubbed her face, her usual employment upon the entrance of any one.
  • 61. Mrs. Osgood held up her ruffled skirts as if afraid of contamination. Is your granddaughter at home? was asked in the most languid of voices. Flo, you mean? No: she hasn't come from school yet. Do walk in and wait—that is—I mean—if you please, said Granny a good deal flustered, while the little gray curls kept bobbing up and down. Here's a clean cheer; and she gave one a whiff with her apron. Poor Flossy. She had tried so hard to correct Granny's old- fashioned words and pronunciations. Thank you. Miss Florence embroiders, I believe. Yes, she works baby-petticoats, and does 'em splendid. And then Granny wondered if she, the fine lady, had any work for Florence. How glad Flo'll be, and vacation coming so soon, she thought in the depth of her tender old soul. And she's a genius at crochetin'! The laces and shawls and hoods she's knit are a real wonder. They didn't do any thing of the kind in my young days. You must find it pretty hard to get along, condescended Mrs. Osgood. Yes; but the Lord allers provides some way. Joe's gone in a store,—Mr. Terry's. He's next to Florence, went on Granny in sublime disregard of her pronoun. Mrs. Osgood took an inventory of the little room, and waited rather impatiently. Then she asked for a glass of water. O Granny! how could you have been so forgetful! To take that old, thick, greenish glass tumbler when Flossy's choice goblet stood
  • 62. on the shelf above! And then to fill it in the pail, and let the water dribble! Granny wondered whether it would be polite to entertain her or not. But just then there was a crash and a splash; and Dot and the water-pail were in the middle of the floor. Here's a chance! exclaimed Kit, pausing in the doorway. Give us a hook and line, Granny: Dot's mouth is just at an angle of ten degrees, good for a bite. A wail, sure enough! said Charlie. Wring her out, and hang her up to dry. Oh, dear! and Granny, much disconcerted, sat Dot wrong side up on a chair, and the result was a fresh tumble. It was Hal who picked her up tenderly,—poor wet baby, with a big red lump on her forehead, and dismal cries issuing from the mouth that seemed to run all round her head. Stay out there till I wipe up, said Granny to the others. Then I'll get Dot a dry dress. I never did see such an onlucky child—and company too. What will Flo say! For Florence came tripping up the path, knitting her delicate brows in consternation. Never you mind. There's a lady in the parlor who's been waitin'. Oh, my! what did I do with that floor-cloth? A lady? Yes: run right along. Luckily the door was shut between. Florence gave her curls a twist and a smoothing with her fingers, took off her soiled white apron, pulled her dress out here and there, stepped over the pools of water, and entered.
  • 63. Mrs. Osgood admired her self-possession, and pitied the poor child profoundly. The flush and partial embarrassment were very becoming to her. That lady did not mean to rush headlong into her proposal. She broke the ground delicately by inquiring about the embroidering; and Florence brought some to show her. Who taught you? she asked in surprise. No one; and Florence colored a little. I did not do the first as neatly, but it is quite easy after one is fairly started. I really do not see how you find time, with going to school; and this persevering industry did touch Mrs. Osgood's heart. I cannot do very much, answered Florence with a sigh. But it will soon be vacation. How old are you? I shall be fifteen the last of this month. What a family your grandmother has on her hands! Yes. If my father had lived, it would have been very different. A touching expression overspread Florence's face, and made her lovelier than ever in Mrs. Osgood's eyes. She certainly is very pretty, that lady thought; and how attractive such a daughter would be in my house! I should live my young life over again in her. For Mrs. Osgood had found that the days for charming young men were over, and prosy middle-aged people were little to her taste. No woman ever clung to youth with a greater longing. What do you study at school? she asked.
  • 64. Only the English branches. I have been thinking of—of becoming a teacher, said Florence hesitatingly. You would have a poor opportunity in this little town. I might go away; and Florence sighed again. You have never studied music, I suppose. No: I have had no opportunity, returned Florence honestly enough. Do you sing? Yes. And I love music so very, very much! I do mean to learn by and by, if it is possible. I wish you would sing something for me,—a little school-song, or any thing you are familiar with. Florence glanced up in amazement; and for a few moments was awkwardly silent. I should like to hear your voice. It is very pleasant in talking, and ought to be musical in singing. Florence was a good deal flattered; and then she had the consciousness that she was one of the best singers in school. So she ran over the songs in her own mind, and selected Natalie, the Maid of the Mill, which she was very familiar with. She sang it beautifully. Florence was one of the children who are always good in an emergency. She was seldom flustered, as Granny expressed it, and always seemed to know how to make the best of herself. And, as she saw the pleasure in Mrs. Osgood's face, her own heart beat with satisfaction. That is really charming. A little cultivation would make your voice very fine indeed. What a pity that you should be buried in this little town!
  • 65. Do you think—that I could—do any thing with it? asked Florence in a tremor of delight. I suppose your grandmother would not stand in the way of your advancement? questioned Mrs. Osgood. Oh, no! And then if I could do something— Florence felt that she ought to add, for the others, but somehow she did not. She wondered if Mrs. Osgood was a music- teacher, or a professional singer. But she did not like to ask. There is my carriage, said Mrs. Osgood, as a man drove slowly round. I am spending a few weeks at some distance from here, and wished to have you do a little flannel embroidery for me. When will your vacation commence? In about ten days,—the first of July. I wish to see you when we can have a longer interview. I will come over again then. Mrs. Osgood rose, and shook out her elegant grenadine dress, much trimmed and ruffled. On her wrists were beautiful bracelets, and her watch-chain glittered with every movement. Then she really smiled very sweetly upon the young girl; and Florence was charmed. Some dim recollection passed over her mind. Oh! she said, were you not in a carriage that stopped here some days ago. Another lady and a young gentleman— Yes, answered Mrs. Osgood, pleased at being remembered. And, my dear, I took a great fancy to you that day. You are so different from the majority of country girls, that it is a pity you should have no better chance. The longing and eloquent eyes of Florence said more than words.
  • 66. Yes. I will see you again; and I may, perhaps, think of something to your advantage. There was a mode of egress through this best-room, though Granny had brought her guest in by the kitchen way. Florence opened the door now. What a lovely, graceful child! thought Mrs. Osgood; and she scrutinized her from head to feet. Florence watched the carriage out of sight in a half-dream. How long she would have stood in a brown study is uncertain; but Granny came in to get some dry clothes for Dot. What did she want of you? exclaimed Charlie, all curiosity. And what were you singing for? Oh, my! wasn't she splendid? You sang like a bird, said Hal in wide-eyed wonder as well. Did she ask you? Of course. You don't suppose I would offer to sing for a stranger,—a lady too? Did she like it? Yes. She thought I might—that is, if I had any opportunity—oh, I wish we were a little richer! and Florence burst into a flood of hysterical tears. I wish we were; and Hal gave her hand a soft squeeze. If you could learn to play on the melodeon at church, and give music- lessons— The vision called up a heaven of delight to poor Flossy. But what did she want? asked Granny in a great puzzle, putting Dot's foot through the sleeve of her dress, and tying the neck-string in garter fashion.
  • 67. I do believe she is a singer herself. Maybe she belongs to a company who give concerts; but then she was dressed so elegantly. They make lots of money, said Kit with a sagacious nod of the head. It's what I'm going to be, only I shall have a fiddle. And a scalp-lock. Charlie pulled this ornamentation to its fullest height, which was considerable, as Kit's hair needed cutting. Oh! suppose she was, said Hal. And suppose she wanted to take Flossy, and teach her music,—why, it's like your plan, you know, only it isn't an old gentleman; and I don't believe she has any little girls,—I mean a little girl who died. Did she ask for a drink, Granny? Yes; and then Dot pulled over the water-pail. Oh, my! if I haven't put this dress on upside down, and the string's in a hard knot. Whatever shall I do? And, Flossy, I forgot all about the gobler. I took the first thing that came to hand. Not that old tumbler with a nick in the edge? And it is goblet. I do wish you'd learn to call things by their right names! exclaimed Florence in vexation. It's the very same, isn't it? began Charlie, only, as Hal said, it isn't an old gentleman. Oh, suppose it should come true! And if Kit should have a fiddle like black Jake. And if you should run away, laughed Hal. I don't believe you can find a better time than this present moment. Kit, you had better go after the cows. Charlie started too, upon Hal's suggestion. Florence gave a little sniff, and betook herself to the next room. Oh, dear! How poor and mean and tumbled about their house always was! No, not always, but if any one ever came. Dot chose just that moment to be unfortunate; and then that Granny should
  • 68. have used that forlorn old tumbler. She doubted very much if the lady would ever come again. So Flossy had a good cry from wounded vanity, and then felt better. Hal took Dot out with him to feed the chickens, and Granny prepared the table. Still Florence's lady was the theme of comment and wonder for several days, although the child insisted that she only came to get some embroidering done. All further speculations seemed too wild for sober brains. But it is so odd that she asked you to sing, said Hal. And I do believe something will come of it. Florence gave a little despairing sniff.
  • 69. M CHAPTER VIII. FLORENCE IN STATE. rs. Osgood leaned back in the carriage,—it was the very best that Seabury afforded,—and, looking out on the pleasant sunshine and waving trees, considered the subject before her. If she took Florence, she would have a governess in the house, and go on as rapidly as possible with the finishing process. Music should be the first thing: the child did have a lovely voice, and such fair, slender hands! In a year she would be quite presentable. How vexed all the Osgood nieces would be! They were continually hinting at visits, and would be delighted at having Aunt Osgood take them up. But somehow she had a grudge against her husband's relatives, because the property reverted to them in the end. And then she fancied herself riding out with this beautiful daughter by her side, or stopping at hotels where every one would wonder who that lovely girl could be! And Florence would certainly be most grateful for the change. It was a deed of charity to rescue the poor child from the life before her, with no better prospect than that of a school-teacher. She certainly had some ideas and ambitions beyond her sphere. School closed presently, and the children were wild with delight. They had a great time on examination day, and Florence acquitted herself finely. Mr. Fielder was very proud of her. If you can go to school another year, and improve as much, he said, I can almost promise you a very good situation. Flossy's dream in respect to her elegant lady was fading, and she came back to humbler prospects quite thankfully.
  • 70. What Granny was to do with the children through vacation she hardly knew. Oh, you needn't worry! said Charlie consolingly. Kit and me are going out in the woods; and we'll build a stunning log-hut, or make a cave— O Charlie, if you would be a little more careful! Kit and I. I can't be always bothering! Mr. Fielder almost wears me out, so you might let me have a little rest in vacation. 'For spelling is vexation, And writing is bad: Geography it puzzles me, And grammar makes me mad.' With that Charlie perched herself on the gate-post, and began to whistle. If Charlie only had been a boy! groaned Florence. On Monday of the first week they washed. Florence assisted; but she hurried to get herself dressed in the afternoon, for fear some one might come. And then she wondered a little what she ought to do. Embroidering and fancy work appeared to be dull just now; and she would have two months in which she might earn considerable money, if it only came. For, with all her small vanities and particular ways, she was not indolent. On Tuesday they began their ironing at an early hour. There were Florence's pretty dresses and aprons, nothing very costly, but a dainty ruffle here and there added to the general grace. These same ruffles were a great trouble to some of the old ladies in Madison, who didn't see how Granny Kenneth could let Florence waste her time in such nonsense while she slaved herself to death!
  • 71. Florence had twisted her hair in a knot, and her dress was rather the worse for wear; but she worked away cheerfully. Her pile of clothes was decreasing very fast. Suddenly a sound of carriage-wheels startled her; and, glancing up, she uttered a frightened exclamation. O Granny! it's the lady again, and I look like a fright! What shall I do? Won't you go and ask her in? and you look dreadful too! Put on your other sacque. There! I'll run and tidy up a bit. She made a snatch at the brush and comb, and hurried up in the boys' room. Oh, dear! How red I am in the face! It's too bad; and she felt tempted to cry, but she knew that would only make matters worse. So she let down her shining hair, brushed it out, and wound it round her fingers in curls. Then Granny came plodding up stairs. I told her you were busy, but that you'd be ready in a few minutes, she explained. Why didn't you think to bring up one of my clean dresses? To be sure! which one? The pink calico, I guess. Oh! and the braided white apron. Down went Granny. Ah! many a step had she taken for these children, weary ones, and yet cheerfully done. Would they ever think of it? Florence was not long in making herself neat and presentable, but the flushed face still troubled her. She viewed herself critically in the cracked glass, and then ran down, pausing to fan a few moments with the cape of an old sun-bonnet, the nearest thing at hand. Do I look decent, Granny? she said apprehensively.
  • 72. To be sure you do, and nice too. Granny's eyes expressed her admiration. Florence ventured in timidly, and the lady inclined her head. I am sorry that I have kept you waiting so long, but it was unavoidable; and the child made a little halt to wonder if her long word sounded well. I suppose I took you somewhat by surprise. Are you very busy to-day? Not very, answered Florence at random, her heart beating violently. And quite well? but I hardly need ask the question. I am always well, thank you, with a touch of grace. How fortunate! Now, I have such wretched health, and my nerves are weak beyond description. Florence gave a glance of quick sympathy, not unmixed with admiration. There was something very romantic about the languid lady. If you are quite at liberty, Mrs. Osgood began, I should like to have you drive out with me. I have a great deal to say to you, and we shall not be interrupted. Florence could hardly credit her hearing. To be asked to ride with so grand a lady! Oh! and then she paused and colored. Would you like to go? Very, very much indeed; and the young face was full of pleasure.
  • 73. Well, get yourself ready; and, if you will send your grandmother to me, I will explain. Florence felt as if she were in a dream. Then she wondered what she ought to wear. She had a pretty light gray dress and sacque for Sunday best, and a new white dress; but her visitor's dress was gray, and that decided her. So she took the articles out of the old- fashioned wardrobe, and summoned Granny. Granny was dazed. Where is she going to take you? she asked in helpless astonishment. I don't know. She will tell you, I suppose. But, Flo, I have heerd of girls being kidnapped or something; and Granny's face turned pale with fear. Nonsense! returned Flossy with a toss of the curls. She could not even trouble herself about Granny's mispronunciation just then. You don't know— I guess she won't eat me up. Any how, I am going. Florence uttered this with a touch of imperiousness. Granny felt that she would have little influence over her, so she entered the room where the guest was seated. Mrs. Kenneth, the lady began in her most impressive and gracious manner, when I was here a few days ago, I took a great fancy to your granddaughter. My name is Osgood; and I am staying at Seabury with my sister, Mrs. Duncan. And although you may hesitate to trust Florence with a stranger, she will be quite safe, I assure you; and if you are willing, therefore, I should like to take her out for a few hours. I have some plans that may be greatly to the child's advantage, I think. You'll be sure to bring her back, asked Granny in a spasm of anxious terror, which showed in her eyes.
  • 74. Why, certainly! My poor woman, I cannot blame you for this carefulness; for the worn face with its eagerness touched Mrs. Osgood. My brother-in-law, Mr. Duncan, is a well-known merchant in New York; and I think you will confess when I return Florence this afternoon, that the ride has been no injury to her. Granny could make no further objections, and yet she did not feel quite at ease. But Florence entered looking so bright and expectant, that she had not the heart to disappoint her, so she kept her fears to herself. You must not feel troubled, Mrs. Osgood deigned to say, as she rose rather haughtily. You will find my promises perfectly reliable. You needn't finish my pieces, Florence whispered softly to Granny at the door. I shall be back time enough; and if the fire is out I'll wait till to-morrow They are my ruffled aprons, and— Mrs. Osgood beckoned her with a smile and an inclination of the head. Florence felt as if she were being bewitched. Granny watched her as she stepped into the carriage.
  • 75. If she'd been born a lady she couldn't act more like one. It's a great pity— A few tears finished Granny's sentence. All the others were more content with their poverty than Florence. So she went back to her ironing with a heart into which had crept some strange misgiving. Hal was out; Joe never came home to dinner; so Granny gave the children a piece of bread all round, and kept going steadily on until the last ruffled apron had been taken out of the pile. Very long indeed the hours seemed. Oh, if any harm should befall her beautiful, darling Flossy! Poor Joe, in his grave, had loved her so well! Flossy meanwhile was having a most delightful time. I am going to take you to Salem, Mrs. Osgood said, after Florence had begun to feel quite at home with her. We will have our
  • 76. Welcome to our website – the perfect destination for book lovers and knowledge seekers. We believe that every book holds a new world, offering opportunities for learning, discovery, and personal growth. That’s why we are dedicated to bringing you a diverse collection of books, ranging from classic literature and specialized publications to self-development guides and children's books. More than just a book-buying platform, we strive to be a bridge connecting you with timeless cultural and intellectual values. With an elegant, user-friendly interface and a smart search system, you can quickly find the books that best suit your interests. Additionally, our special promotions and home delivery services help you save time and fully enjoy the joy of reading. Join us on a journey of knowledge exploration, passion nurturing, and personal growth every day! ebookbell.com