120 likes | 157 Views
CS149D Elements of Computer Science. Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture 7: 9/17/2002. Outline. Chapter 2 Data Manipulation Example of Program execution on the sample machine architecture introduced in the previous lecture
E N D
CS149D Elements of Computer Science Ayman Abdel-Hamid Department of Computer Science Old Dominion University Lecture 7: 9/17/2002 CS149D Fall 2002
Outline • Chapter 2 Data Manipulation • Example of Program execution on the sample machine architecture introduced in the previous lecture • Other machine architectures • chapter 2 plan • covered sections 2.1-2.3, • Covered logical operations in section 2.4 • Skipped 2.5 • covered 2.6 CS149D Fall 2002
Example of program execution • Example of adding 2 values • Get first value from memory and place in a register R1 • Get second value from memory and place in another register R2 • Activate addition circuitry with R1 and R2 as inputs and R3 to hold results • Store contents of R3 (result) in memory • Stop 1. 156C LOAD 5, 6C 2. 166D LOAD 6, 6D 3. 5056 ADD 0, 5, 6 4. 306E STORE 0, 6E 5. C000 HALT • Instruction is 2 bytes • Values to be added stored in 2’s complement notation at memory address 6C and 6D • Sum placed in memory at address 6E CS149D Fall 2002
Example of program execution Program Program stored in Memory 1. 156C 2. 166D 3. 5056 4. 306E 5. C000 1 memory cell is 8 bits Program stored in consecutive addresses at address A0 CS149D Fall 2002
Example of Program Execution Place address A0 in program counter and start machine Machine Cycle 1 Program Counter PC Instruction Register IR Control unit starts a new cycle CS149D Fall 2002
Example of Program Execution Machine Cycle 2 PC is A2 Program Counter PC Instruction Register IR Control unit starts a new cycle CS149D Fall 2002
Example of Program Execution Machine Cycle 3 PC is A4 Program Counter PC Instruction Register IR Control unit starts a new cycle CS149D Fall 2002
Example of Program Execution Machine Cycle 4 PC is A6 Program Counter PC Instruction Register IR Control unit starts a new cycle CS149D Fall 2002
Example of Program Execution Machine Cycle 5 PC is A8 Program Counter PC Instruction Register IR CS149D Fall 2002
Logical Operations revisited 10011010 10011010 10011010 AND 11001001 OR 11001001 XOR 11001001 ________ ________ _________ 10001000 11011011 01010011 00001111 11110000 11111111 AND 10101010 OR 10101010 XOR 10101010 ________ ________ _________ 00001010 11111010 01010101 CS149D Fall 2002
Other Machine Architectures • CISC Complex Instruction Set Computer • Complex machine that can decode and execute a wide variety of instructions • Easier to program (single instruction performs the task of several instructions in RISC) • Complex CPU design • To reduce required circuitry, use microprogram approach where each machine instruction is actually executed as a sequence of simpler instructions • Example is Pentium processors by Intel • RISC Reduced Instruction Set Computer • Simple machine that has a limited instruction set • Simpler CPU design • Machine language programs are longer than CISC counterpart because several instructions are required to perform the task of a single instruction in CISC • Example is PowerPC developed by Apply, IBM and Motorola • Other concepts: Pipelining, multiprocessor machines CS149D Fall 2002