Question

In: Computer Science

2. Write the hexadecimal numbers in the registers of $a0, $a1, $a2, $a3 after the following...

2. Write the hexadecimal numbers in the registers of $a0, $a1, $a2, $a3 after the following codes running:

ori $a0, $0, 11

ori $a1, $0, 19

addi $a1, $a1, -7

slt $t2, $a1, $a0

beq $t2, $0, label

addi $a2, $a1, 0

sub $a3, $a1,$a0

j end_1

label: ori $a2, $a0, 0

add $a3, $a1, $a0

end_1: xor $t2, $a1, $a0

*Values in $a0, $a1, $a2, $a3 after the above instructions are executed.

Solutions

Expert Solution

Ans->Values of registers in hexadecimal are :

$a0 =B  

$a1=C

$a2=B

$a3=17

$t2=7

ori $a0, $0, 11   // do or of 0 , 11 and store the value in a0 register

ori $a1, $0, 19 // do or of 0 , 19 and store the value in a1 register

addi $a1, $a1, -7 // add the value of a1 register and -7 , and store the result in a1 register

slt $t2, $a1, $a0 // store 1 in t2 register if value in a1 register is less than value in a0 register ,else 0

beq $t2, $0, label // if t2 is equal to 0 then move to label else continue executing next instructions

addi $a2, $a1, 0 // add the value of a1 register and 0 ..and store the result in a2 ==>a2=a1+a0

sub $a3, $a1,$a0 // subtract the value of a0 register from a1 register and store the value in a3==>a3=a1-a0

j end_1 //this means jump to end_1 label

label: ori $a2, $a0, 0 // do or of value in a0 register and 0 ..and store the value in a2

add $a3, $a1, $a0 // add values of register a1 and a0 ..store the result in a3

end_1: xor $t2, $a1, $a0 // do xor of values in a1 and a0 ...store the result in t2

Execution of program:(Assume value stored in decimal)

after first step $a0=11

after second step $a1=19

after third step $a1=19-7=12

after fourth step $t2=0 ==>since $a1>$a0

after fifth step control goes to label ==>since condition is true

after label instruction execution $a2=11

after add instruction execution $a3=$a1+$a0= 12+11=23

after execution of end_1 label $t2=$a1 ^ $a0 = 12 ^11=7

Hence values in decimal are

$a0 =11  

$a1=12

$a2=11

$a3=23

$t2=7

Converting into hexadecimal we get

$a0 =B  

$a1=C

$a2=B

$a3=17

$t2=7


Related Solutions

We say that an infinite sequence a0,a1,a2,a3,… of real numbers has the limit L if for...
We say that an infinite sequence a0,a1,a2,a3,… of real numbers has the limit L if for every strictly positive number ε, there is a natural number n such that all the elements an,an+1,an+2,… are within distance ε of the value L. In this case, we write lim a = L. Express the condition that lim a = L as a formula of predicate logic. Your formula may use typical mathematical functions like + and absolute value and mathematical relations like...
covert the schema into 3NF. TableC (a1,a2,a3,a4,a5) functionally dependencies: a1 --> {a2,a3,a5} a4 --> {a1,a2,a3,a5} a3...
covert the schema into 3NF. TableC (a1,a2,a3,a4,a5) functionally dependencies: a1 --> {a2,a3,a5} a4 --> {a1,a2,a3,a5} a3 -->{a5} Answer: Relation1: Relation2:
A four-bit binary number is represented as A3A2A1A0, where A3, A2, A1, and A0 represent the...
A four-bit binary number is represented as A3A2A1A0, where A3, A2, A1, and A0 represent the individual bits and A0 is equal to the LSB. Design a logic circuit that will produce a HIGH output whenever the binary number is greater than 0010 and less than 1000. how can I do this by using sum of product, not K map
Let A = {a1, a2, a3, . . . , an} be a nonempty set of...
Let A = {a1, a2, a3, . . . , an} be a nonempty set of n distinct natural numbers. Prove that there exists a nonempty subset of A for which the sum of its elements is divisible by n.
For each of the following sequences find a functionansuch that the sequence is a1, a2, a3,...
For each of the following sequences find a functionansuch that the sequence is a1, a2, a3, . . .. You're looking for a closed form - in particular, your answer may NOT be a recurrence (it may not involveany otherai). Also, while in general it is acceptable to use a "by cases"/piecewise definition, for this task you must instead present a SINGLE function that works for all cases.(Hint: you may find it helpful to first look at the sequence of...
Let A0.A1,A2,A3,A4 devide a unit circle (circle of radius one) into five equal parts. Prove that...
Let A0.A1,A2,A3,A4 devide a unit circle (circle of radius one) into five equal parts. Prove that the chords A0 A1, A0 A2 satisfy: (A0 A1 * A0 A2)^2 = 5.
Consider the following eight examples: A1 = (4,20), A2 = (4,10), A3 = (16,8), A4 =...
Consider the following eight examples: A1 = (4,20), A2 = (4,10), A3 = (16,8), A4 = (10,16), A5 = (14,10), A6 = (12,8), A7 = (2,4), A8 = (8,18) The distance function is Euclidian distance. Use single-link, complete-link agglomerative clustering, and centroid techniques to cluster these examples. Show your calculations and draw the dendrograms for each technique.
For the arithmetic progression a1, a2, a3 .......... if a4/a7 = 2/3. Find a6/a8 ?
For the arithmetic progression a1, a2, a3 .......... if a4/a7 = 2/3. Find a6/a8 ?
The Lucas numbers are very similar to the Fibonacci numbers and are defined by a1=2, a2=1,...
The Lucas numbers are very similar to the Fibonacci numbers and are defined by a1=2, a2=1, and an+2=an+1+an. So the first five are 2, 1, 3, 4, 7 and it continues in that fashion. Give the next 4 Lucas numbers
Alternating Series Test. Let (an) be a sequence satisfying (i) a1 ≥ a2 ≥ a3 ≥...
Alternating Series Test. Let (an) be a sequence satisfying (i) a1 ≥ a2 ≥ a3 ≥ · · · ≥ an ≥ an+1 ≥ · · · and (ii) (an) → 0. Show that then the alternating series X∞ n=1 (−1)n+1an converges using the following two different approaches. (a) Show that the sequence (sn) of partial sums, sn = a1 − a2 + a3 − · · · ± an is a Cauchy sequence Alternating Series Test. Let (an) be...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT