Computer Science 101
This guide explores the architecture of the Arithmetic Logic Unit (ALU) and Control Unit as integral components in computer systems. The ALU performs arithmetic and logic operations using a bank of registers and control circuitry, while the Control Unit manages instruction fetching, decoding, and execution, utilizing registers like the Program Counter (PC) and Instruction Register (IR). We also cover the instruction set, machine language, and various instruction types, including data transfer, arithmetic, and branch instructions, to illustrate how these components work together in processing tasks.
Computer Science 101
E N D
Presentation Transcript
Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set
CPU Major Components Bus Memory Input Output Units Control Unit ALU
ALU ALU - Arithmetic Logic Unit • Consists of • Bank of registers • Operation Circuitry • ALU Control Circuitry • Connections Result L R R0 R1 R15
Multiplexor - Review • 2n input lines • 1 output line • n control lines • control lines “select” one of the inputs to be “passed” to the output
Zoom in on ALU R15 + - Mux Control
R + - Mux Control Simple Hypothetical Lab Machine • One Register • One Operand
Control Unit • Cycle • Fetch next instruction from memory • Decode instruction • Execute it by giving proper control signals to ALU and memory.
Control Unit Registers • The Program Counter(PC) is a register in the control unit which holds the address of the nextinstruction to execute. • The Instruction Register(IR) is a register in the control unit which holds the current instructionbeing executed.
Machine Language • Instruction Set - set of instructions (binary) that the specific type of machine can execute. • Instruction typically has • Opcode field - set of bits telling which instruction • Address fields - memory or register address where operands will be found.
Opcode Address 0110 001101010011 Instruction form for hypothetical machine • 4-bit opcode field - 16 instruction types • 12-bit address field- 4096 memory cells
Machine Language Groups • Data Transfer • Arithmetic • Compare • Branch
Data Transfer instructions • General machine • Memory cell ALU register • ALU register Memory cell • Memory cell Memory cell • ALU register ALU register
12-bit address Data Transfer instructions • Hypothetical machineOpcode Operation Meaning 0000 Load X Con(X)R 0001 Store X RCon(X) Content stored at address X
Arithmetic - ADD,SUB,AND,etc. • Hypothetical machineOpcode Operation Meaning 0010 Clear X 0Con(X) 0011 Add X R+Con(X)R 0100 Increment X Con(X)+1 Con(X) 0101 Subtract X R-Con(X) R 0110 Decrement X Con(X)-1 Con(X)
Compare instructions - Compare values and set an indicator. • Condition Code Register (CC): 3 bit register with bits GT, EQ, LT. • When two values are compared, the result of the comparison will be stored in the CC – was the result GT, EQ, or LT. • Later instructions can look at CC to see what happened with the last comparison.
Compare instructions - Compare values and set an indicator. • Hypothetical machineOpcode Operation Meaning 0111 Compare X If Con(X) > R CC: 100 else if Con(X)<R CC: 001 else CC: 010
Branch instructions - Alter flow of control based on CC. • Hypothetical machineOpcode Operation Meaning 1000 Jump X X PC 1001 JumpGT X If GT=1, X PC 1010 JumpEQ X If EQ=1, X PC 1011 JumpLT X If LT=1, X PC 1100 JumpNE X If EQ=0, X PC
Input/Output and Halt • Hypothetical machineOpcode Operation Meaning . 1101 In X Input valueCon(X) 1110 Out X Con(X)Output value 1111 Halt Stop execution