+ All Categories
Home > Documents > Computer Architecture Chapt 9-2

Computer Architecture Chapt 9-2

Date post: 03-Jun-2018
Category:
Upload: donakomeah
View: 221 times
Download: 0 times
Share this document with a friend
24
8/11/2019 Computer Architecture Chapt 9-2 http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 1/24 Chap. 9 Instruction Set Architecture
Transcript
Page 1: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 1/24

Chap. 9 Instruction Set Architecture

Page 2: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 2/24

Data Transfer Instructions

Memory Memory

: move, exchange

Registers Memory

: load, store, exchange

Registers Registers

: move, exchange

Page 3: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 3/24

Data Transfer Instructions

Stack instructions

 – Memory stacks:

• A portion of a memory address space.

• Store state info. related to procedure calls/returns and

interrupts

- PUSH 

SP SP – 1

M[SP]

 R1

- POP 

R1 M[SP]

SP SP +1

Page 4: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 4/24

Data Transfer Instructions

I/O instructions

 – Ports• Registers with I/O lines attached to I/O

devices – How to port addresses are assigned

• Independent I/O systems – Separate address field for addressing ports

• Memory-mapped I/O – No separate memory locations in one common

address range

 – No distinct I/O instructions

Page 5: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 5/24

Data Manipulation Instructions

Arithmetic Instruction

Logical and bit manipulation instructions

Shift instructions

Page 6: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 6/24

Arithmetic Instructions

111…1 000…0 

000…0 111…1 

2’s complement

Page 7: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 7/24

Logical and Bit Manipulation Instructions

Mask instruction

X · 0 = 0

Bit complement

X  1 = X’ 

Page 8: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 8/24

Page 9: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 9/24

Program Control Instructions

CMP  R5, R6, TO1...

TO1:

Comparison via a subtraction

Set or reset status bits

Comparison via a AND

Set or reset status bits

CMP  R5, R6, R1

TEST R5, R6, R1

(Examples)

Page 10: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 10/24

Program Control Instructions

CMP  R5, R6

BZ  TO1

.

.

.

TO1:

Page 11: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 11/24

Program Control Instructions

CMP  R5, R6

BHE  TO1

.

.

.

TO1:

Page 12: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 12/24

Program Control Instructions

CMP  R5, R6

BGE  TO1

.

.

.

TO1:

Page 13: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 13/24

Program Control Instructions

Procedure Call and Return Instructions

호출함수  피호출함수 

int main(void){

… … 

 puts(“Hi, Mom!”); 

… … }

Code for puts()… … … … 

… 

Page 14: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 14/24

Program Control Instructions

main함수 

...

함수 A 를 호출 

...

함수 A Main함

함 A

호출 

Stack조에

 의해

 현

 

SP

Page 15: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 15/24

Program Control Instructions

CALL B10

.

.

.

;---------------------------------------

B10 PROC

CALL C10

… 

RET

B10 ENDP

;---------------------------------------

C10 PROC

… 

RET

C10 ENDP

;---------------------------------------

SP SP-1

M[SP] PC

PC effective address

PC M[SP]

SP SP+1

Page 16: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 16/24

Program Interrupt

Program interrupt

 – transfer control from a program that is currently running toanother service program as a result of an externally orinternally request

 – Handling a variety of situations that requre a departure from

the normal program sequence

Service program

User program{

… … 

… … 

}

… … 

… … … 

Page 17: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 17/24

Program Interrupt

External Interrupts

 – Come from I/O device, timing devices, circuit monitoringpower supply, or any other external source

• I/O requests, I/O completion

• Time-out interrupt

• Power failure interrupt

Internal Interrupts (traps)

 – Come from illegal or erroneous use of an instruction or data

• Arithmetic overflow

• Divide-by-zero

• Memory stack overflow

• Protection violation

Software Interrupts

 – A special instruction that behaves like an interrupt, used byprogrammer

• System call instruction: Ex) user I/O requests

User mode System (OS) mode

Page 18: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 18/24

Processing Internal Interrupts

Instructions related to EI

- ENI: enable interrupt

- DSI: disable interrupt

Microinstructions for interrupt

SP SP-1

M[SP] PC ; return addr.

SP SP-1

M[SP] PSR

EI 0

INTACK 1

PC IVAD ; interrupt vector addr.

… 

Page 19: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 19/24

Floating-point Computations

Representation: (fraction, exponent)

 – F  2E = +(0.1001110)2  2+4

Range of numbers – In case of computer with 48-bit registers

• Integer: (247-1)

• Floating-point number: (1-2-35)

 2+(2048-1)

 – Sign: 1bit, Fraction: 35bits, Exponent: 12bits

Page 20: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 20/24

Floating-point Computations

Arithmetic operations

.5372400 x 102

+ .1580000 x 10-1

.5372400 x 102

+ .0001580 x 102

.5373980 x 102 

.56780 x 105

+ .56430 x 105

.00350 x 105

.35000 x 103

.5372400 x 102

x .1580000 x 10-1

Page 21: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 21/24

Floating-point Computations

Biased Exponent

 – Bias: an excess number added to the exponent so that

all exponents become positive

 – Advantages

• Only positive exponents

• Simpler to compare the relative magnitude

Page 22: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 22/24

Floating-point Computations

Standard Operand Format of floating-point

numbers

 – Single-precision data type: 32bits

• ADDFS

 – Double-precision data type: 64bits

• ADDFL

Page 23: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 23/24

Floating-point Computations

Significand

 – A leading bit to the left of the implied binary point,

together with the fraction in the field

 f field Significand Decimal Equivalent100…0  1.100…0  1.50

010…0  1.010…0  1.25

000…0  1.000…0  1.00

).1(2)1(   1272  f  e  

)211(2   23127  

)0.1(2   126

  ~)211(2   23127  

~

Page 24: Computer Architecture Chapt 9-2

8/11/2019 Computer Architecture Chapt 9-2

http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 24/24

Floating-point Computations

e=255 (11111111), f=0 +  , -

e=255 (11111111), f 

0 NaN (Not-a-Number) , Ex) 0 x = ?

e=0 (00000000) , f=0 +0, -0

e=0 (00000000) , f 

0 < minimum value


Recommended