90 likes | 187 Views
1.3 Computation - An Introduction to Informatics -. 2008. 9. 29 WMN Lab. Hey-Jin Lee. outline. Computer Organization Storage Organization Machine Instruction Instruction cycle Euclid’s Algorithm Symbolic Languages and Higher-Level Machines. Computer Orga niza tion.
E N D
1.3 Computation- An Introduction to Informatics - 2008. 9. 29 WMN Lab. Hey-Jin Lee
outline • Computer Organization • Storage Organization • Machine Instruction • Instruction cycle • Euclid’s Algorithm • Symbolic Languages and Higher-Level Machines
Computer Organization Arithmetic Unit : This part is capable of performing various arithmetic and other operations, as well as testing and computing the values of data. Storage Unit : This is the “memory” part of the machine where both the instructions and the data are stored. Control Unit : In general, this is for managing the operation of the entire computer system. Console Input / Output Arithmetic Unit AC Control Unit IC Figure 1-16. Computer Organization
Storage Organization • A simple hypothetical machine • - Storage consists of 10,000 cells or words, each capable of holding • five decimal digits plus a sign. • - Depending on the interpretation by the control unit, a given word • can be treated as item of data or as an instruction. Addressing 0000 0001 1473 9998 9999 Storage Cell Figure 1-17. Storage Organization
Machine Instruction • “single-address” instruction format • Every instruction consists of an operation and, at most, a single operand. Instruction Format Instruction set Machine Instructions Figure 1-18. Machine Instructions
Instruction cycle • The control or executive part of the system continuously executes a loop. • Get instruction, say I, from the storage location addressed by ic. • Update ic to point to next instruction.(icic + 1) • Execute instruction I. • Go to step 1.
Euclid’s Algorithm • Procedure for finding the gcd 0 r := m; 1 {Divide by successive subtractions.} 2 while r ≥ n do r := r-n; 3 {r = m mod n} Figure 1-20 : (m mod n) in Algolic Language Address Instruction Remarks 0201 + 1 1 0 0 0 Load m into AC. 0202 + 4 1 0 0 1 AC ← AC – n. 0203 + 8 0 2 0 5 If ( r – n ) < 0, then go to 205. 0204 + 5 0 2 0 2 r ≥ n. Repeat at 0202. 0205 + 3 1 0 0 1 ( r – n) < 0. Add n back in. 0206 + 2 1 0 0 2 Store result in r. Figure 1-21 : (m mod n) in Machine Language
Euclid’s Algorithm Address Instruction Remarks 0201 + 1 1 0 0 0 Load m into AC. 0202 + 4 1 0 0 1 AC ← AC – n. 0203 + 8 0 2 0 5 If ( r – n ) < 0, then go to 205. 0204 + 5 0 2 0 2 r ≥ n. Repeat at 0202. 0205 + 3 1 0 0 1 ( r – n) < 0. Add n back in. 0206 + 2 1 0 0 2 Store result in r. Figure 1-21 : (m mod n) in Machine Language Address AC m n r ic 0201 20 20 8 -- 0202 0202 12 20 8 -- 0203 0203 12 20 8 -- 0204 0204 12 20 8 -- 0202 0202 4 20 8 -- 0203 0203 4 20 8 -- 0204 0204 4 20 8 -- 0202 0202 -4 20 8 -- 0203 0203 -4 20 8 -- 0204 0205 4 20 8 -- 0206 0206 4 20 8 4 0207 Figure 1-22 : A Trace of Execution
Symbolic Languages and Higher-Level Machines • Higher-Level symbolic languages are realized on computers by providing more complex translators like compilers that produce equivalent machine language programs. • These languages relieve the programmer of responsibility for many machine details and permit him to concentrate on hi problem and algorithm.