Question

Convert the following assembly language statement into hex representation: lw $T3, 16($S0) Convert the following hex...

Convert the following assembly language statement into hex representation: lw $T3, 16($S0)

Convert the following hex representation into a MIPS assembly language statement. 016A8022 hex

Homework Answers

Answer #1

1)
lw $t3, 16($s0)
=>  LW base   rt offset
=>  LW $s0    $t3    offset
=>  100011 10000  01011  0000000000010000
converting 100011  10000  01011  0000000000010000 to hexadecimal
Converting 10001110000010110000000000010000 to hexadecimal
1000 => 8
1110 => E
0000 => 0
1011 => B
0000 => 0
0000 => 0
0001 => 1
0000 => 0
So, in hexadecimal 10001110000010110000000000010000 is 0x8E0B0010
Answer: 0x8E0B0010

2)
Converting 016A8022 to binary
0 => 0000
1 => 0001
6 => 0110
A => 1010
8 => 1000
0 => 0000
2 => 0010
2 => 0010
So, in binary 016A8022 is 00000001011010101000000000100010

=>  000000 01011  01010  10000  00000  100010
=>  SPECIAL    $t3    $t2    $s0    0  SUB
=>  SPECIAL    rs rt rd 0  SUB
hence the instruction is sub $s0, $t3, $t2
Answer: sub $s0, $t3, $t2


Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
This is a homework assignment for Computer Architecture and some question use MIPS Assembly language. 1.    ...
This is a homework assignment for Computer Architecture and some question use MIPS Assembly language. 1.     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 0x1fff0000. Loop: sw $t1, 4($s0)        addi $t1, $t1, -1    sll $t1, $t1, 2        bne $t1, $s5, Exit    addi $s0, $s0, 4          j Loop Exit: … 2.     Find the MIPS...
Convert the following C program to inline assembly int main(){ int i; printf("Hex Dec Oct Ch\n");...
Convert the following C program to inline assembly int main(){ int i; printf("Hex Dec Oct Ch\n"); for (i = 32; i < 256; i++){ printf("%2x %3d %3o %c\n",i,i,i,i); } return 0; } the code below shows where to do the assembly at: int main(){ int i = 0; char *hdr = "Hex Dec Oct Ch\n"; char *msg = " %2x %3d %3o %c\n"; printf("%s\n",hdr); ———asm{ // DO ASSEMBLY HERE } system("pause"); }
In MIPS assembly, write an assembly language version of the following C code segment: int A[100],...
In MIPS assembly, write an assembly language version of the following C code segment: int A[100], B[100]; for (i=1; i < 100; i++) { A[i] = A[i-1] + B[i]; }
Consider the following MIPS assembly instructions: andi $s0, $t1, 65 a) What will be the machine...
Consider the following MIPS assembly instructions: andi $s0, $t1, 65 a) What will be the machine code for the assembler instruction? Justify the answer and state it in hexadecimal form. b) In which building blocks in the processor are the pieces in the machine code for the assembler instruction above used?
Write a MIPS Assembly Language program which runs interactively to convert between decimal, binary, and hexadecimal....
Write a MIPS Assembly Language program which runs interactively to convert between decimal, binary, and hexadecimal. 1. Request input data type. 2. Request input data. 3. Request output data type. 4. Output the data. The suggested approach was to take the input data as a string. But I am really lost as to how to process the string and then converting it to another data type. Thanks for the help!
Question 1. Answer the following questions on MIPS Instruction Set. a) Show the minimal sequence of...
Question 1. Answer the following questions on MIPS Instruction Set. a) Show the minimal sequence of MIPS instruction for the following pseudocode segment: A[3] = A[10] + B; Assume that B corresponds to register $t3 and the array A has a base address of 1000C41016 which is required to be loaded to register $t0 in your code. Provide comments for each line of your MIPS instruction. b) Assume that Loop starts at memory location 0xC010. Provide a) instruction format of...
Write a Hex Viewer method with the following header: private static void viewHex(String filename) The method...
Write a Hex Viewer method with the following header: private static void viewHex(String filename) The method reads bytes from filename and displays them in hex representation. The output should be formatted as in the example below, i.e., each line consists of 8 pairs of hex numbers, then ‘|’, then another 8 pairs. Use Integer.toHexString() to convert a byte into a string representing the equivalent hex. Use a try statement to handle IOException and display a simple error message if an...
(MIPS Assembly Language): Write the following sequence of code using *native* MIPS instructions: x = x...
(MIPS Assembly Language): Write the following sequence of code using *native* MIPS instructions: x = x - y[0] + y[1]; In memory x, y are stored beginning at 0x010000cc. Use registers $s1 for x,  and $s2 for the base address of y. Make sure your code includes all necessary declarations such that it could run in SPIM.
Translate the following pseudo-code assignment statement into IBM PC assembly language. Assume that all variables are...
Translate the following pseudo-code assignment statement into IBM PC assembly language. Assume that all variables are signed words. Digit = Num % 10
We assume the following $s0 = a $s1 = b $s2 = c $s3 = i...
We assume the following $s0 = a $s1 = b $s2 = c $s3 = i $s4 = address of ar[0] Write MIPS assembly code for the following C code. for (i = 10; i < 30; i ++) { if ((ar[i] > b) || (ar[i] <= c)) ar[i] = 0; else ar[i] = a; }