Question

In: Computer Science

Write a MIPS assembly program to implement each of the following operations. 1. DM[6892] = DM[6884]...

Write a MIPS assembly program to implement each of the following operations.

1. DM[6892] = DM[6884]

(Copy the 32-bit data at data memory address 6884 to data memory address 6892.)

2. DM[7968] = DM[6796] + DM[6800]

(Add the 32-bit data at data memory address 6792 and the 32-bit data at data memory address 6800, then store the sum into data memory address 7968.)

Solutions

Expert Solution

Greetings!!

1.

li $t0,6892 #load destination address
li $t1,6884 #load source address
lw $t2,0(t1) #load data from source to t2
sw $t2,0(t0) #store data to destination

Output screenshot:

Before:

Used addresses 10010000 and 10010008 instead of 6892 and 6884

After:Please note that the source remains the same

2.

Code:

li $t0,0x7968 #load destination address
li $t1,0x6796 #load source address 1
li $t2,0x6800 #load source address 2
lw $t3,0($t1) #load data 1
lw $t4,0($t2) #load data 2
add $t4,$t3,$t4 #add data1 and data2
sw $t4,0($t0) #store sum to destination

Output screenshot:

Used addresses 10010000(dest),10010008 and 10010010

Before:

After:

Hope this helps


Related Solutions

Write a MIPS assembly program to implement each of the following operations. 1. DM[6892] = DM[6884]...
Write a MIPS assembly program to implement each of the following operations. 1. DM[6892] = DM[6884] (Copy the 32-bit data at data memory address 6884 to data memory address 6892.) 2. DM[7968] = DM[6796] + DM[6800] (Add the 32-bit data at data memory address 6792 and the 32-bit data at data memory address 6800, then store the sum into data memory address 7968.)
Write a MIPS Assembly Language program to perform the following operations: Request and read two integers...
Write a MIPS Assembly Language program to perform the following operations: Request and read two integers from the console (Dn and Up), Call a recursive function to compute the result int RecurseFunc( int Dn, int Up ) { if( Dn < 1 ) return 0; return Dn * Up + RecurseFunc( Dn - 1, Up + 1 ); } Print out the results
Write a MIPS Assembly Language program to perform the following operations: Request and read two integers...
Write a MIPS Assembly Language program to perform the following operations: Request and read two integers from the console (Dn and Up), Call a recursive function to compute the result int RecurseFunc( int Dn, int Up ) { if( Dn < 1 ) return 0; else return Dn * Up + RecurseFunc( Dn - 1, Up + 1 ); } Print out the results Submit your code and report here.
Write a MIPS Assembly Language program to perform the following operations: Request and read two integers...
Write a MIPS Assembly Language program to perform the following operations: Request and read two integers from the console (Dn and Up), Call a recursive function to compute the result int RecurseFunc( int Dn, int Up ) { if( Dn < 1 ) return 0; return Dn * Up + RecurseFunc( Dn - 1, Up + 1 ); } Print out the results
Use MARS to write and simulate a MIPS assembly language program to implement the strlen function....
Use MARS to write and simulate a MIPS assembly language program to implement the strlen function. The program should ask for a user's input and print the length of the user's input. Write the main function to call strlen. The main function should: - Prompt the user for input - Pass that input to strlen using registers $a0. - Preserve (i.e. push onto the stack) any T registers that the main function uses. The strlen function should: - Preserve any...
Coding Problem 1: In this program, you are asked to write a program in assembly (MIPS)...
Coding Problem 1: In this program, you are asked to write a program in assembly (MIPS) which works as a simple calculator. The program will get two integer numbers, and based on the requested operation, the result should be shown to the user. a. The program should print a meaningful phrase for each input, and the result. i. “Enter the first number” ii. “Enter the second number” iii. “Enter the operation type” iv. “The result is” b. The user should...
Write a program in MIPS assembly language to perform the calculation of the following equation and...
Write a program in MIPS assembly language to perform the calculation of the following equation and save the result accordingly:    f = 5x + 3y + z Assumptions: - Registers can be used to represent variables x, y, z, and f - Initialize x, y, and z to values of your choice. f can be initialized to zero. - Use comments to specify your register usage and explain your logic
Write a MIPS assembly program that calculates the sum of all the elements in the following...
Write a MIPS assembly program that calculates the sum of all the elements in the following array: int array[10]={12,21,3,40,15,6,17,8,29,10}
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 MIPS assembly language program to solve the following problem: For a set of integers...
Write a MIPS assembly language program to solve the following problem: For a set of integers stored in an array, calculate the sum of the even numbers and the sum of the odd numbers. The program should store these numbers in memory variables: evenSum and oddSum. Numbers should be read from the array one at a time with a zero value (0) being used to signal the end of data in the array.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT