1.3 computation - an introduction to informatics -

9
1.3 Computation - An Introduction to Informatics - 2008. 9. 29 WMN Lab. Hey-Jin Lee

Upload: kele

Post on 04-Jan-2016

29 views

Category:

Documents


0 download

DESCRIPTION

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. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: 1.3 Computation - An Introduction to Informatics -

1.3 Computation- An Introduction to Informatics -

2008. 9. 29

WMN Lab. Hey-Jin Lee

Page 2: 1.3 Computation - An Introduction to Informatics -

outline

• Computer Organization• Storage Organization• Machine Instruction• Instruction cycle• Euclid’s Algorithm• Symbolic Languages and Higher-

Level Machines

Page 3: 1.3 Computation - An Introduction to Informatics -

Console

Input / Output

Arithmetic Unit

AC

Control Unit

IC

Figure 1-16. Computer Organization

Computer Organization

…..

Storage Unit

……

1. Arithmetic Unit : This part is capable of performing various arithmetic and other operations, as well as testing and computing the values of data.

2. Storage Unit : This is the “memory” part of the machine where both the instructions and the data are stored.

3. Control Unit : In general, this is for managing the operation of the entire computer system.

Page 4: 1.3 Computation - An Introduction to Informatics -

Storage Organization

s d d d d d

+ 0 0 1 3 7

- 1 9 4 8 8

. . . . . . . . . .

+ 9 3 3 5 5

. . . . . . . . . .

- 0 1 0 6 0

+ 7 7 1 7 2

Storage Cell

Addressing

Figure 1-17. Storage Organization

0000 0001

1473

99989999

• 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.

Page 5: 1.3 Computation - An Introduction to Informatics -

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

Page 6: 1.3 Computation - An Introduction to Informatics -

Instruction cycle

• The control or executive part of the system continuously executes a loop.

1. Get instruction, say I, from the storage location addressed by ic.

2. Update ic to point to next instruction.(ic ic + 1)

3. Execute instruction I.

4. Go to step 1.

Page 7: 1.3 Computation - An Introduction to Informatics -

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

Page 8: 1.3 Computation - An Introduction to Informatics -

Euclid’s Algorithm

Address AC m n r ic0201 20 20 8 -- 02020202 12 20 8 -- 02030203 12 20 8 -- 02040204 12 20 8 -- 02020202 4 20 8 -- 02030203 4 20 8 -- 02040204 4 20 8 -- 02020202 -4 20 8 -- 02030203 -4 20 8 -- 02040205 4 20 8 -- 02060206 4 20 8 4 0207

Figure 1-22 : A Trace of Execution

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

Page 9: 1.3 Computation - An Introduction to Informatics -

Symbolic Languages and Higher-Level Machines• Higher-Level symbolic languages are real-

ized on computers by providing more complex translators like compilers that produce equiva-lent machine language programs.

• These languages relieve the programmer of responsibility for many machine details and permit him to concentrate on hi problem and algorithm.