Date post: | 03-Jun-2018 |
Category: |
Documents |
Upload: | donakomeah |
View: | 221 times |
Download: | 0 times |
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
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
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
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
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
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
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’
8/11/2019 Computer Architecture Chapt 9-2
http://slidepdf.com/reader/full/computer-architecture-chapt-9-2 8/24
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)
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:
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:
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:
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()… … … …
…
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
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
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{
… …
… …
}
… …
… … …
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
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.
…
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
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
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
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
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
~
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