Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Science 101 Computer Systems Organization Machine Language Examples Entire machine.

Similar presentations


Presentation on theme: "Computer Science 101 Computer Systems Organization Machine Language Examples Entire machine."— Presentation transcript:

1 Computer Science 101 Computer Systems Organization Machine Language Examples Entire machine

2 Hypothetical Lab Machine MemoryALUControl MAR(12)MDR(16) 16 ALU R(16) PC(12)IR(16) +1 GTEQLT

3 Hypothetical Machine Instructions Opcode Operation Meaning 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) 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)

4 Hypothetical Machine Instructions Opcode Operation Meaning Opcode Operation Meaning 0111 Compare X If Con(X) > R CC: 100,etc. 0111 Compare X If Con(X) > R CC: 100,etc. 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

5 Hypothetical Machine Instructions Opcode Operation Meaning 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

6 Machine Language: Con(5)+Con(6)  Con(7) 0: 0000000000000101 1: 0011000000000110 2: 0001000000000111 3: 1111000000000000 4: 0000001000001010 5: 0000000000101100 6: 0000000000001011 7: 0000001111111111 R:R: 0000000000000101 Load 5 1111000011110000 0011000000000110 Add 6 0001000000000111 Store 7 1111000000000000 Halt 0000000000101100 0000000000001011 0000000000110111 Python: c = a + b

7

8 Micro Steps: Fetch and Decode Phases Fetch Phase PC  MAR Fetch MDR  IR PC+1  PCDecode IR op  ALU MUX MemoryALUControl MAR(12) MDR(16) 16 ALU R(16) PC(12)IR(16) +1

9 Micro Steps: Execution of Load and Store Load X IR add  MAR Fetch MDR  R Store X IR add  MAR R  MDR Store MemoryALUControl MAR(12) MDR(16) 16 ALU R(16) PC(12)IR(16) +1

10 Micro Steps: Execution of Add and Jump Add X IR add  MAR Fetch MDR  ALU R  ALU Add ALU  R Jump X IR add  PC MemoryALUControl MAR(12) MDR(16) 16 ALU R(16) PC(12)IR(16) +1

11 Micro Steps: Execution of Compare and JumpGT Compare X IR add  MAR Fetch MDR  ALU R  ALU Subtract (set CC)JumpGT If GT=1 IR add  PC MemoryALUControl MAR(12) MDR(16) 16 ALU R(16) PC(12)IR(16) +1

12


Download ppt "Computer Science 101 Computer Systems Organization Machine Language Examples Entire machine."

Similar presentations


Ads by Google