packed numbers

JSYChen 2003-10-17 03:08:32
可以請問第二句的packed numbers是什意思呢?謝謝!
Calculations involving type I or F fields correspond more or less directly to machine commands.
In contrast, calculations involving packed numbers (type P) are programmed, and thus noticeably slower.
...全文
29 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
miswang 2003-11-06
  • 打赏
  • 举报
回复
是abap語言里一種數據類型,但它的運算精度比float 還高!
PL/0语言是Pascal语言的一个子集,我们这里分析的PL/0的编译程序包括了对PL/0语言源程序进行分析处理、编译生成类PCODE代码,并在虚拟机上解释运行生成的类PCODE代码的功能。   PL/0语言编译程序采用以语法分析为核心、一遍扫描的编译方法。词法分析和代码生成作为独立的子程序供语法分析程序调用。语法分析的同时,提供了出错报告和出错恢复的功能。在源程序没有错误编译通过的情况下,调用类PCODE解释程序解释执行生成的类PCODE代码。 PL0的一部分代码: program PL0 (input,output); (*PL/0 compiler with code generation*) (*Program 5.6 in Algorithms + Data Structures = Programs*) (*Almost identical with the version in Compilerbau *) label 99; const norw = 11; (*no. of reserved words*) txmax = 100; (*length of identifier table*) nmax = 14; (*max. no. of digits in numbers*) al = 10; (*length of identifiers*) amax = 2047; (*maximum address*) levmax = 3; (*maximum depth of block nesting*) cxmax = 200; (*size of code array*) type symbol = (nul,ident,number,plus,minus,times,slash,oddsym, eql,neq,lss,leq,gtr,geq,lparen,rparen,comma,semicolon, period,becomes,beginsym,endsym,ifsym,thensym, whilesym,dosym,callsym,constsym,varsym,procsym); alfa = packed array[1..al] of char; object_1 = (constant,variable,prozedure); symset = set of symbol; fct = (lit,opr,lod,sto,cal,int,jmp,jpc); (*functions*) instruction = packed record f: fct; (*function code*) l: 0..levmax;(*level*) a: 0..amax; (*displacement address*) end; (* lit 0,a: load constant a opr 0,a: execute operation a lod l,a: load variable l,a sto l,a: store variable l,a cal l,a: call procedure a at level l int 0,a: increment t-register by a jmp 0,a: jump to a jpc 0,a: jump conditional to a*) .......
详细的揭示了linux下的AT&T汇编指令使用方法,给出了各种汇编指令,指令用法,以及相应的例程。其中包括一些如何使用汇编链接C语言库,汇编调用系统调用,汇编执行浮点运算,C语言内嵌汇编等。 Chapter 1: What Is Assembly Language? 1 Processor Instructions 1 Instruction code handling 2 Instruction code format 3 High-Level Languages 6 Types of high-level languages 7 High-level language features 9 Assembly Language 10 Opcode mnemonics 11 Defining data 12 Directives 14 Summary 15 Chapter 2: The IA-32 Platform 17 Core Parts of an IA-32 Processor 17 Control unit 19 Execution unit 24 Registers 25 Flags 29 Advanced IA-32 Features 32 The x87 floating-point unit 32 Multimedia extensions (MMX) 33 Streaming SIMD extensions (SSE) 33 Hyperthreading 34 The IA-32 Processor Family 34 Intel processors 35 Non-Intel processors 36 Summary 37 Chapter 3: The Tools of the Trade 39 The Development Tools 39 The Assembler 40 The Linker 42 The Debugger 43 The Compiler 44 The object code disassembler 44 The Profiler 44 The GNU Assembler 45 Installing the assembler 45 Using the assembler 47 A word about opcode syntax 49 The GNU Linker 50 The GNU Compiler 53 Downloading and installing gcc 53 Using gcc 54 The GNU Debugger Program 56 Downloading and installing gdb 56 Using gdb 57 The KDE Debugger 60 Downloading and installing kdbg 60 Using kdbg 60 The GNU Objdump Program 62 Using objdump 63 An objdump example 64 The GNU Profiler Program 65 Using the profiler 65 A profile example 68 A Complete Assembly Development System 69 The basics of Linux 69 Downloading and running MEPIS 70 Your new development system 71 Summary 72 Chapter 4: A Sample Assembly Language Program 73 The Parts of a Program 73 Defining sections 74 Defining the starting point 74 Creating a Simple Program 75 The CPUID instruction 76 The sample program 77 Building the executable 80 Running the executable 80 Assembling using a compiler 80 Debugging the Program 81 Using gdb 81 Using C Library Functions in Assembly 86 Using printf 87 Linking with C library functions 88 Summary 90 Chapter 5: Moving Data 91 Defining Data Elements 91 The data section 91 Defining static symbols 94 The bss section 95 Moving Data Elements 97 The MOV instruction formats 97 Moving immediate data to registers and memory 98 Moving data between registers 99 Moving data between memory and registers 99 Conditional Move Instructions 106 The CMOV instructions 107 Using CMOV instructions 109 Exchanging Data 110 The data exchange instructions 111 Using the data exchange instruction 116 The Stack 119 How the stack works 119 PUSHing and POPing data 120 PUSHing and POPing all the registers 123 Manually using the ESP and EBP registers 123 Optimizing Memory Access 123 Summary 124 Chapter 6: Controlling Execution Flow 127 The Instruction Pointer 127 Unconditional Branches 129 Jumps 129 Calls 132 Interrupts 135 Conditional Branches 136 Conditional jump instructions 136 The compare instruction 138 Examples of using the flag bits 140 Loops 144 The loop instructions 144 A loop example 145 Preventing LOOP catastrophes 145 Duplicating High-Level Conditional Branches 146 if statements 147 for loops 150 Optimizing Branch Instructions 153 Branch prediction 153 Optimizing tips 155 Summary 158 Chapter 7: Using Numbers 161 Numeric Data Types 161 Integers 162 Standard integer sizes 162 Unsigned integers 164 Signed integers 166 Using signed integers 168 Extending integers 169 Defining integers in GAS 172 SIMD Integers 173 MMX integers 173 Moving MMX integers 174 SSE integers 176 Moving SSE integers 177 Binary Coded Decimal 178 What is BCD? 178 FPU BCD values 179 Moving BCD values 180 Floating-Point Numbers 182 What are floating-point numbers? 182 Standard floating-point data types 184 IA-32 floating-point values 186 Defining floating-point values in GAS 187 Moving floating-point values 187 Using preset floating-point values 189 SSE floating-point data types 190 Moving SSE floating-point values 191 Conversions 196 Conversion instructions 196 A conversion example 198 Summary 199 Chapter 8: Basic Math Functions 201 Integer Arithmetic 201 Addition 201 Subtraction 210 Incrementing and decrementing 215 Multiplication 216 Division 221 Shift Instructions 223 Multiply by shifting 224 Dividing by shifting 225 Rotating bits 226 Decimal Arithmetic 227 Unpacked BCD arithmetic 227 Packed BCD arithmetic 229 Logical Operations 231 Boolean logic 231 Bit testing 232 Summary 233 Chapter 9: Advanced Math Functions 235 The FPU Environment 235 The FPU register stack 236 The FPU status, control, and tag registers 237 Using the FPU stack 242 Basic Floating-Point Math 245 Advanced Floating-Point Math 249 Floating-point functions 249 Partial remainders 252 Trigonometric functions 254 Logarithmic functions 257 Floating-Point Conditional Branches 259 The FCOM instruction family 260 The FCOMI instruction family 262 The FCMOV instruction family 263 Saving and Restoring the FPU State 265 Saving and restoring the FPU environment 265 Saving and restoring the FPU state 266 Waiting versus Nonwaiting Instructions 269 Optimizing Floating-Point Calculations 270 Summary 270 Chapter 10: Working with Strings 273 Moving Strings 273 The MOVS instruction 274 The REP prefix 278 Other REP instructions 283 Storing and Loading Strings 283 The LODS instruction 283 The STOS instruction 284 Building your own string functions 285 Comparing Strings 286 The CMPS instruction 286 Using REP with CMPS 288 String inequality 289 Scanning Strings 291 The SCAS instruction 292 Scanning for multiple characters 293 Finding a string length 295 Summary 296 Chapter 11: Using Functions 297 Defining Functions 297 Assembly Functions 299 Writing functions 299 Accessing functions 302 Function placement 304 Using registers 304 Using global data 304 Passing Data Values in C Style 306 Revisiting the stack 306 Passing function parameters on the stack 306 Function prologue and epilogue 308 Defining local function data 309 Cleaning out the stack 312 An example 312 Watching the stack in action 314 Using Separate Function Files 317 Creating a separate function file 317 Creating the executable file 318 Debugging separate function files 319 Using Command-Line Parameters 320 The anatomy of a program 320 Analyzing the stack 321 Viewing command-line parameters 323 Viewing environment variables 325 An example using command-line parameters 326 Summary 328 Chapter 12: Using Linux System Calls 329 The Linux Kernel 329 Parts of the kernel 330 Linux kernel version 336 System Calls 337 Finding system calls 337 Finding system call definitions 338 Common system calls 339 Using System Calls 341 The system call format 341 Advanced System Call Return Values 346 The sysinfo system call 346 Using the return structure 347 Viewing the results 348 Tracing System Calls 349 The strace program 349 Advanced strace parameters 350 Watching program system calls 351 Attaching to a running program 353 System Calls versus C Libraries 355 The C libraries 356 Tracing C functions 357 Comparing system calls and C libraries 358 Summary 359 Chapter 13: Using Inline Assembly 361 What Is Inline Assembly? 361 Basic Inline Assembly Code 365 The asm format 365 Using global C variables 367 Using the volatile modifier 369 Using an alternate keyword 369 Extended ASM 370 Extended ASM format 370 Specifying input and output values 370 Using registers 372 Using placeholders 373 Referencing placeholders 376 Alternative placeholders 377 Changed registers list 377 Using memory locations 379 Using floating-point values 380 Handling jumps 382 Using Inline Assembly Code 384 What are macros? 384 C macro functions 384 Creating inline assembly macro functions 386 Summary 387 Chapter 14: Calling Assembly Libraries 389 Creating Assembly Functions 389 Compiling the C and Assembly Programs 391 Compiling assembly source code files 392 Using assembly object code files 392 The executable file 393 Using Assembly Functions in C Programs 395 Using integer return values 396 Using string return values 397 Using floating-point return values 400 Using multiple input values 401 Using mixed data type input values 403 Using Assembly Functions in C++ Programs 407 Creating Static Libraries 408 What is a static library? 408 The ar command 409 Creating a static library file 410 Compiling with static libraries 412 Using Shared Libraries 412 What are shared libraries? 412 Creating a shared library 414 Compiling with a shared library 414 Running programs that use shared libraries 415 Debugging Assembly Functions 417 Debugging C programs 417 Debugging assembly functions 418 Summary 420 Chapter 15: Optimizing Routines 421 Optimized Compiler Code 421 Compiler optimization level 1 422 Compiler optimization level 2 423 Compiler optimization level 3 425 Creating Optimized Code 425 Generating the assembly language code 425 Viewing optimized code 429 Recompiling the optimized code 429 Optimization Tricks 430 Optimizing calculations 430 Optimizing variables 433 Optimizing loops 437 Optimizing conditional branches 442 Common subexpression elimination 447 Summary 450 Chapter 16: Using Files 453 The File-Handling Sequence 453 Opening and Closing Files 454 Access types 455 UNIX permissions 456 Open file code 458 Open error return codes 459 Closing files 460 Writing to Files 460 A simple write example 460 Changing file access modes 462 Handling file errors 462 Reading Files 463 A simple read example 464 A more complicated read example 465 Reading, Processing, and Writing Data 467 Memory-Mapped Files 470 What are memory-mapped files? 470 The mmap system call 471 mmap assembly language format 473 An mmap example 475 Summary 479 Chapter 17: Using Advanced IA-32 Features 481 A Brief Review of SIMD 481 MMX 482 SSE 483 SSE2 483 Detecting Supported SIMD Operations 483 Detecting support 484 SIMD feature program 485 Using MMX Instructions 487 Loading and retrieving packed integer values 487 Performing MMX operations 488 Using SSE Instructions 497 Moving data 498 Processing data 499 Using SSE2 Instructions 504 Moving data 505 Processing data 505 SSE3 Instructions 508 Summary 508 Index 511
Preface Part I. The Basics 1. What Is C++? A Brief History of C++ C++ Organization How to Learn C++ 2. The Basics of Program Writing Programs from Conception to Execution Creating a Real Program Getting Help in Unix Getting Help in an IDE Programming Exercises 3. Style Comments C++ Code Naming Style Coding Religion Indentation and Code Format Clarity Simplicity Consistency and Organization Further Reading Summary 4. Basic Declarations and Expressions Basic Program Structure Simple Expressions The std::cout Output Object Variables and Storage Variable Declarations Assignment Statements Floating-Point Numbers Floating-Point Divide Versus Integer Divide Characters Wide Characters Boolean Type Programming Exercises Answers to Chapter Questions 5. Arrays, Qualifiers, and Reading Numbers Arrays Strings Reading Data Initializing Variables Multidimensional Arrays C-Style Strings Types of Integers Types of Floats Constant and Reference Declarations Qualifiers Hexadecimal and Octal Constants Operators for Performing Shortcuts Side Effects Programming Exercises Answers to Chapter Questions 6. Decision and Control Statements if Statement else Statement How Not to Use std::strcmp Looping Statements while Statement break Statement continue Statement The Assignment Anywhere Side Effect Programming Exercises Answers to Chapter Questions 7. The Programming Process Setting Up Your Work Area The Specification Code Design The Prototype The Makefile Testing Debugging Maintenance Revisions Electronic Archaeology Mark Up the Program Use the Debugger Use the Text Editor as a Browser Add Comments Programming Exercises Part II. Simple Programming 8. More Control Statements for Statement switch Statement switch, break, and continue Programming Exercises Answers to Chapter Questions 9. Variable Scope and Functions Scope and Storage Class Namespaces Functions Summary of Parameter Types Recursion Structured Programming Basics Real-World Programming Programming Exercises Answers to Chapter Questions 10. The C++ Preprocessor define Statement Conditional Compilation include Files Parameterized Macros Advanced Features Summary Programming Exercises Answers to Chapter Questions 11. Bit Operations Bit Operators The AND Operator (&) Bitwise OR (|) The Bitwise Exclusive OR (^) The Ones Complement Operator (NOT) (~) The Left and Right Shift Operators (>) Setting, Clearing, and Testing Bits Bitmapped Graphics Programming Exercises Answers to Chapter Questions Part III. Advanced Types and Classes 12. Advanced Types Structures Unions typedef enum Type Bit Members or Packed Structures Arrays of Structures Programming Exercises Answers to Chapter Questions 13. Simple Classes Stacks Improved Stack Using a Class Introduction to Constructors and Destructors Automatically Generated Member Functions Shortcuts Style Structures Versus Classes Programming Exercises 14. More on Classes Friends Constant Functions Constant Members Static Member Variables Static Member Functions The Meaning of static Programming Exercises 15. Simple Pointers const Pointers Pointers and Printing Pointers and Arrays The reinterpret_cast Pointers and Structures Command-Line Arguments Programming Exercises Answers to Chapter Questions Part IV. Advanced Programming Concepts 16. File Input/Output C++ File I/O Conversion Routines Binary and ASCII Files The End-of-Line Puzzle Binary I/O Buffering Problems Unbuffered I/O Designing File Formats C-Style I/O Routines C-Style Conversion Routines C-Style Binary I/O C- Versus C++- Style I/O Programming Exercises Answers to Chapter Questions 17. Debugging and Optimization Code Reviews Serial Debugging Going Through the Output Interactive Debuggers Debugging a Binary Search Interactive Debugging Tips and Tricks Runtime Errors Optimization How to Optimize Case Study: Inline Functions Versus Normal Functions Case Study: Optimizing a Color-Rendering Algorithm Programming Exercises Answers to Chapter Questions 18. Operator Overloading Creating a Simple Fixed-Point Class Operator Functions Operator Member Functions Warts Full Definition of the Fixed-Point Class Programming Exercises Answers to Chapter Questions 19. Floating Point Floating-Point Format Floating Addition/Subtraction Multiplication and Division Overflow and Underflow Roundoff Error Accuracy Minimizing Roundoff Error Determining Accuracy Precision and Speed Power Series Programming Exercises 20. Advanced Pointers Pointers, Structures, and Classes delete Operator Linked Lists Ordered Linked Lists Doubly Linked Lists Trees Printing a Tree The Rest of the Program Data Structures for a Chess Program Programming Exercises Answers to Chapter Questions 21. Advanced Classes Derived Classes Virtual Functions Virtual Classes Function Hiding in Derived Classes Constructors and Destructors in Derived Classes The dynamic_cast Operator Summary Programming Exercises Answers to Chapter Questions Part V. Other Language Features 22. Exceptions Adding Exceptions to the Stack Class Exceptions Versus assert Programming Exercises 23. Modular Programming Modules Public and Private The extern Storage Class Headers The Body of the Module A Program to Use Infinite Arrays The Makefile for Multiple Files Using the Infinite Array Dividing a Task into Modules Module Design Guidelines Programming Exercises 24. Templates What Is a Template? Templates: The Hard Way Templates: The C++ Way Function Specialization Class Templates Class Specialization Implementation Details Advanced Features Summary Programming Exercises 25. Standard Template Library STL Basics Class List-A Set of Students Creating a Waiting List with the STL List Storing Grades in a STL Map Putting It All Together Practical Considerations When Using the STL Getting More Information Exercises 26. Program Design Design Goals Design Factors Design Principles Coding Objects Real-World Design echniques Conclusion 27. Putting It All Together Requirements Code Design Coding Functional Description Testing Revisions A Final Warning Program Files Programming Exercises 28. From C to C++ K&R-Style Functions struct malloc and free Turning Structures into Classes setjmp and longjmp Mixing C and C++ Code Summary Programming Exercise 29. C++’s Dustier Corners do/while goto The ? : Construct The Comma Operator Overloading the ( ) Operator Pointers to Members The asm Statement The mutable Qualifier Run Time Type Identification Trigraphs Answers to Chapter Questions 30. Programming Adages General Design Declarations switch Statement Preprocessor Style Compiling The Ten Commandments for C++ Programmers Final Note Answers to Chapter Questions Part VI. Appendixes A. ASCII Table B. Ranges C. Operator Precedence Rules D. Computing Sine Using a Power Series E. Resources Index
Preface xxi 1 Number Systems 1 1.1 Analogue Versus Digital 1 1.2 Introduction to Number Systems 2 1.3 Decimal Number System 2 1.4 Binary Number System 3 1.4.1 Advantages 3 1.5 Octal Number System 4 1.6 Hexadecimal Number System 4 1.7 Number Systems – Some Common Terms 4 1.7.1 Binary Number System 4 1.7.2 Decimal Number System 5 1.7.3 Octal Number System 5 1.7.4 Hexadecimal Number System 5 1.8 Number Representation in Binary 5 1.8.1 Sign-Bit Magnitude 5 1.8.2 1’s Complement 6 1.8.3 2’s Complement 6 1.9 Finding the Decimal Equivalent 6 1.9.1 Binary-to-Decimal Conversion 6 1.9.2 Octal-to-Decimal Conversion 6 1.9.3 Hexadecimal-to-Decimal Conversion 7 1.10 Decimal-to-Binary Conversion 7 1.11 Decimal-to-Octal Conversion 8 1.12 Decimal-to-Hexadecimal Conversion 9 1.13 Binary–Octal and Octal–Binary Conversions 9 1.14 Hex–Binary and Binary–Hex Conversions 10 1.15 Hex–Octal and Octal–Hex Conversions 10 1.16 The Four Axioms 11 1.17 Floating-Point Numbers 12 1.17.1 Range of Numbers and Precision 13 1.17.2 Floating-Point Number Formats 13 viii Contents Review Questions 17 Problems 17 Further Reading 18 2 Binary Codes 19 2.1 Binary Coded Decimal 19 2.1.1 BCD-to-Binary Conversion 20 2.1.2 Binary-to-BCD Conversion 20 2.1.3 Higher-Density BCD Encoding 21 2.1.4 Packed and Unpacked BCD Numbers 21 2.2 Excess-3 Code 21 2.3 Gray Code 23 2.3.1 Binary–Gray Code Conversion 24 2.3.2 Gray Code–Binary Conversion 25 2.3.3 n-ary Gray Code 25 2.3.4 Applications 25 2.4 Alphanumeric Codes 27 2.4.1 ASCII code 28 2.4.2 EBCDIC code 31 2.4.3 Unicode 37 2.5 Seven-segment Display Code 38 2.6 Error Detection and Correction Codes 40 2.6.1 Parity Code 41 2.6.2 Repetition Code 41 2.6.3 Cyclic Redundancy Check Code 41 2.6.4 Hamming Code 42 Review Questions 44 Problems 45 Further Reading 45 3 Digital Arithmetic 47 3.1 Basic Rules of Binary Addition and Subtraction 47 3.2 Addition of Larger-Bit Binary Numbers 49 3.2.1 Addition Using the 2’s Complement Method 49 3.3 Subtraction of Larger-Bit Binary Numbers 52 3.3.1 Subtraction Using 2’s Complement Arithmetic 53 3.4 BCD Addition and Subtraction in Excess-3 Code 57 3.4.1 Addition 57 3.4.2 Subtraction 57 3.5 Binary Multiplication 58 3.5.1 Repeated Left-Shift and Add Algorithm 59 3.5.2 Repeated Add and Right-Shift Algorithm 59 3.6 Binary Division 60 3.6.1 Repeated Right-Shift and Subtract Algorithm 61 3.6.2 Repeated Subtract and Left-Shift Algorithm 62 3.7 Floating-Point Arithmetic 64 3.7.1 Addition and Subtraction 65 3.7.2 Multiplication and Division 65 Contents ix Review Questions 67 Problems 68 Further Reading 68 4 Logic Gates and Related Devices 69 4.1 Positive and Negative Logic 69 4.2 Truth Table 70 4.3 Logic Gates 71 4.3.1 OR Gate 71 4.3.2 AND Gate 73 4.3.3 NOT Gate 75 4.3.4 EXCLUSIVE-OR Gate 76 4.3.5 NAND Gate 79 4.3.6 NOR Gate 79 4.3.7 EXCLUSIVE-NOR Gate 80 4.3.8 INHIBIT Gate 82 4.4 Universal Gates 85 4.5 Gates with Open Collector/Drain Outputs 85 4.6 Tristate Logic Gates 87 4.7 AND-OR-INVERT Gates 87 4.8 Schmitt Gates 88 4.9 Special Output Gates 91 4.10 Fan-Out of Logic Gates 95 4.11 Buffers and Transceivers 98 4.12 IEEE/ANSI Standard Symbols 100 4.12.1 IEEE/ANSI Standards – Salient Features 100 4.12.2 ANSI Symbols for Logic Gate ICs 101 4.13 Some Common Applications of Logic Gates 102 4.13.1 OR Gate 103 4.13.2 AND Gate 104 4.13.3 EX-OR/EX-NOR Gate 104 4.13.4 Inverter 105 4.14 Application-Relevant Information 107 Review Questions 109 Problems 110 Further Reading 114 5 Logic Families 115 5.1 Logic Families – Significance and Types 115 5.1.1 Significance 115 5.1.2 Types of Logic Family 116 5.2 Characteristic Parameters 118 5.3 Transistor Transistor Logic (TTL) 124 5.3.1 Standard TTL 125 5.3.2 Other Logic Gates in Standard TTL 127 5.3.3 Low-Power TTL 133 5.3.4 High-Power TTL (74H/54H) 134 5.3.5 Schottky TTL (74S/54S) 135 x Contents 5.3.6 Low-Power Schottky TTL (74LS/54LS) 136 5.3.7 Advanced Low-Power Schottky TTL (74ALS/54ALS) 137 5.3.8 Advanced Schottky TTL (74AS/54AS) 139 5.3.9 Fairchild Advanced Schottky TTL (74F/54F) 140 5.3.10 Floating and Unused Inputs 141 5.3.11 Current Transients and Power Supply Decoupling 142 5.4 Emitter Coupled Logic (ECL) 147 5.4.1 Different Subfamilies 147 5.4.2 Logic Gate Implementation in ECL 148 5.4.3 Salient Features of ECL 150 5.5 CMOS Logic Family 151 5.5.1 Circuit Implementation of Logic Functions 151 5.5.2 CMOS Subfamilies 165 5.6 BiCMOS Logic 170 5.6.1 BiCMOS Inverter 171 5.6.2 BiCMOS NAND 171 5.7 NMOS and PMOS Logic 172 5.7.1 PMOS Logic 173 5.7.2 NMOS Logic 174 5.8 Integrated Injection Logic (I2L) Family 174 5.9 Comparison of Different Logic Families 176 5.10 Guidelines to Using TTL Devices 176 5.11 Guidelines to Handling and Using CMOS Devices 179 5.12 Interfacing with Different Logic Families 179 5.12.1 CMOS-to-TTL Interface 179 5.12.2 TTL-to-CMOS Interface 180 5.12.3 TTL-to-ECL and ECL-to-TTL Interfaces 180 5.12.4 CMOS-to-ECL and ECL-to-CMOS Interfaces 183 5.13 Classification of Digital ICs 183 5.14 Application-Relevant Information 184 Review Questions 185 Problems 185 Further Reading 187 6 Boolean Algebra and Simplification Techniques 189 6.1 Introduction to Boolean Algebra 189 6.1.1 Variables, Literals and Terms in Boolean Expressions 190 6.1.2 Equivalent and Complement of Boolean Expressions 190 6.1.3 Dual of a Boolean Expression 191 6.2 Postulates of Boolean Algebra 192 6.3 Theorems of Boolean Algebra 192 6.3.1 Theorem 1 (Operations with ‘0’ and ‘1’) 192 6.3.2 Theorem 2 (Operations with ‘0’ and ‘1’) 193 6.3.3 Theorem 3 (Idempotent or Identity Laws) 193 6.3.4 Theorem 4 (Complementation Law) 193 6.3.5 Theorem 5 (Commutative Laws) 194 6.3.6 Theorem 6 (Associative Laws) 194 6.3.7 Theorem 7 (Distributive Laws) 195 Contents xi 6.3.8 Theorem 8 196 6.3.9 Theorem 9 197 6.3.10 Theorem 10 (Absorption Law or Redundancy Law) 197 6.3.11 Theorem 11 197 6.3.12 Theorem 12 (Consensus Theorem) 198 6.3.13 Theorem 13 (DeMorgan’s Theorem) 199 6.3.14 Theorem 14 (Transposition Theorem) 200 6.3.15 Theorem 15 201 6.3.16 Theorem 16 201 6.3.17 Theorem 17 (Involution Law) 202 6.4 Simplification Techniques 204 6.4.1 Sum-of-Products Boolean Expressions 204 6.4.2 Product-of-Sums Expressions 205 6.4.3 Expanded Forms of Boolean Expressions 206 6.4.4 Canonical Form of Boolean Expressions 206 6.4.5  and  Nomenclature 207 6.5 Quine–McCluskey Tabular Method 208 6.5.1 Tabular Method for Multi-Output Functions 212 6.6 Karnaugh Map Method 216 6.6.1 Construction of a Karnaugh Map 216 6.6.2 Karnaugh Map for Boolean Expressions with a Larger Number of Variables 222 6.6.3 Karnaugh Maps for Multi-Output Functions 225 Review Questions 230 Problems 230 Further Reading 231 7 Arithmetic Circuits 233 7.1 Combinational Circuits 233 7.2 Implementing Combinational Logic 235 7.3 Arithmetic Circuits – Basic Building Blocks 236 7.3.1 Half-Adder 236 7.3.2 Full Adder 237 7.3.3 Half-Subtractor 240 7.3.4 Full Subtractor 242 7.3.5 Controlled Inverter 244 7.4 Adder–Subtractor 245 7.5 BCD Adder 246 7.6 Carry Propagation–Look-Ahead Carry Generator 254 7.7 Arithmetic Logic Unit (ALU) 260 7.8 Multipliers 260 7.9 Magnitude Comparator 261 7.9.1 Cascading Magnitude Comparators 263 7.10 Application-Relevant Information 266 Review Questions 266 Problems 267 Further Reading 268 xii Contents 8 Multiplexers and Demultiplexers 269 8.1 Multiplexer 269 8.1.1 Inside the Multiplexer 271 8.1.2 Implementing Boolean Functions with Multiplexers 273 8.1.3 Multiplexers for Parallel-to-Serial Data Conversion 277 8.1.4 Cascading Multiplexer Circuits 280 8.2 Encoders 280 8.2.1 Priority Encoder 281 8.3 Demultiplexers and Decoders 285 8.3.1 Implementing Boolean Functions with Decoders 286 8.3.2 Cascading Decoder Circuits 288 8.4 Application-Relevant Information 293 Review Questions 294 Problems 295 Further Reading 298 9 Programmable Logic Devices 299 9.1 Fixed Logic Versus Programmable Logic 299 9.1.1 Advantages and Disadvantages 301 9.2 Programmable Logic Devices – An Overview 302 9.2.1 Programmable ROMs 302 9.2.2 Programmable Logic Array 302 9.2.3 Programmable Array Logic 304 9.2.4 Generic Array Logic 305 9.2.5 Complex Programmable Logic Device 306 9.2.6 Field-Programmable Gate Array 307 9.3 Programmable ROMs 308 9.4 Programmable Logic Array 312 9.5 Programmable Array Logic 317 9.5.1 PAL Architecture 319 9.5.2 PAL Numbering System 320 9.6 Generic Array Logic 325 9.7 Complex Programmable Logic Devices 328 9.7.1 Internal Architecture 328 9.7.2 Applications 330 9.8 Field-Programmable Gate Arrays 331 9.8.1 Internal Architecture 331 9.8.2 Applications 333 9.9 Programmable Interconnect Technologies 333 9.9.1 Fuse 334 9.9.2 Floating-Gate Transistor Switch 334 9.9.3 Static RAM-Controlled Programmable Switches 335 9.9.4 Antifuse 335 9.10 Design and Development of Programmable Logic Hardware 337 9.11 Programming Languages 338 9.11.1 ABEL-Hardware Description Language 339 9.11.2 VHDL-VHSIC Hardware Description Language 339 Contents xiii 9.11.3 Verilog 339 9.11.4 Java HDL 340 9.12 Application Information on PLDs 340 9.12.1 SPLDs 340 9.12.2 CPLDs 343 9.12.3 FPGAs 349 Review Questions 352 Problems 353 Further Reading 355 10 Flip-Flops and Related Devices 357 10.1 Multivibrator 357 10.1.1 Bistable Multivibrator 357 10.1.2 Schmitt Trigger 358 10.1.3 Monostable Multivibrator 360 10.1.4 Astable Multivibrator 362 10.2 Integrated Circuit (IC) Multivibrators 363 10.2.1 Digital IC-Based Monostable Multivibrator 363 10.2.2 IC Timer-Based Multivibrators 363 10.3 R-S Flip-Flop 373 10.3.1 R-S Flip-Flop with Active LOW Inputs 374 10.3.2 R-S Flip-Flop with Active HIGH Inputs 375 10.3.3 Clocked R-S Flip-Flop 377 10.4 Level-Triggered and Edge-Triggered Flip-Flops 381 10.5 J-K Flip-Flop 382 10.5.1 J-K Flip-Flop with PRESET and CLEAR Inputs 382 10.5.2 Master–Slave Flip-Flops 382 10.6 Toggle Flip-Flop (T Flip-Flop) 390 10.6.1 J-K Flip-Flop as a Toggle Flip-Flop 391 10.7 D Flip-Flop 394 10.7.1 J-K Flip-Flop as D Flip-Flop 395 10.7.2 D Latch 395 10.8 Synchronous and Asynchronous Inputs 398 10.9 Flip-Flop Timing Parameters 399 10.9.1 Set-Up and Hold Times 399 10.9.2 Propagation Delay 399 10.9.3 Clock Pulse HIGH and LOW Times 401 10.9.4 Asynchronous Input Active Pulse Width 401 10.9.5 Clock Transition Times 402 10.9.6 Maximum Clock Frequency 402 10.10 Flip-Flop Applications 402 10.10.1 Switch Debouncing 402 10.10.2 Flip-Flop Synchronization 404 10.10.3 Detecting the Sequence of Edges 404 10.11 Application-Relevant Data 407 Review Questions 408 Problems 409 Further Reading 410 xiv Contents 11 Counters and Registers 411 11.1 Ripple (Asynchronous) Counter 411 11.1.1 Propagation Delay in Ripple Counters 412 11.2 Synchronous Counter 413 11.3 Modulus of a Counter 413 11.4 Binary Ripple Counter – Operational Basics 413 11.4.1 Binary Ripple Counters with a Modulus of Less than 2N 416 11.4.2 Ripple Counters in IC Form 418 11.5 Synchronous (or Parallel) Counters 423 11.6 UP/DOWN Counters 425 11.7 Decade and BCD Counters 426 11.8 Presettable Counters 426 11.8.1 Variable Modulus with Presettable Counters 428 11.9 Decoding a Counter 428 11.10 Cascading Counters 433 11.10.1 Cascading Binary Counters 433 11.10.2 Cascading BCD Counters 435 11.11 Designing Counters with Arbitrary Sequences 438 11.11.1 Excitation Table of a Flip-Flop 438 11.11.2 State Transition Diagram 439 11.11.3 Design Procedure 439 11.12 Shift Register 447 11.12.1 Serial-In Serial-Out Shift Register 449 11.12.2 Serial-In Parallel-Out Shift Register 452 11.12.3 Parallel-In Serial-Out Shift Register 452 11.12.4 Parallel-In Parallel-Out Shift Register 453 11.12.5 Bidirectional Shift Register 455 11.12.6 Universal Shift Register 455 11.13 Shift Register Counters 459 11.13.1 Ring Counter 459 11.13.2 Shift Counter 460 11.14 IEEE/ANSI Symbology for Registers and Counters 464 11.14.1 Counters 464 11.14.2 Registers 466 11.15 Application-Relevant Information 466 Review Questions 466 Problems 469 Further Reading 471 12 Data Conversion Circuits – D/A and A/D Converters 473 12.1 Digital-to-Analogue Converters 473 12.1.1 Simple Resistive Divider Network for D/A Conversion 474 12.1.2 Binary Ladder Network for D/A Conversion 475 12.2 D/A Converter Specifications 476 12.2.1 Resolution 476 12.2.2 Accuracy 477 12.2.3 Conversion Speed or Settling Time 477 12.2.4 Dynamic Range 478 Contents xv 12.2.5 Nonlinearity and Differential Nonlinearity 478 12.2.6 Monotonocity 478 12.3 Types of D/A Converter 479 12.3.1 Multiplying D/A Converters 479 12.3.2 Bipolar-Output D/A Converters 480 12.3.3 Companding D/A Converters 480 12.4 Modes of Operation 480 12.4.1 Current Steering Mode of Operation 480 12.4.2 Voltage Switching Mode of Operation 481 12.5 BCD-Input D/A Converter 482 12.6 Integrated Circuit D/A Converters 486 12.6.1 DAC-08 486 12.6.2 DAC-0808 487 12.6.3 DAC-80 487 12.6.4 AD 7524 489 12.6.5 DAC-1408/DAC-1508 489 12.7 D/A Converter Applications 490 12.7.1 D/A Converter as a Multiplier 490 12.7.2 D/A converter as a Divider 490 12.7.3 Programmable Integrator 491 12.7.4 Low-Frequency Function Generator 492 12.7.5 Digitally Controlled Filters 493 12.8 A/D Converters 495 12.9 A/D Converter Specifications 495 12.9.1 Resolution 495 12.9.2 Accuracy 496 12.9.3 Gain and Offset Errors 496 12.9.4 Gain and Offset Drifts 496 12.9.5 Sampling Frequency and Aliasing Phenomenon 496 12.9.6 Quantization Error 496 12.9.7 Nonlinearity 497 12.9.8 Differential Nonlinearity 497 12.9.9 Conversion Time 498 12.9.10 Aperture and Acquisition Times 498 12.9.11 Code Width 499 12.10 A/D Converter Terminology 499 12.10.1 Unipolar Mode Operation 499 12.10.2 Bipolar Mode Operation 499 12.10.3 Coding 499 12.10.4 Low Byte and High Byte 499 12.10.5 Right-Justified Data, Left-Justified Data 499 12.10.6 Command Register, Status Register 500 12.10.7 Control Lines 500 12.11 Types of A/D Converter 500 12.11.1 Simultaneous or Flash A/D Converters 500 12.11.2 Half-Flash A/D Converter 503 12.11.3 Counter-Type A/D Converter 504 12.11.4 Tracking-Type A/D Converter 505 xvi Contents 12.11.5 Successive Approximation Type A/D Converter 505 12.11.6 Single-, Dual- and Multislope A/D Converters 506 12.11.7 Sigma-Delta A/D Converter 509 12.12 Integrated Circuit A/D Converters 513 12.12.1 ADC-0800 513 12.12.2 ADC-0808 514 12.12.3 ADC-80/AD ADC-80 515 12.12.4 ADC-84/ADC-85/AD ADC-84/AD ADC-85/AD-5240 516 12.12.5 AD 7820 516 12.12.6 ICL 7106/ICL 7107 517 12.13 A/D Converter Applications 520 12.13.1 Data Acquisition 521 Review Questions 522 Problems 523 Further Reading 523 13 Microprocessors 525 13.1 Introduction to Microprocessors 525 13.2 Evolution of Microprocessors 527 13.3 Inside a Microprocessor 528 13.3.1 Arithmetic Logic Unit (ALU) 529 13.3.2 Register File 529 13.3.3 Control Unit 531 13.4 Basic Microprocessor Instructions 531 13.4.1 Data Transfer Instructions 531 13.4.2 Arithmetic Instructions 532 13.4.3 Logic Instructions 533 13.4.4 Control Transfer or Branch or Program Control Instructions 533 13.4.5 Machine Control Instructions 534 13.5 Addressing Modes 534 13.5.1 Absolute or Memory Direct Addressing Mode 534 13.5.2 Immediate Addressing Mode 535 13.5.3 Register Direct Addressing Mode 535 13.5.4 Register Indirect Addressing Mode 535 13.5.5 Indexed Addressing Mode 536 13.5.6 Implicit Addressing Mode and Relative Addressing Mode 537 13.6 Microprocessor Selection 537 13.6.1 Selection Criteria 537 13.6.2 Microprocessor Selection Table for Common Applications 539 13.7 Programming Microprocessors 540 13.8 RISC Versus CISC Processors 541 13.9 Eight-Bit Microprocessors 541 13.9.1 8085 Microprocessor 541 13.9.2 Motorola 6800 Microprocessor 544 13.9.3 Zilog Z80 Microprocessor 546 13.10 16-Bit Microprocessors 547 13.10.1 8086 Microprocessor 547 13.10.2 80186 Microprocessor 548 Contents xvii 13.10.3 80286 Microprocessor 548 13.10.4 MC68000 Microprocessor 549 13.11 32-Bit Microprocessors 551 13.11.1 80386 Microprocessor 551 13.11.2 MC68020 Microprocessor 553 13.11.3 MC68030 Microprocessor 554 13.11.4 80486 Microprocessor 555 13.11.5 PowerPC RISC Microprocessors 557 13.12 Pentium Series of Microprocessors 557 13.12.1 Salient Features 558 13.12.2 Pentium Pro Microprocessor 559 13.12.3 Pentium II Series 559 13.12.4 Pentium III and Pentium IV Microprocessors 559 13.12.5 Pentium M, D and Extreme Edition Processors 559 13.12.6 Celeron and Xeon Processors 560 13.13 Microprocessors for Embedded Applications 560 13.14 Peripheral Devices 560 13.14.1 Programmable Timer/Counter 561 13.14.2 Programmable Peripheral Interface 561 13.14.3 Programmable Interrupt Controller 561 13.14.4 DMA Controller 561 13.14.5 Programmable Communication Interface 562 13.14.6 Math Coprocessor 562 13.14.7 Programmable Keyboard/Display Interface 562 13.14.8 Programmable CRT Controller 562 13.14.9 Floppy Disk Controller 563 13.14.10 Clock Generator 563 13.14.11 Octal Bus Transceiver 563 Review Questions 563 Further Reading 564 14 Microcontrollers 565 14.1 Introduction to the Microcontroller 565 14.1.1 Applications 567 14.2 Inside the Microcontroller 567 14.2.1 Central Processing Unit (CPU) 568 14.2.2 Random Access Memory (RAM) 569 14.2.3 Read Only Memory (ROM) 569 14.2.4 Special-Function Registers 569 14.2.5 Peripheral Components 569 14.3 Microcontroller Architecture 574 14.3.1 Architecture to Access Memory 574 14.3.2 Mapping Special-Function Registers into Memory Space 576 14.3.3 Processor Architecture 577 14.4 Power-Saving Modes 579 14.5 Application-Relevant Information 580 14.5.1 Eight-Bit Microcontrollers 580 14.5.2 16-Bit Microcontrollers 588 xviii Contents 14.5.3 32-Bit Microcontrollers 590 14.6 Interfacing Peripheral Devices with a Microcontroller 592 14.6.1 Interfacing LEDs 592 14.6.2 Interfacing Electromechanical Relays 593 14.6.3 Interfacing Keyboards 594 14.6.4 Interfacing Seven-Segment Displays 596 14.6.5 Interfacing LCD Displays 598 14.6.6 Interfacing A/D Converters 600 14.6.7 Interfacing D/A Converters 600 Review Questions 602 Problems 602 Further Reading 603 15 Computer Fundamentals 605 15.1 Anatomy of a Computer 605 15.1.1 Central Processing Unit 605 15.1.2 Memory 606 15.1.3 Input/Output Ports 607 15.2 A Computer System 607 15.3 Types of Computer System 607 15.3.1 Classification of Computers on the Basis of Applications 607 15.3.2 Classification of Computers on the Basis of the Technology Used 608 15.3.3 Classification of Computers on the Basis of Size and Capacity 609 15.4 Computer Memory 610 15.4.1 Primary Memory 611 15.5 Random Access Memory 612 15.5.1 Static RAM 612 15.5.2 Dynamic RAM 619 15.5.3 RAM Applications 622 15.6 Read Only Memory 622 15.6.1 ROM Architecture 623 15.6.2 Types of ROM 624 15.6.3 Applications of ROMs 629 15.7 Expanding Memory Capacity 632 15.7.1 Word Size Expansion 632 15.7.2 Memory Location Expansion 634 15.8 Input and Output Ports 637 15.8.1 Serial Ports 638 15.8.2 Parallel Ports 640 15.8.3 Internal Buses 642 15.9 Input/Output Devices 642 15.9.1 Input Devices 643 15.9.2 Output Devices 643 15.10 Secondary Storage or Auxiliary Storage 645 15.10.1 Magnetic Storage Devices 645 15.10.2 Magneto-Optical Storage Devices 648 15.10.3 Optical Storage Devices 648 15.10.4 USB Flash Drive 650 Contents xix Review Questions 650 Problems 650 Further Reading 651 16 Troubleshooting Digital Circuits and Test Equipment 653 16.1 General Troubleshooting Guidelines 653 16.1.1 Faults Internal to Digital Integrated Circuits 654 16.1.2 Faults External to Digital Integrated Circuits 655 16.2 Troubleshooting Sequential Logic Circuits 659 16.3 Troubleshooting Arithmetic Circuits 663 16.4 Troubleshooting Memory Devices 664 16.4.1 Troubleshooting RAM Devices 664 16.4.2 Troubleshooting ROM Devices 664 16.5 Test and Measuring Equipment 665 16.6 Digital Multimeter 665 16.6.1 Advantages of Using a Digital Multimeter 666 16.6.2 Inside the Digital Meter 666 16.6.3 Significance of the Half-Digit 666 16.7 Oscilloscope 668 16.7.1 Importance of Specifications and Front-Panel Controls 668 16.7.2 Types of Oscilloscope 669 16.8 Analogue Oscilloscopes 669 16.9 CRT Storage Type Analogue Oscilloscopes 669 16.10 Digital Oscilloscopes 669 16.11 Analogue Versus Digital Oscilloscopes 672 16.12 Oscilloscope Specifications 672 16.12.1 Analogue Oscilloscopes 673 16.12.2 Analogue Storage Oscilloscope 674 16.12.3 Digital Storage Oscilloscope 674 16.13 Oscilloscope Probes 677 16.13.1 Probe Compensation 677 16.14 Frequency Counter 678 16.14.1 Universal Counters – Functional Modes 679 16.14.2 Basic Counter Architecture 679 16.14.3 Reciprocal Counters 681 16.14.4 Continuous-Count Counters 682 16.14.5 Counter Specifications 682 16.14.6 Microwave Counters 683 16.15 Frequency Synthesizers and Synthesized Function/Signal Generators 684 16.15.1 Direct Frequency Synthesis 684 16.15.2 Indirect Synthesis 685 16.15.3 Sampled Sine Synthesis (Direct Digital Synthesis) 687 16.15.4 Important Specifications 689 16.15.5 Synthesized Function Generators 689 16.15.6 Arbitrary Waveform Generator 690 16.16 Logic Probe 691 16.17 Logic Analyser 692 16.17.1 Operational Modes 692 xx Contents 16.17.2 Logic Analyser Architecture 692 16.17.3 Key Specifications 695 16.18 Computer–Instrument Interface Standards 696 16.18.1 IEEE-488 Interface 696 16.19 Virtual Instrumentation 697 16.19.1 Use of Virtual Instruments 698 16.19.2 Components of a Virtual Instrument 700 Review Questions 703 Problems 704 Further Reading 705 Index 707

2,679

社区成员

发帖
与我相关
我的任务
社区描述
企业开发 ERP/CRM
社区管理员
  • ERP/CRM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧