Question

Assembly Machine Programming/Coding

Why are the values in $7 different from $6? addi $8, $0, -3 addi $9, $0, 8 slt $7, $8, $9 sltu $6, $8, $9 mult $8,99 Whats t

0 0
Add a comment Improve this question Transcribed image text
Answer #1

A. Slt is nothing but set if less than instruction(signed).

slt $d, $s, $t

If ($s < $t) $d =1 else $d =0

Whereas sltu also does the same operation but It treats the values as unsigned.

In the given example $8= -3( 11111101)and $9=8(00001000)

as -3<8 , $7 =1

In sltu, comparison will be

11111101(253 in decimal) is not less than 8, hence $6 is not set.

This is the difference between the two instructions slt and sltu

B. Mult  instruction operates on signed numbers and multu operates on unsigned numbers.

During multiplication whether it is signed or unsigned, the lower 32 bits of src1 * src2 is stored in lo register and upper 32 bits of src1 * src2 is stored in hi register.

The difference between signed and unsigned multiplication is overflow, the lo(lower 32 bits of result)  part will remain same. But the hi part(upper 32 bits of result) will vary in such a way, with signed multiplication, the negative result is sign extended. But in unsigned multiplication negative result is not sign extended.

Thus in the above instructions,

mult $8, $9 is a signed multiplication, the lower 32 bits of this multiplication result is copied to register $10 and upper 32 bits are copied to register $11.

multu $8, $9 is an unsigned multiplication, the lower 32 bits of this multiplication result is copied to register $12 and upper 32 bits are copied to register $13.

As stated above the the lower 32 bits of the results will be same for both signed and unsigned multiplication. Thus registers $10 and $12 will hold the same values after execution of the instructions. Whereas the registers $r11 and $r13 will have different values based on sign extension on negative value of result as stated above.

Add a comment
Know the answer?
Add Answer to:
Assembly Machine Programming/Coding Why are the values in $7 different from $6? addi $8, $0, -3...
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. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • A computer scientist is investigating the usefulness of two different design languages in improving programming tasks....

    A computer scientist is investigating the usefulness of two different design languages in improving programming tasks. Twelve expert programmers, familiar with both languages, are asked to code a standard function in both languages, and the time in minutes) is recorded. The data follow: Time Design Language 1 Design Language 2 17 18 - 2 3 14 20 5 6 - - 16 21 13 18 24 16 14 21 23 13 18 - - 8 9 10 11 12 15...

  • 2 3 S1 0 1 0 114 4 13 1 0 15 7 2 4 1...

    2 3 S1 0 1 0 114 4 13 1 0 15 7 2 4 1 14 3|15 12 8 4 5 6 7 8 9 10 11 12 13 14 15 1 2 15 11 8 3 10 6 12 5 9 0 7 4 14 2 13 1 10 6 12 11 9 5 3 8 8 13 6 2 11 15 12 9 7 3 10 5 0 2 4 9 1 7 5 11 0 6...

  • Sucrose Levels Data: Tube # 1 2 3 4 5 6 7 8 9 `0 11...

    Sucrose Levels Data: Tube # 1 2 3 4 5 6 7 8 9 `0 11 Water (mL) 1.0 0.75 0.5 0.25 Glucose Std. (mL) 0.25 0.5 0.75 1.0 Sucrose Std. (mL) 1.0 1.0 CONC. Extract (mL) 1.0 1.0 Diluted Extract (mL) 1.0 1.0 Buffer (mL) 1.0 1.0 1.0 1.0 1.0 1.0 1.0 1.0 TUBE VS ABSORBANCES: 1 blank 2 .071 3 .535 4 .551 5 .042 6 0 7 .306 8 .056 9 1.999 10 .025 11 .35 A)...

  • Consider the following tasks that must be assigned to four workers on a conveyor--paced assembly line (i.e., a machine--...

    Consider the following tasks that must be assigned to four workers on a conveyor--paced assembly line (i.e., a machine--‐paced line flow). Each worker must perform at least one task. Time to Complete Task (seconds): Task 1: 26 Task 2: 25 Task 3: 15 Task 4: 24 Task 5: 15 Task 6: 20 Task 7: 47 Task 8: 15 Task 9: 20 Task 10:25 Task 11: 15 Task 12: 20 The current conveyor--paced assembly-‐line configuration assigns the workers in the following...

  • $1 $0 0 1 2 3 7 9 10 S 6 Quantity of Hats The graph...

    $1 $0 0 1 2 3 7 9 10 S 6 Quantity of Hats The graph above show information about costs and revenue for a small hat factory in a perfectly competitive market. How much profit does the hat factory make? $16 $8 $12 O $10 Previous Page Next Pace Page 13 of 34 Sub Que of 35 questions Question 13 (1 point) $14 $13 $12 MC $11 MR $10 $9 ATC Price of Hats $8 5 $7 AVC $6...

  • Question 11 6 pts Consider the following sample values: 1, 4, 5, 6, 6, 7, 8,...

    Question 11 6 pts Consider the following sample values: 1, 4, 5, 6, 6, 7, 8, 10, 11, 12 What is the sample standard deviation? 1.06 3.37 None of the others. 11.33

  • Programming Langaue(Python 3) Define a function deal that will shuffle and distribute the 52 playing cards...

    Programming Langaue(Python 3) Define a function deal that will shuffle and distribute the 52 playing cards evenly to two players (26 each) and return a tuple of each player's hand (as a list of values). The function does not need to take in any arguments, and should create the deck of values internally (i.e., you should not need to input the deck of values into the function; you may reuse the statement you developed for part 6.1). You may assume...

  • C programming! Write a program that reads integers until 0 and prints the sum of values...

    C programming! Write a program that reads integers until 0 and prints the sum of values on odd positions minus the sum of values on even positions. Let ?1, ?2, … , ??, 0 be the input sequence. Then the program prints the value of ?1 − ?2 + ?3 − ?4 + ⋯ ??. The input is a sequence of integers that always contains at least 0 and the output will be a single number. For example, for input...

  • Accumulation Pattern Problem 2 Consider the code below. 1 2 3 4 5 6 7 8...

    Accumulation Pattern Problem 2 Consider the code below. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 labs = ['lab1', 'lab2', 'lab3', 'lab4', 'lab5', 'lab6', 'lab7', 'lab8', 'lab9'] graded = '' for lab in labs:     lab_num = int(lab[3])     if lab_num < 4:         graded = graded + lab + ' is simple\n'     elif lab_num < 7:         graded = graded + lab + ' is ok\n'     else:         graded = graded + lab + ' is complex\n'         ...

  • Python Question: In [76]: arr3d = np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10,...

    Python Question: In [76]: arr3d = np.array([[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]) In [77]: arr3d Out[77]: array([[[ 1, 2, 3], [ 4, 5, 6]], [[ 7, 8, 9], [10, 11, 12]]]) In [78]: arr3d[0] Out[78]: array([[1, 2, 3], [4, 5, 6]]) Can someone tell me why arr3d[0] is a  2 × 3 array?

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT