Question

In: Computer Science

Show the encoding of the following machine instructions and convert into hexadecimal. 1. STUR X7, [X9,...

Show the encoding of the following machine instructions and convert into hexadecimal.

1. STUR X7, [X9, #32]

2. SUBI X16, X4, #52

3. AND X5, X20, X3

Solutions

Expert Solution

Answer is as follows :

As we know that these instructions are 32 bit long. So machine instructions for given set are :

1) STUR X7, [X9, #32] : D-type Instruction

First 11 bits ( 31 to 21) are set for Opcode . So opcode is 0x7C0 for this instruction i.e. 11111000000.

Next 9 bits ( 20 to 12) are set for address or constants. So constant is #32 (in decimal) i.e. 000100000

Next 2 bits ( 11 to 10) are set to 00 for D- Type. So it is 00

Next 5 bits (9 to 5) are set for Address register i.e. X9 here. So it is 01001 in binary

Next 5 bits (4 to 0) are set for destination register i.e. X7 here. So it is 00111 in binary.

So we get

11111000000 000100000 00 01001 00111

or we can write as

1111 1000 0000 0010 0000 0001 0010 0111 i.e. 0xF8020127 in hexadecimal

So this instruction has

Machine Code - 1111 1000 0000 0010 0000 0001 0010 0111

Hexadecimal Code - 0xF8020127

2. SUBI X16, X4, #52 : I-type Instruction

First 11 bits ( 31 to 21) are set for Opcode . So opcode is 0x344 for this instruction i.e. 01101000100.

Next 11 bits ( 20 to 10) are set for address or constants. So constant is #52 (in decimal) i.e. 00000110100

Next 5 bits (9 to 5) are set for Source register i.e. X4 here. So it is 00100 in binary

Next 5 bits (4 to 0) are set for destination register i.e. X16 here. So it is 10000 in binary.

So we get

01101000100 00000110100 00100 10000

or we can write as

0110 1000 1000 0000 1101 0000 1001 0000 i.e. 0x6880D090 in hexadecimal

So this instruction has

Machine Code - 0110 1000 1000 0000 1101 0000 1001 0000

Hexadecimal Code - 0x6880D090

3. AND X5, X20, X3 : R-Type Instruction

First 11 bits ( 31 to 21) are set for Opcode . So opcode is 0x458 for this instruction i.e. 10001011000.

Next 5 bits (20 to 16) are set for Source register 2 i.e. X3 here. So it is 00011 in binary

Next 6 bits (15 to 10) are set for Shift OPerations. So this is arithmetic instruction so this will be 000000

Next 5 bits (9 to 5) are set for Source register 1 i.e. X20 here. So it is 10100 in binary

Next 5 bits (4 to 0) are set for destination register i.e. X5 here. So it is 00101 in binary.

So we get

10001011000 00011 000000 10100 00101

or we can write as

1000 1011 0000 0011 0000 0010 1000 0101 i.e. 0x8B030285 in hexadecimal

So this instruction has

Machine Code - 1000 1011 0000 0011 0000 0010 1000 0101

Hexadecimal Code - 0x8B030285

if there is any query please ask in the comments..


Related Solutions

1. Convert to binary and hexadecimal (PLEASE SHOW WORK) a. 35 - binary: - hexadecimal: b....
1. Convert to binary and hexadecimal (PLEASE SHOW WORK) a. 35 - binary: - hexadecimal: b. 85 - binary: - hexadecimal: c. 128 - binary: - hexadecimal: d. 4563 - binary: - hexadecimal:
Convert 110.7510 to binary ______ and hexadecimal ______. Show the answer in both binary and hexadecimal....
Convert 110.7510 to binary ______ and hexadecimal ______. Show the answer in both binary and hexadecimal. There are ____________ kilobytes in a megabyte. Convert -13210 to a 16-bit 2’s complement in binary ____________ and hexadecimal ______________.
1. Convert the machine language instructions into assembly language instructions: 7976C1 06
1. Convert the machine language instructions into assembly language instructions: 7976C1 06
Convert the following to machine code and then back to MIPS instructions: 1) a. addi $s0,...
Convert the following to machine code and then back to MIPS instructions: 1) a. addi $s0, $zero, -15 b. slt $t0, $s0, $s1 c. beq $t0, $zero, LEEQ d. j GRT
Convert from hexadecimal to binary to decimal (PLEASE SHOW WORK) 1. B2 - binary: - decimal:...
Convert from hexadecimal to binary to decimal (PLEASE SHOW WORK) 1. B2 - binary: - decimal: 2. 37 - binary: - decimal: 3. 0A -binary: - decimal: 4. 11 - binary: - decimal:
Convert these machine codes to MIPS instructions: Ox29210003, and Ox8e460002
Convert these machine codes to MIPS instructions: Ox29210003, and Ox8e460002
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in...
Convert the following numbers to 32-bit, 2s compliment binary and hexadecimal formats. Show your work in recursive division form. 899726616 1656906428 -77102817 -251026154
1. Convert 5.5 to hexadecimal notation using IEEE 754 single precision. Please show your work and...
1. Convert 5.5 to hexadecimal notation using IEEE 754 single precision. Please show your work and answer must be in hexadecimal notation. 2. (4 points) Convert -7.875 to hexadecimal notation using IEEE 754 single precision. Please show your work and answer must be in hexadecimal notation.
Convert from binary to decimal to hexadecimal (PLEASE SHOW ALL WORK) a. 1010 1011 - decimal:...
Convert from binary to decimal to hexadecimal (PLEASE SHOW ALL WORK) a. 1010 1011 - decimal: - hexadecimal b. 0011 0001 - decimal: - hexadecimal: c. 1110 0111 - decimal: - hexadecimal: d. 1111 1111 - decimal: - hexadecimal:
Convert the following binary values to hexadecimal and decimal (1 pt each) Write Hex Numbers as...
Convert the following binary values to hexadecimal and decimal (1 pt each) Write Hex Numbers as 0x##(ex 0x0A, 0xFF) Binary Hexadecimal Decimal 0001-1011 0x 0000-1000 0000-0100 0000-1001 0001-1111 1001-1001 0111-1010 1100-0010 1110-0101 1000-1010 0011-0100 0001-1001 0100-0011 1111-1111 1110-0111 0001-0010 0100-1000 0100-1110 1001-0001 0110-1100 Name: Convert the following hexadecimal values to binary and decimal Write binary numbers as 0000-0000 Hexadecimal Binary Decimal 0xf1 0xac 0x56 0x6c 0x32 0x30 0x05 0x28 0xf0 0x07 0x42 0xb9 0x6d 0x2f 0x71 0x0e 0x2d 0xfb 0xba...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT