Computer Architecture Part II-A: CPU Organization
The Central Processing Unit The operating hub and heart of every computer system Composed of Control Unit Datapath Each component inside the CPU has a specific role in executing a command Communicates with other components of the system
Control Unit (CU) Regulates all activities inside the machine Serves as “nerve center” that sends control signals to other units and senses their status Connected to all components in the CPU as well as main memory
How The CU Is Connected Registers ALU Control Unit Main Memory CPU
Inside the CPU: The Datapath Registers ALU
Registers Components used for data storage (can be read from or written to) High speed memory locations used to store important information during CPU operations Two types Special General-purpose
Special Registers Registers used for specific purposes Used heavily during execution of CPU instructions
General Purpose Registers CPU registers used as “scratch pad” during execution of machine-level instructions Number varies between processors
Arithmetic Logic Unit (ALU) Performs all mathematical and logical operations within the CPU Operands not in the CPU would have to be retrieved from main memory
CPU-Memory Coordination Bus - a group of wires that connect separate components Types of bus: Control bus (control signals) Address bus (address information) Data bus (instruction/data)
CPU-Memory Coordination The different busses facilitate communication between the CPU and main memory Actions of the two components are highly-synchronized to ensure efficient and timely execution of instructions
CPU Operations Instructions do not reside in the CPU, they have to be fetched from memory Each machine level instruction is broken down into a logical sequence of smaller steps
CPU Operations Instructions are carried out by performing one or more of the following functions in some pre-specified sequence Retrieving data from main memory Putting data to main memory Register data transfer ALU operation
How An Instruction is Processed Instruction is retrieved from memory Analyze what the instruction is and how to execute it Operands/parameters (if any) are fetched from main memory Instruction is executed Results are stored (CPU or MM) Prepare for next instruction
Instruction Processing Example Fetch instruction from memory Decode it (turns out to be an ADD) Get the two numbers to add from MM Perform the addition Where will it be stored? Prepare for next instruction
Processing Data in Clusters Information is organized into groups of fixed-size data that can be stored and retrieved in a single, basic operation Each group of n bits is referred to as a word of information Access to each word requires a distinct name (location/address) Can also refer to a characteristic of other components (i.e. size of bus)
Word Length Size of a word specified in bits known as word length Possible benefits of a large word length: Faster processing (more data and/or instructions can be fetched at a time) Greater numeric precision More powerful instructions (e.g. instructions can have more operands)
Machine Language Composed of Instruction Data (instruction parameters) Instructions and data are represented by a stream of 1s and 0s Cumbersome to deal with when preparing programs; programmers use hexadecimal numbers In some computers, both instruction and data are stored in a single memory location
Assembly: An Improvement on Machine Language Symbols, called mnemonics, are used to represent instructions Sample instruction Advantage: Easier recall of instructions Disadvantage: Need to convert mnemonics and hexadecimal numbers back to binary Instruction parameters add (105),(8) instruction There is a strong possibility that hexadecimal numbers in relation to binary numbers may have to be reviewed here.
How Programs Are Loaded Into Main Memory Programs are loaded as binary numbers Assumptions: An instruction is represented by a 2-digit hexadecimal number (e.g. add by 1A, mov by A0) World length of instruction parameters: 3 hex digits (12 bits) Instruction Instruction parameters 100 101 102 103 104 105 A01040F2 1A105008 A00F2200 01000000 00000009 … 100 1010 0000 0001 0000 0100 0000 1111 0010
Executing Multiple Programs Programs share processor time Time slicing Supported by modern CPUs