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
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;...
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:" <<...
PART 1: Design a program (using only native MIPS instructions, no pseudo instructions) that will prompt...
PART 1: Design a program (using only native MIPS instructions, no pseudo instructions) that will prompt user to enter three decimal numbers. Each decimal number will not exceed six digits The program can't ask user how many digits will be entered. Both numbers must be stored in memory as NULL terminated strings. The first number must be stored at the memory address 0x10000000. The second number must be stored in the memory 0x10000008. The third number must be stored at...
Write the MIPS assembly codes to implement the following function: copy a block of words from...
Write the MIPS assembly codes to implement the following function: copy a block of words from one address to another. Assume that the starting address of the source block be in register $t1 and that the destination address be in $t2. The instruction also requires that the number of words to copy in $t3 (which is >0, that means how many words are needed to copy). Furthermore, assume that the values of these registers as well as register $t4 can...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT