Question

MIPS assembler language Generate an instruction sequence that will result in an arithmetic overflow. Do not...

MIPS assembler language

Generate an instruction sequence that will result in an arithmetic overflow. Do not use a loop, but rather create a specific code sequence.

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

Solution:----------

MIPS integers are 32-bit, and since you'll be using signed integers, the maximum value is 231-1 ( 2147483647 or hex 7FFFFFFF). Thus any addition which results in a number larger than this should throw an exception, e.g if you try to add 1 to 2147483647:

# Load 2147483647 into $s1
LUI $s0, 32767
ORI $s1, $s0, 65535

# Add 1 to $s1 and store in $s2. This should produce an arithmetic overflow .
ADDI $s2, $s1, 1

Add a comment
Know the answer?
Add Answer to:
MIPS assembler language Generate an instruction sequence that will result in an arithmetic overflow. Do not...
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
  • (Computer Engineering) Convert the following pseudo-code to MIPS assembler instructions. Include the code and the final...

    (Computer Engineering) Convert the following pseudo-code to MIPS assembler instructions. Include the code and the final value of the $t0 register. Set register $t1 = 4 Set register $t2 = 16 Put the result of the following arithmetic sequence into register $t0 $t1 + $t2 + 5 = $t0

  • (Computer Engineering) Convert the following pseudo-code to MIPS assembler instructions. Include the code and the final...

    (Computer Engineering) Convert the following pseudo-code to MIPS assembler instructions. Include the code and the final value of the $t0 register. Set register $t1 = - 8 (negative 8) Set register $t2 = 0x30 Put the result of the following arithmetic sequence into register $t0 $t2 - $t1 - 4 = $t0

  • Write a sequence of MIPS instructions to do the following: set $t1 to 1 if the...

    Write a sequence of MIPS instructions to do the following: set $t1 to 1 if the contents of $s0 is an even number and set $t1 to 0 otherwise. Please do not use the division instruction in you code. Instead, you could use some logical instruction to test if a number is even or odd.       

  • B2. Translate the following MIPS assembly instruction into machine language: lw $t8, 100($s0) B3 ...

    B2. Translate the following MIPS assembly instruction into machine language: lw $t8, 100($s0) B3 Write MIPS assembly code segment for the following C code snippet: for (i - O i < 10i i++) i array[i+l] - array [i8; Register assignment: i-> Şa0 Base of array -> $s0 B2. Translate the following MIPS assembly instruction into machine language: lw $t8, 100($s0) B3 Write MIPS assembly code segment for the following C code snippet: for (i - O i Şa0 Base of...

  • 1. The MIPS instruction set includes several shift instructions. They include logical-shift-left ...

    1. The MIPS instruction set includes several shift instructions. They include logical-shift-left (sll), logical-shift-right (srl), and arithmetic-shift-right (sra). [2 +2 4 points] a) Why does not MIPS offer an "arithmetic-shift-left (sla)" instruction? b) Write a MIPS code to implement the logical-shift-left (sll) instruction for a machine that did not have this particular instruction? In other words, you have to write the equivalent of the sll instruction using mul, add and other instructions. Try writing the equivalent of sll Ss1, Ss2,...

  • Name B. (7 pts) MIPS short answer 1. (3pt) For the following MIPS assembly language program:...

    Name B. (7 pts) MIPS short answer 1. (3pt) For the following MIPS assembly language program: loop: addi Sto, $to,-1 bne $to, $zero, loop Translate the second instruction into MIPS machine language and write it in hex. 2. (2 pt) Which best describes the reason that we maintain the stack pointer in a register? (circle one) i. The hardware forces use of a stack pointer. ii. We need a local pointer because we are often limited to relative addressing. ili....

  • Question 3 (10 points) Convert the following MIPS assembly code into machine language. Write the instruction...

    Question 3 (10 points) Convert the following MIPS assembly code into machine language. Write the instruction in hexadecimal. The opcode for sw 43 (101011). sw St1, -4(St3) Question 4 (10 points) Consider the following MIPS assembly code: addi $s3, $0, 5 addi $s1, S0, 3 addi Ss1, $s1, 2 beq Ss3, Ssl, target addi Ss1, Ss1, 1 target: add Ss3, Ss1, Ssl a. After running the code, what is the value of Ss3? b. If the memory address of the...

  • MIPS Programming Assignment 4 (logical operations) Please write a complete MIPS assembly language programs for the...

    MIPS Programming Assignment 4 (logical operations) Please write a complete MIPS assembly language programs for the following questions and print a hardcopy of your code to submit 1. Swap each pair of elements in the string "chararn be an even number of characters in "chararray". (see loop4.a) 2 "numbers" is an array of five words. Catculate the sum of aftetements in "number muttiples of 4. Use the and instruction, not div or remfor thisquestion(S 3. "number" is a word. Write...

  • MIPS coding

    Write a MIPS assembler language program to reverse the order of the bottom 16 bits of register $a0. At the start of your program you should load the initial bit pattern into $a0. The answer should be stored into $v0. Finish your program with an infinite loop (a jump instruction that jumps to itself).  For example:             $a0 = 00000011100000001111000000000001 in binary,   Reversing the order of the bottom 16 bits gives (modified bits are underlined):                                                  $v0 = 00000011100000001000000000001111 in binary   Here is...

  • Write one equivalent MIPS assembly language for the HLL code: E = F -10 when the compiler associates E with register $s6 and F with register $s7. (Hint: Remember that there is no SUBI instruction in M...

    Write one equivalent MIPS assembly language for the HLL code: E = F -10 when the compiler associates E with register $s6 and F with register $s7. (Hint: Remember that there is no SUBI instruction in MIPS)

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