Question

Implement the following pseudocode in a MIPS assembly program. if ($t1 < $t2) { $t6 =...

Implement the following pseudocode in a MIPS assembly program.

if ($t1 < $t2) {

$t6 = $t2

}

else {

$t6 = $t1

}

$t6 = $t6 + 1

Homework Answers

Answer #1

ANSWER:

I have provided the properly commented code in both text and image format so you can easily copy the code as well as check for correct indentation.
Have a nice and healthy day!!

CODE TEXT

main: #code
    # if t1< t2 go to IF
    blt $t1, $t2, IF

    # otherwise
    # store $t1 to $t6
    move $t6, $t1
    
    # now move to End part
    End

IF:
    # store $t2 to $t6
    move $t6, $t2
    # now move to End part
    End

End:
    # add 1 to $t6
    addi $t6, $t6, 1
    
    

CODE IMAGE

Know the answer?
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
Similar Questions
Write and test code in MIPS assembly language program to implement algorithms "The Non-Restoring Algorithm "of...
Write and test code in MIPS assembly language program to implement algorithms "The Non-Restoring Algorithm "of an 8-bit integer the user shoud insert the number then by the algo well find the square root
(MIPS Assembly Language): Assume the following piece of MIPS code: label1: .text 0x4000fc lui $t0, 1022...
(MIPS Assembly Language): Assume the following piece of MIPS code: label1: .text 0x4000fc lui $t0, 1022 ori $t0, $t0, 2048 srl $t1, $t0, 18 sw $t0, 101($t1) slti $t2, $t1, 5 beq $t2, $0, label3 label2:... ... label3:... a) The code modifies a word in memory at the following address (circle one): (i) 1022 (ii) 101 (iii) 5 (iv) 10220000 (v) Other (provide your own answer): _________________ b) The following value is stored in memory (circle one): (i) 0x17 (ii)...
Write an assembly language program that will implement the following: If ( (AX >=BX) || (CX...
Write an assembly language program that will implement the following: If ( (AX >=BX) || (CX < DX) ) goto LoopA Else go to LoopB..
Write an assembly language program that will implement the following:       If ( (AX >=BX) AND (CX...
Write an assembly language program that will implement the following:       If ( (AX >=BX) AND (CX < DX) ) goto LoopA Else go to LoopB (Here I want you to write the whole assembly program that could run in CMD. THANK YOU
Consider the following MIPS assembly instructions: andi $s0, $t1, 65 a) What will be the machine...
Consider the following MIPS assembly instructions: andi $s0, $t1, 65 a) What will be the machine code for the assembler instruction? Justify the answer and state it in hexadecimal form. b) In which building blocks in the processor are the pieces in the machine code for the assembler instruction above used?
This is a homework assignment for Computer Architecture and some question use MIPS Assembly language. 1.    ...
This is a homework assignment for Computer Architecture and some question use MIPS Assembly language. 1.     In the following MIPS assembly code, translate all the instructions to their corresponding machine code in hexadecimal format. This code is stored in the memory from address 0x1fff0000. Loop: sw $t1, 4($s0)        addi $t1, $t1, -1    sll $t1, $t1, 2        bne $t1, $s5, Exit    addi $s0, $s0, 4          j Loop Exit: … 2.     Find the MIPS...
write a MIPS assembly program to get an integer input from the user and multiply it...
write a MIPS assembly program to get an integer input from the user and multiply it by 2 and print output to the console
The following multi-threaded program uses 3 concurrent threads (T0, T1, and T2). The threads are synchronized...
The following multi-threaded program uses 3 concurrent threads (T0, T1, and T2). The threads are synchronized by 3 semaphores (S0, S1, S2). What is the maximum number of times '0' will be printed by thread T0? // Global to all threads Semaphore S0(1), S1(0), S2(0) Thread T0 While (true) S0.wait() print( '0' ) S1.signal() S2.signal() endWhile Thread T1 S1.wait() S0.signal() Thread T2 S2.wait() S0.signal()

Question 1. Answer the following questions on MIPS Instruction Set. a) Show the minimal sequence of...
Question 1. Answer the following questions on MIPS Instruction Set. a) Show the minimal sequence of MIPS instruction for the following pseudocode segment: A[3] = A[10] + B; Assume that B corresponds to register $t3 and the array A has a base address of 1000C41016 which is required to be loaded to register $t0 in your code. Provide comments for each line of your MIPS instruction. b) Assume that Loop starts at memory location 0xC010. Provide a) instruction format of...
Write a mips assembly language program that asks the user to enter and integer number and...
Write a mips assembly language program that asks the user to enter and integer number and read it. Then ask him to enter a bit position (between 0 and 31) and display the value of that bit.