slide1
Download
Skip this Video
Download Presentation
second word

Loading in 2 Seconds...

play fullscreen
1 / 15

second word - PowerPoint PPT Presentation


  • 70 Views
  • Uploaded on

n. bits. first word. second word. • • •. i. th word. • • •. last word. Figure 2.5. Memory words. 32 bits. • • •. b. b. b. b. 31. 30. 1. 0. for positive numbers. Sign bit:. b. =. 0. 31. for negative numbers. b. =. 1. 31. (a) A signed integer. 8 bits.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' second word' - rose-cherry


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
slide1

n

bits

first word

second word

i

th word

last word

Figure 2.5. Memory words.

slide2

32 bits

b

b

b

b

31

30

1

0

for positive numbers

Sign bit:

b

=

0

31

for negative numbers

b

=

1

31

(a) A signed integer

8 bits

8 bits

8 bits

8 bits

ASCII

ASCII

ASCII

ASCII

character

character

character

character

(b) Four characters

Figure 2.6.Examples of encoded information in a 32-bit word.

slide3

Address

Contents

i

Begin execution here

Move

A,R0

3-instruction

i

+ 4

program

Add

B,R0

segment

i

+ 8

Move

R0,C

A

Data for

B

the program

C

Figure 2.8. A program for C ¬ [A] + [B].

slide4

Move

NUM1,R0

i

i

+

4

Add

NUM2,R0

i

+

8

Add

NUM3,R0

i

Add

NUM

n

,R0

+

4

n

-

4

i

4

n

+

Move

R0,SUM

SUM

NUM1

NUM2

NUM

n

Figure 2.9. A straight-line program for addingn numbers.

slide5

Move

N,R1

Clear

R0

LOOP

Determine address of

"Next" number and add

"Next" number to R0

Program

loop

Decrement

R1

Branch>0

LOOP

Move

R0,SUM

SUM

N

n

NUM1

NUM2

NUM

n

Figure 2.10. Using a loop to addn numbers.

slide6

Add (R1),R0

Add (A),R0

Main

memory

B

Operand

A

B

Register

Operand

R1

B

B

(a) Through a general-purpose register

(b) Through a memory location

Figure 2.11. Indirect addressing.

slide7

Address

Contents

Move

N,R1

Initialization

Move

#NUM1,R2

Clear

R0

LOOP

Add

(R2),R0

Add

#4,R2

Decrement

R1

LOOP

Branch>0

Move

R0,SUM

Figure 2.12. Use of indirect addressing in the program of Figure 2.10.

slide8

Add 20(R1),R2

R1

1000

1000

20 = offset

1020

Operand

(a) Offset is given as a constant

Add 1000(R1),R2

1000

20

R1

20 = offset

1020

Operand

(b) Offset is in the index register

Figure 2.13. Indexed addressing.

slide9

n

N

Student ID

LIST

LIST + 4

Test 1

Student 1

LIST + 8

Test 2

LIST + 12

Test 3

LIST + 16

Student ID

Test 1

Student 2

Test 2

Test 3

Figure 2.14. A list of students\' marks.

slide10

Move #LIST,R0

Clear

R1

Clear

R2

Clear

R3

Move

N,R4

Add

4(R0),R1

LOOP

Add

8(R0),R2

A

d

d

12(R0),R3

Add

#16,R0

Decrement

R4

Branch>0

LOOP

Move

R1,SUM1

R2,SUM2

Move

Move

R3,SUM3

Figure 2.15. Indexed addressing used in accessing test scores in the list in Figure 2.14.

slide11

Move

N,R1

Initialization

Move

#NUM1,R2

Clear

R0

LOOP

Add

(R2)+,R0

Decrement

R1

Branch>0

LOOP

Move

R0,SUM

Figure 2.16. The Autoincrement addressing mode used in the program of Figure 2.12.

slide12

100

Move

N,R1

104

Move

#NUM1,R2

108

Clear

R0

LOOP

112

Add

(R2),R0

116

Add

#4,R2

120

Decrement

R1

124

Branch>0

LOOP

128

Move

R0,SUM

132

SUM

200

N

204

100

NUM1

208

NUM2

212

NUM

n

604

Figure 2.17. Memory arrangement for the program in Figure 2.12.

slide13

Memory

Addressing

address

or

data

lab

el

Op

eration

information

Assem

bler

directiv

es

SUM

EQU

200

ORIGIN

204

N

D

A

T

A

W

ORD

100

NUM1

RESER

VE

400

ORIGIN

100

Statemen

ts

that

ST

AR

T

MO

VE

N,R1

generate

MO

VE

#NUM1,R2

mac

hine

CLR

R0

instructions

LOOP

ADD

(R2),R0

ADD

#4,R2

DEC

R1

BGTZ

LOOP

MO

VE

R0,SUM

Assem

bler

directiv

es

RETURN

END

ST

AR

T

Figure 2.18. Assembly language representation for the program in Figure 2.17.

slide15

Mo

v

e

#LOC,R0

Initialize

p

oin

ter

register

R0

to

p

oin

t

to

the

address

of

the

first

lo

cation

in

memory

where

the

c

haracters

are

to

b

e

stored.

READ

T

estBit

#3,INST

A

TUS

W

ait

for

a

c

haracter

to

b

e

en

tered

Branc

h=0

READ

in

the

k

eyb

oard

buffer

D

A

T

AIN.

Mo

v

eByte

D

A

T

AIN,(R0)

T

ransfer

the

c

haracter

from

D

A

T

AIN

in

to

the

memory

(this

clears

SIN

to

0).

ECHO

T

estBit

#3,OUTST

A

TUS

W

ait

for

the

displa

y

to

b

ecome

ready

.

Branc

h=0

ECHO

Mo

v

eByte

(R0),D

A

T

A

OUT

Mo

v

e

the

c

haracter

just

read

to

the

displa

y

buffer

register

(this

clears

SOUT

to

0).

Compare

#CR,(R0)+

Chec

k

if

the

c

haracter

just

read

is

CR

(carriage

return).

If

it

is

not

CR,

then

Branc

h

READ

branc

h

bac

k

and

read

another

c

haracter.

0

Also,

incremen

t

the

p

oin

ter

to

store

the

next

c

haracter.

Figure 2.20. A program that reads a line of characters and displays it.

ad