Bubble Sort FOR i = 0 TO N-1 FOR J = 0 TO N – 1 - i IF A[J] > A[J+1] THEN SWAP A[J] , A[J+1] 1
2
Little Man Computer 3
The Little Man Computer 4
http: //peterhigginson. co. uk/LMC/ 5
Overview “Little Man Computer” a simplified version of how a CPU works. n n n Memory, the Control Unit, the Accumulator (calculator) were all located in the same area Decimal system used for communication of instructions Memory was limited to 100 “mailboxes” 6
CPU Components 3 Major Parts n n n Arithmetic/Logic Unit (ALU) Control Unit (CU) Memory The ALU & CU are known as the Central Processing Unit 7
Block Diagram of System CPU ALU Control Unit Program Counter Memory I/O 8
Direct Comparison of LMC & CPU Control Unit ALU I/O Interface Memory Program Counter 9
CPU ALU Control Unit Program Counter I/O Memory Arithmetic/ Logic Unit (ALU) The component where data is held temporarily Calculations occur here It knows how to perform operations such as ADD, SUB, LOAD, STORE, SHIFT. It knows the commands that make up the machine language of the CPU It is the calculator 10
CPU ALU Control Unit Program Counter Memory Control Unit I/O Interprets and controls the execution of instructions This control corresponds to the “fetchexecute” cycle n n The fetch cycle gets the instructions The execute cycle does the work specified in the instruction Note 11
CPU ALU Control Unit Program Counter Memory Registers I/O “A Register is a single, permanent storage location within the CPU used for a PARTICULAR, defined purpose. ” “A register is used to hold a binary value temporarily for storage, for manipulation, and/or for simple calculations. ” Registers have special addresses 12
Kahoot. it 13
The End… 14