Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- mysql
- DS
- web
- github
- for
- html
- XML
- function
- DATAPATH
- MIPS
- Algorithm
- react
- CSS
- Pipelining
- computer
- instruction
- system
- DB
- MacOS
- data structure
- Class
- while
- php
- architecture
- javascript
- python
- Java
- control
- Linux
- DoM
Archives
- Today
- Total
YYYEJI
[CS] Example for Operand 본문
728x90
Let's find out about assembly language by solving the example below.
↓↓↓ Question ↓↓↓
Implement the following expression with three-, two-, one-, and zero-operand instruction sequences.
Assume we have ADD and DIV instruction.
Z = (A+B)/C
↓↓↓ Solution ↓↓↓
When 2 address,
Z = A
Z = Z + B
Z = Z/C = (A + B)/C
When 1 address,
AC = A
AC = AC(A) + B
AC = AC(A+B) / C
↓↓↓ Answer ↓↓↓
When 3 address,
ADD Z, A, B
DIV Z, Z, C
When 2 address,
MOV Z, A
ADD Z, B
DIV Z, C
When 1 address,
LOAD A
ADD B
DIV C
STORE Z
When 0 address,
PUSH A
PUSH B
ADD
PUSH C
DIV
POP Z
◡̈
'Computer architectures' 카테고리의 다른 글
[CS] Exercise for Addressing Modes (0) | 2022.09.22 |
---|---|
[CS] Addressing Modes (0) | 2022.09.21 |
[CS] Number of Operands (0) | 2022.09.19 |
[CS] Instruction 구성 (0) | 2022.09.19 |
[CS] Special Purpose Registers (0) | 2022.09.19 |