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
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: …
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 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...
Convert the following C++ code into MIPS assembely. For testing I will be change the values...
Convert the following C++ code into MIPS assembely. For testing I will be change the values for q,y,x with few different values. //q -> $s0 //y -> $s1 //x -> $s2 int main(){ int q = 5; int y = 17; int x = 77; if ( q < 10){ cout << "inside if"; } elseif ( x > 0 || y < 10) { cout << "inside elseif"; } else { cout << "inside else"; } }
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...
Write a program in MIPS assembly language to convert an ASCII number string containing positive and...
Write a program in MIPS assembly language to convert an ASCII number string containing positive and negative integer decimal strings, to an integer. Your program should expect register $a0 to hold the address of a nullterminated string containing some combination of the digits 0 through 9. Your program should compute the integer value equivalent to this string of digits, then place the number in register $v0. If a non-digit character appears anywhere in the string, your program should stop with...
Briefly explain why there are no immediate multiply or divide integer ALU instructions for MIPS.
Briefly explain why there are no immediate multiply or divide integer ALU instructions for MIPS.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT