Question: 1. (40 points) Write a MIPS assembly program that reads n elements from an array A, and writes those N elements to another array B

1. (40 points) Write a MIPS assembly program that reads n elements from an array A, and writes those N elements to another array B in reverse order. For example, if A contains {10,20,30,40,50,60,70,80} and n equals to 5; then at the end of the program execution, the array B must contain (50,40,30,20,10). The main function of the program is given in the following. You only need to write code that defines the "reverse" function. Write a single-line comment for each instruction of your code, explaining the purpose of that instruction. .data A: .word 10, 15, 20, 4, 89, 34, 55, 66, 22, 19, 56, 78 #A is the source array B: .word 0:20 #destination array to store data in reversed order n: .word 10 #the number of elements .text .globl main main: la $a0, A la Sal, B la $t2, n lw $a2, 0(t2) #load the base address of A to $a0 #load the base address of A to Sal jal reverse #procedure/function call from main li $v0,10 #system call syscall reverse: # your function definition goes after here (Hint: Consider using a stack) 2. (40 points) Suppose we want to design a combinational logic block that accepts a 4 bit Binary number as input. Let the most significant bit(leftmost) of the value be A, the second- most significant bit be B, third-most significant bit be C and the least significant(rightmost) bit be D. The output value is represented by another Boolean variable 0. The value of o must be 1 if the input value is greater than 5 and less than 10; and otherwise. a) (15 points) Write down the truth table corresponding to the above-mentioned logic block. b) (10 points) Derive the logic equation from the truth table of 2(a) as a sum of products. c) (15 points) Draw a logic diagram that implements the logic equation of 2(b). 3. (20 points). Draw the logic diagram of a 1-bit adder using AND, OR and NOT gates only
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
