Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set.

Similar presentations


Presentation on theme: "Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set."— Presentation transcript:

1 Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set

2 Major Components Memory CPU Control Unit ALU Input Output Units Bus

3 ALU - Arithmetic Logic Unit Consists of Consists of Bank of registersBank of registers Operation CircuitryOperation Circuitry ALU Control CircuitryALU Control Circuitry ConnectionsConnections R0 R1 R15 ALU LR Result

4 Multiplexor - Review 2 n input lines 2 n input lines 1 output line 1 output line n control lines n control lines control lines “select” one of the inputs to be “passed” to the output control lines “select” one of the inputs to be “passed” to the output

5 Zoom in on ALU R15 +- Mux Control

6 Simple Hypothetical Lab Machine R + - Control Mux One Register One Register One Operand One Operand

7 Control Unit Cycle Cycle Fetch next instruction from memoryFetch next instruction from memory Decode instructionDecode instruction Execute it by giving proper control signals to ALU and memory.Execute it by giving proper control signals to ALU and memory.

8 Control Unit Registers The Program Counter (PC) is a register in the control unit which holds the address of the next instruction to execute. The Program Counter (PC) is a register in the control unit which holds the address of the next instruction to execute. The Instruction Register (IR) is a register in the control unit which holds the current instruction being executed. The Instruction Register (IR) is a register in the control unit which holds the current instruction being executed.

9 Machine Language Instruction Set - set of instructions (binary) that the specific type of machine can execute. Instruction Set - set of instructions (binary) that the specific type of machine can execute. Instruction typically has Instruction typically has Opcode field - set of bits telling which instructionOpcode field - set of bits telling which instruction Address fields - memory or register address where operands will be found.Address fields - memory or register address where operands will be found.

10 Instruction form for hypothetical machine 4-bit opcode field - 16 instruction types 4-bit opcode field - 16 instruction types 12-bit address field- 4096 memory cells 12-bit address field- 4096 memory cells Opcode Address 0110 001101010011

11 Machine Language Groups Data Transfer Data Transfer Arithmetic Arithmetic Compare Compare Branch Branch

12 General machine General machine Memory cell  ALU registerMemory cell  ALU register ALU register  Memory cellALU register  Memory cell Memory cell  Memory cellMemory cell  Memory cell ALU register  ALU registerALU register  ALU register Data Transfer instructions

13 Hypothetical machine Opcode Operation Meaning Hypothetical machine Opcode Operation Meaning 0000 Load X Con(X)  R 0000 Load X Con(X)  R 0001 Store X R  Con(X) 0001 Store X R  Con(X) Data Transfer instructions 12-bit address Content stored at address X

14 Hypothetical machine Opcode Operation Meaning Hypothetical machine Opcode Operation Meaning 0010 Clear X 0  Con(X) 0010 Clear X 0  Con(X) 0011 Add X R+Con(X)  R 0011 Add X R+Con(X)  R 0100 Increment X Con(X)+1  Con(X) 0100 Increment X Con(X)+1  Con(X) 0101 Subtract X R-Con(X)  R 0101 Subtract X R-Con(X)  R 0110 Decrement X Con(X)-1  Con(X) 0110 Decrement X Con(X)-1  Con(X) Arithmetic - ADD,SUB,AND,etc.

15 Condition Code Register (CC): 3 bit register with bits GT, EQ, LT. 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. 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. Later instructions can look at CC to see what happened with the last comparison. Compare instructions - Compare values and set an indicator.

16 Hypothetical machine Opcode Operation Meaning Hypothetical machine Opcode Operation Meaning 0111 Compare X If Con(X) > R CC: 100 else if Con(X) R CC: 100 else if Con(X)<R CC: 001 else CC: 010 Compare instructions - Compare values and set an indicator.

17 Hypothetical machine Opcode Operation Meaning Hypothetical machine Opcode Operation Meaning 1000 Jump X X  PC 1000 Jump X X  PC 1001 JumpGT X If GT=1, X  PC 1001 JumpGT X If GT=1, X  PC 1010 JumpEQ X If EQ=1, X  PC 1010 JumpEQ X If EQ=1, X  PC 1011 JumpLT X If LT=1, X  PC 1011 JumpLT X If LT=1, X  PC 1100 JumpNE X If EQ=0, X  PC 1100 JumpNE X If EQ=0, X  PC Branch instructions - Alter flow of control based on CC.

18 Hypothetical machine Opcode Operation Meaning. Hypothetical machine Opcode Operation Meaning. 1101 In X Input value  Con(X) 1101 In X Input value  Con(X) 1110 Out X Con(X)  Output value 1110 Out X Con(X)  Output value 1111 Halt Stop execution 1111 Halt Stop execution Input/Output and Halt

19


Download ppt "Computer Science 101 Computer Systems Organization ALU, Control Unit, Instruction Set."

Similar presentations


Ads by Google