Professional Documents
Culture Documents
Computer System Architecture: National University of Sciences AND Technology
Computer System Architecture: National University of Sciences AND Technology
Lab # 09
Computer System Architecture
(PC) Muhammad Shoaib Talib (281018)
(GC)Abdul Wali (280935)
DE-40 CE” A”
Lab 9
Lab Objectives:
The purpose of this lab is to make students able to better understand the machine code and
Lab Tasks
Task#01:
Draw the data paths along with the control units after deriving the machine
language codes for the instructions given below. Your diagram should be very well
Solution:
1): lw $s0, 20($s2)
.text
Immdiate 20
rs=$s2 =R#18
rt=$s0=R#16
OPCODE rs rt Address
35 18 16 20
100011 10010 10000 0000000000010100
Data Path:
OPCODE rs rt Address
43 30 23 20
101011 11110 10111 0000000000010100
DataPath:
Task#02:
What changes would be needed if we want to make the basic architecture capable of executing ‘add
immediate’ instruction as well. Also draw the complete table indicating state of all control lines in this
case.
Solution
Now suppose we have the immediate type instruction
addi $11,$13,30
OPCODE rs rt immediate
0010 00 01 101 0 1011 0000 0000 0001 1110
DataPath:
Table:
Instructio RedDs ALUSr MemtoRe MemRea RegWri MemWrit Branc ALUop Aluop
n t c g d e e h 1 2
I type 0 1 0 0 1 0 0 0 0
Explanation: addi is a I-type instruction in which there is a 16-bit field for the immediate
value to be added with the Register rs and the resultant value is stored in the rs register. As
there are two basic operation to be performed
1): Adding the immediate value to the register rs
2): Storing back the result to the Register
So, the Control Unit will generate the Signal to the Corresponding input lines as shown in the
Datapath. Hence the Corresponding inputs will be generated. Control Unit Decide the inputs
based upon the op-code related to each instruction in the MIPS.