7-Instruction Set Categories
7-Instruction Set Categories
Instruction formats
Performance Parameters
Summary, References
Instruction
⚫ Definition:
Assumptions
24-bit memory address (3 bytes)
4 –address Instruction
⚫ Because of the large instruction word size and number of
memory accesses the 4- address machine and instruction
format is not seen machine design.
⚫ Although the 4-address structure is used internally in
some implementations of
computer control units. This kind of controller
implementations is known as micro
coded Control.
4- Address Instruction
Instruction 24 Bits / 3 Bytes Bits→ 8(1byte) 24(3bytes) 24(3bytes) 24(3bytes) 24(3bytes)
M(1)M(2)+M(3)
Execution ResopOp1+Op2
Calculation of Memory Accesses
To fetch Instruction itself To Execute an Instruction
Opcode=1
Op1Addr=1 Op1=1
Op2Addr=1 Op2=1
ResAddr=1 Res=1
NextiAddr=1 Total=3
Total=5
Total Memory Traffic= No. of M/A to fetch + No. of M/A to Execute
Total Memory Traffic= 5 + 3 =8
Memory
3- Address Instruction
Instruction set categories Memory
PC Example: add M2
24
Execution
TOS
SOS + Push Op1(TOS M(3) )
etc.
Op Code Op1Addr
Stack
NextiAd Nexti Program
24 Add (TOS TOS+SOS )
counter
dr:
Where to find next Where to find operands
instruction and where to put the
result (on the stack)
0-Address Instruction
Memory
Uses a push stack in CPU
24 Bits / 3 Bytes
» Arithmetic uses stack for both operands and the results
Op1
CPU
TOS
SOS + Push Op1(TOS M(3) )
etc.
Op Code Op1Addr
Stack
NextiAd Nexti Program
24 Add (TOS TOS+SOS )
counter
dr:
Where to find next Where to find operands
instruction and where to put the
result (on the stack)
Comparisons
Instruction set categories
4-Address Instruction Instruction Memory Memory M/As to M/As to Memory
Type To Store To Encode fetch an Execute an Traffic
3-Address Instruction in Bytes in Bytes Instruction Instruction
2-Address Instruction
4-address 5 x 3 = 15 1+(4 x 3) = 13 5 3 5+3=8
1-Address Instruction
0-Address Instruction 3-Address 4 x 3 = 12 1+(3 x 3) = 10 4 3 4+3=7
Comparisons
2-Address 3 x 3 = 09 1+(2 x 3) = 07 3 3 3+3=6
add c AccAcc+c
mpy d AccAcc*d
sub e AccAcc-e
store a aAcc
Evaluate a = (b+c)*d - e
Instruction set categories Memory Memory M/As to M/As to Memory
to Store to Fetch Execute Traffic
4-Address Instruction
encode
3-Address Instruction 1+(3*3)=10
add a, b, c ab+c 4*3=12 4 3 4+3=7
2-Address Instruction
mpy a, a, d aa*d 4*3=12 1+(3*3)=10 4 3 4+3=7
1-Address Instruction
sub a, a, e aa-e 1+(3*3)=10
0-Address Instruction 4*3=12 4 3 4+3=7
Comparisons 36 30 12 9 21
Example
Memory Memory M/As to M/As to Memory
to Store to Fetch Execute Traffic
load a, b ab encode
3*3=9 1+(2*3)=7 3 2 3+3=6
add a, c aa+c
3*3=9 1+(2*3)=7 3 3 3+3=6
mpy a, d aa*d
3*3=9 1+(2*3)=7 3 3 3+3=6
sub a, e aa-e
3*3=9 1+(2*3)=7 3 3 3+3=6
36 28 12 12 24
Memory Memory M/As to M/As to Memory
to Store to Fetch Execute Traffic
Instruction set categories encode
load b Accb
4-Address Instruction 2*3=6 1+(1*3)=4 2 1 2+1=3
add c AccAcc+c
3-Address Instruction 2*3=6 1+(1*3)=4 2 1 2+1=3
mpy d AccAcc*d
2-Address Instruction 2*3=6 1+(1*3)=4 2 1 2+1=3
sub e AccAcc-e
1-Address Instruction 2*3=6 1+(1*3)=4 2 1 2+1=3
store a aAcc
0-Address Instruction 2*3=6 1+(1*3)=4 2 1 2+1=3
Comparisons 30 20 10 5 15
Example push b 1 1 1 0 1
push c 1 1 1 0 1
add 1 1 0 0 0
push d 1 1 1 0 1
mpy 1 1 0 0 0
push e 1 1 1 0 1
sub 1 1 0 0 0
pop a 1 1 1 0 1
8 8 4 0 4
Summary of 3-,2-,1-, and 0-Addresss instruction programming
Instruction set categories
4-Address Instruction
Instruction Memory to Memory to M/As to M/As to Memory
3-Address Instruction Format Store Encode Fetch Execute Traffic
2-Address Instruction
1-Address Instruction 4-Address 45 39 24 9 33
0-Address Instruction
3-Address 36 30 12 9 21
Comparisons
Example 2-Address 36 28 12 12 24
1-Address 30 20 10 5 15
0-Address 8 8 4 0 4
Instruction set categories
4-Address Instruction 45
3-Address Instruction
40
2-Address Instruction
35
1-Address Instruction
0-Address Instruction 30
Comparisons 25
Example 20
– Traffic Analysis 15
10
0
4-Address 3-Address 2-Address 1-Address 0-Address
Memory to Store 45 36 36 30 8
Memory to Encode 39 30 28 20 8
M/As to Fetch 24 12 12 10 4
M/As to Execute 9 9 12 5 0
Memory Traffic 33 21 24 15 4
Instruction set categories
50
4-Address Instruction
45
3-Address Instruction
2-Address Instruction 40
1-Address Instruction 35
0-Address Instruction 30
Axis Title
Comparisons 25
Example 20
– Traffic Analysis
15
10
0
Memory to Store Memory to Encode M/As to Fetch M/As to Execute Memory Traffic
4-Address 45 39 24 9 33
3-Address 36 30 12 9 21
2-Address 36 28 12 12 24
1-Address 30 20 10 5 15
0-Address 8 8 4 0 4
Summary
• Instruction Set Category Based on • Assembly language programming
Number of Operands using 3-,2-,1-,0-address
– 4- Address Instruction instructions
– 3-Address Instruction • Memory to store, Memory to
– 2-Address Instruction encode, M/As to fetch, M/As to
– 1-Address Instruction Execute and Total memory Traffic
– 0-Address Instruction for all type of instruction
• Instruction Format programming
– Memory to store, Memory to • Interesting observations and
encode, M/As to fetch, M/As to conclusions from the graphs
Execute and Total memory Traffic
Homework
• Develop an comparative table for the performance parameters such as memory to
store, memory to encode, M/As to fetch , M/As to execute and total memory
Traffic for 4-,3-,2-,1-,0- address machine instructions.
Consider the following specifications:
– Memory word size is 1 byte, Memory/register Address size is 2byte, Opcode size is 1 byte.
• Write an appropriate assembly language programming using 3-Address, 2-
Address, 1-Address and 0-address machine instructions for the following
expression ( with registers & without registers). Assume that all are integer
operations. X= (A / B + C * D) / (D * E - F + C / A) + G
ii. Compute various performance factors such as memory to store a program, memory to
encode a whole program, Memory access to fetch & execute and memory traffic.
iii. Draw the graphs for the compasison of the above said parameters and tell your
observations from the graphs.
References
Reference Book
• Vincent .P. Heuring, Harry F. Jordan “ Computer System design and
Architecture” Pearson, 2nd Edition, 2003