Computer Science 101 Computer Systems Organization Machine Language Examples Entire machine
Hypothetical Lab Machine MemoryALUControl MAR(12)MDR(16) 16 ALU R(16) PC(12)IR(16) +1 GTEQLT
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)
Hypothetical Machine Instructions Opcode Operation Meaning Opcode Operation Meaning 0111 Compare X If Con(X) > R CC: 100,etc Compare X If Con(X) > R CC: 100,etc 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
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
Machine Language: Con(5)+Con(6) Con(7) 0: : : : : : : : R:R: Load Add Store Halt Python: c = a + b
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
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
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
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