Question

In: Computer Science

Convert these machine codes to MIPS instructions: Ox29210003, and Ox8e460002

Convert these machine codes to MIPS instructions:

Ox29210003, and Ox8e460002

Solutions

Expert Solution

1)
Hexadecimal     Binary
    0           0000
    1           0001
    2           0010
    3           0011
    4           0100
    5           0101
    6           0110
    7           0111
    8           1000
    9           1001
    A           1010
    B           1011
    C           1100
    D           1101
    E           1110
    F           1111
Use this table to convert from hexadecimal to binary
Converting 29210003 to binary
2 => 0010
9 => 1001
2 => 0010
1 => 0001
0 => 0000
0 => 0000
0 => 0000
3 => 0011
So, in binary 29210003 is 00101001001000010000000000000011

=>  00101001001000010000000000000011
=>  001010 01001  00001  0000000000000011
=>  SLTI   $t1    $at    immediate
=>  SLTI   rs rt immediate
so, instruction is slti $at, $t1, 3
Answer:
--------
slti $at, $t1, 3

2)
Converting 8E460002 to binary
8 => 1000
E => 1110
4 => 0100
6 => 0110
0 => 0000
0 => 0000
0 => 0000
2 => 0010
So, in binary 8E460002 is 10001110010001100000000000000010

=>  10001110010001100000000000000010
=>  100011 10010  00110  0000000000000010
=>  LW $s2    $a2    offset
=>  LW base   rt offset
so, instruction is lw $a2, 2($s2)
Answer:
---------
lw $a2, 2($s2)

Related Solutions

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 the following MIPS instructions into machine code. Directly write down the answer without justifying steps...
Convert the following MIPS instructions into machine code. Directly write down the answer without justifying steps will result 0 credit. All steps must be typed in Word. 1. add $s0, $s1, $s2 2. lw $s0, 15($s1) 3. beq $s0, $s1, LABEL   #consider LABEL represents the 16-bit value 0x00FF
1. Convert the machine language instructions into assembly language instructions: 7976C1 06
1. Convert the machine language instructions into assembly language instructions: 7976C1 06
Question: In the following MIPS assembly code, translate all the instructions to their corresponding machine code...
Question: In the following MIPS assembly code, translate all the instructions to their corresponding machine code in hexadecimal format. This code is stored in the memory from address 0x2fff0004. Loop: lw $t0, 4($s0)             addi $t1, $t1, -15             sll $t1, $t1, 2             beq $t1, $s1, Exit             addi $s0, $s0, 4             j Loop Exit: …
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
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
Translate the C function code below to the MIPS True Assembler Language code (machine instructions only)....
Translate the C function code below to the MIPS True Assembler Language code (machine instructions only). The function code should follow the conventions for MIPS function calls including passing parameters and returning results. Your function code must be written with the minimum number of machine instructions to be executed and without any use of MIPS pseudo-instructions. Myfunction(unsigned int a, unsigned int b, unsigned int c) { int i=0; while (a > c) { a /= b; i++; } return i;...
6. What is the MIPS machine language binary code for these three instructions? lw   $t0, 1200($t1)...
6. What is the MIPS machine language binary code for these three instructions? lw   $t0, 1200($t1) #Temporary reg $t0 gets A[300] add $t0, $s2, $t0 #Temporary reg $t0 gets h+A[300] sw   $t0, 1200($t1) #Stores h+A[300]$t0 back into A[300]
Convert in machine code for MIPS LW S5, 33(S2); Add R1, T3, S5; Sub T4, S3,...
Convert in machine code for MIPS LW S5, 33(S2); Add R1, T3, S5; Sub T4, S3, R3; SW T4, 124(T7);
convert following C++ code into MIPS assembly: int main() {                                 &
convert following C++ code into MIPS assembly: int main() {                                         int x[10], occur, count = 0;                                                              cout << "Type in array numbers:" << endl; for (int i=0; i<10; i++) // reading in integers                               { cin >> x[i];        } cout << "Type in occurrence value:" << endl;                                 cin >> occur;                                                 // Finding and printing out occurrence indexes in the array                                  cout << "Occurrences indices are:" <<...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT