Professional Documents
Culture Documents
Fall 2022 - CS501 - 1
Fall 2022 - CS501 - 1
1 CS501
Submitted By BC190404087 (Husanin Iqbal)
Question No.1
Write the equivalent assembly language instructions for the given machine language instructions.
Write all the conversion steps for all instructions sequence wise.
Sr # Machine Language Instruction Equivalent Assmebly Language
Instruction
1 E1C60004 h SHL, R7, R3, RO
2 61885000 h add, R6, R4, R5
3 724E8000 h sub, R9, R7, R8
4 1A4000D4 h st, R9, 212(RO)
5 084000D0 h Id, R1, 208(RO)
Solution:
E1060004
First convert the hexadecimal into binary pattern which is:
1110 0001 1100 0110 0000 0000 0000 0100
The first 5 bits of the binary pattern represent the opcode which is 28. This
opcode 28 belongs to "shl" shl is shift left by using register rc. The instructipm is modified
form of type D.
31 27 26 22 21 17 16 12 11 5 4 0
61885000
The first five bits of the binary pattern represent the opcode which is 12. This opcode 12
belongs to “add” add the instruction for 2’s compliment register addition. The instruction is
type of D
31 27 26 22 21 17 16 12 11 0
Op-code ra rb rc unused
724E8000
First convert the hexadecimal into binary pattern which is:
0111 0010 0100 1110 1000 0000 0000 0000
31 27 26 22 21 17 16 12 11 0
Op-code ra rb rc unused
The first 5 bits of the binary pattern represent the opcode which is 14. This opcode 14 belongs
to "sub" sub the instruction for 2's complement register subtraction. The instructipm is of type
D
01110 01001 00111 01000 000000000000
In type D instruction the bits are as above
Next we specify the instruction field for each the section as following.
1A4000D4
First convert the hexadecimal into binary pattern which is:
0001 1010 0100 0000 0000 0000 1101 0100
The first 5 bits of the binary pattern represent the opcode which is 3. This opcode 3 belongs to
"st" The st instructions is used to store register contents to memory. The instructions is of type
C:
31 27 26 22 21 17 16 0
00000000011010100
In type C instruction the bits are as above:
Next, we specify the instruction filed for each the section as following:
00011 01001 00000 00000000011010100
st R9 R0 212
Hence, the st instruction will be: st, R9, 212(R0)
084000D0
First convert the hexadecimal into binary pattern which is:
0000 1000 0100 0000 0000 0000 1101 0000
The first 5 bits of the binary pattern represent the opcode which is 1. This opcode 1
belongs to "Id" The id, instruction load register from memory instruction. The
instruction is of type C:
31 27 26 22 21 17 16 0
Op-code ra rb C2