contents Preface xi 1 What Does the cPU Do 1 Computers Can Process Any Type of Information 11 The CPU Is the Core of Each Computer 14 The Five Components of a Modern Computer 16 ALUs The CPU’s Core 22 CPUs Process Operations and Make Decisions 25 What Is Information Anyway 30 The Difference Between Analog and Digital Information 31 2 Digital operations 35 The Computer’s World Is Binary 36 The Reciprocal States of 1 and 0 37 Decimal vs Binary Number Systems 38 Expressing Numbers in Binary 40 Fixed-Point and Floating-Point Fractions 42 Addition and Subtraction in Binary 44 What Are Logic Operations 48 Integrated Circuits Contain Logic Gates 48 The Three Basic Logic Gates AND OR and NOT 51 Truth Tables and Venn Diagrams 53 A Summary of the AND OR and NOT Gates 55 Other Basic Gates NAND NOR and XOR 57 A Summary of the NAND NOR and XOR Gates 58 De Morgan’s Laws 60 Circuits That Perform Arithmetic 62 The Addition Circuit 62 The Half Adder 64 The Full Adder and Ripple Carry Adder 66 The Carry Look-Ahead Adder 68 Circuits That Remember 70 Circuits with Memory Are a Necessity 70 Flip-Flop The Basics of Memory Circuits 74 The RS Flip-Flop 76 The D Flip-Flop and the Clock 78 The T Flip-Flop and Counters 81 Modern Circuit Design CAD and FPGA 85
3 cPU Architecture 87 All About Memory and the CPU 88 Memory Has Assigned Addresses 89 Data Passes Through the Bus 92 Bus Width and Bits 94 R W Signals and I O Signals 98 Instructions Are Made of Operands and Opcodes 101 Accumulators and Other Registers Are Used in Operations 103 CPU Instruction Processing 106 Classic CPU Architecture 106 The Instruction Cycle 107 The Instruction We Process Changes Depending on the Program Counter 112 All Kinds of Memory Devices 115 A Comparison Between HDD and Memory 116 RAM Space ROM Space and I O Space 119 What Are Interrupts 122 Interrupts Are Useful 122 The Stack and the Stack Pointer 126 Interrupt Priority 128 Memory Classifications 132 I O Ports and the GPU 132 Clock Frequency and Degrees of Accuracy 133 Clock Generators 134 Timer Interrupts 135 Reset Signals 136 CPU Performance Is Measured in FLOPS 137 4 operations 139 Types of Operations 140 There Are Many Types of Instructions 142 Instructions for Arithmetic and Logic Operations 144 What Are Bit Shifts 145 The Sign Bit Lets Us Express Negative Binary Numbers 147 Logical Shifts and Arithmetic Shifts 149 Circular Shifts Rotating Shifts 152 Data Transfer Operations 153 Input Output Instructions 154 Branch Instructions 155 Condition Evaluation and Status Flags 158 Putting Branches and Condition Evaluation Together 161 Operand Types 162 How Many Operands Do We Have 162 Operands Take Many Forms 165 Immediate Value Processing 166 Address References 167 viii contents
What Are Addressing Modes 168 Addressing Mode Overview 172 The Structure of Operations in the ALU 176 A Look Inside the ALU 176 Basic Circuit Architecture of the 74S181 178 Serial Transmission and Parallel Transmission 185 An Overview of Some Basic Registers 186 An Overview of Some Basic Status Flags 187 The SLEEP Instruction 188 5 Programs 189 Assembly and High-Level Languages 190 What Are Assembly Languages 192 The Characteristics of Assembly Languages and High-Level Languages 194 The Difference Between Programs and Source Code 199 Program Basics 200 What Can You Make Using Conditions and Jumps 200 What Should We Make the Computer Do 204 Where are Programs Stored 208 What Happens Before a Program Is Executed 208 6 Microcontrollers 211 What Are Microcontrollers 212 Microcontrollers Are in All Kinds of Products 213 The Function of a Microcontroller 214 Architecture of a Microcontroller 219 What Are DSPs 222 DSPs and Multiplier-Accumulate Operations 224 Microcontrollers in Industrial Machines 224 epilogue 227 Afterword 239 index 241 contents ix