Question



Usc only the following MIPS instructions for assignment questions 3, 4 and 5: add, sub, addi, j, beq, bne, lw, sw. You may no

4. (4 pts) Write a MIPS program starting at address 20 that writes a value of 488 to register $7. Next, you will test if regi
Usc only the following MIPS instructions for assignment questions 3, 4 and 5: add, sub, addi, j, beq, bne, lw, sw. You may not need as many lines as we provide space for
4. (4 pts) Write a MIPS program starting at address 20 that writes a value of 488 to register $7. Next, you will test if register $10 is equal to register $7. If the values are equal, continue execution at address 48; otherwise set the value in register $7 to $10 $21 (contents of register $10 subtract contents of register $21). Following these steps your program should continue execution at address 228. You should use both a branch type instruction (beq or bne) and one jump) instruction. 20 24 28 32 36
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Ainswer loads Register 7 with 48 , 488 > branch ( jump) to 48 beg 24 7, I0) 40 > else 7 = t0-2 SUB 28 J to 3 2 jomps 228 Proq

Add a comment
Know the answer?
Add Answer to:
Usc only the following MIPS instructions for assignment questions 3, 4 and 5: add, sub, addi,...
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
  • You may not need as many lines 5: add, sub, addi, j, beq, bne, lw, sw. as we provide space for (4 pts) Write a MI...

    You may not need as many lines 5: add, sub, addi, j, beq, bne, lw, sw. as we provide space for (4 pts) Write a MIPS program starting at address 20 that writes a value of 488 to register $7. Next, you will test if register $10 is equal to register $7. If the values are equal, continue execution at address 48; otherwise set the value in register $7 to $10 $21 (contents of register $10 subtract contents of register...

  • 1. Given the following instruction sequence for the MIPS processor with the standard 5 stage pipeline $10, S0. 4 addi lw S2.0(S10) add sw S2,4(510) $2, $2, $2 Show the data dependences between th...

    1. Given the following instruction sequence for the MIPS processor with the standard 5 stage pipeline $10, S0. 4 addi lw S2.0(S10) add sw S2,4(510) $2, $2, $2 Show the data dependences between the instructions above by drawing arrows between dependent instructions (only show true/data dependencies). a. Assuming forwarding support, in what cycle would the store instruction write back to memory? Show the cycle by cycle execution of the instructions as they execute in the pipeline. Also, show any stalls...

  • Consider the following MIPS assembly language instructions: addi $1, $2, 100 swr $1, 0($2): addi $rt,...

    Consider the following MIPS assembly language instructions: addi $1, $2, 100 swr $1, 0($2): addi $rt, $rs, immediate # add immediate swr $rt, immedi ate ($rs) # store word write register These instructions are I-format instructions similar to the load word and store word instructions. The addi and swr instructions store a computed value to the destina- tion register $rt. The instructions do not require any physical hardware changes to the datapath. The effect of each instruction is given below....

  • Consider the following MIPS code: add $t3,$t2,$t1 lw $t4,0($t3) sw $t7,0($t3) add $t6,$t2,$t8 addi $t3,$t5,4 (a)...

    Consider the following MIPS code: add $t3,$t2,$t1 lw $t4,0($t3) sw $t7,0($t3) add $t6,$t2,$t8 addi $t3,$t5,4 (a) Draw a general pipeline diagram from CC1 to CC5 (b) Can you identify the type of hazard in pipeline for executing the code? (c) What is the solution to the hazard? If NOP (noop or bubbles) have to be inserted to avoid hazard, where will you put them? (d) Put the code into the MIPS simulator and observe your findings. You may want to...

  • Edit: Not sure what more information you need. Write a MIPS assembly program to determine the...

    Edit: Not sure what more information you need. Write a MIPS assembly program to determine the range between pairs of numbers. Keep things very basic with instructions such as load (lw), store (sw), add (addi and add), subtract (sub), multiplication (mul), branch (beq and bne), jump (j), and set on less than (slt) instructions. Your program should meet the following functional requirements: Input: an arbitrary number of integer pairs (in all pairs, the first number will be the max value)...

  • Assume the MIPS instruction subset is redefinied to contain only the following instructions: 1. Assume that...

    Assume the MIPS instruction subset is redefinied to contain only the following instructions: 1. Assume that our MIPS instruction subset is redefined to contain only the following instructions: Instruction Instruction fetch Register read & ALU operation Data Memory Register write decode 0 ns R-format 2ns 1 ns lw ns l ns 2 ns 5 ns 1 ns ns 1 ns ns 0 0 bne The table lists the times required for each step within each instruction. Recall that with the...

  • The following MIPS program is to be run on a MIPS pipeline processor of 5 stages...

    The following MIPS program is to be run on a MIPS pipeline processor of 5 stages (IF-ID-EX-MEM-WB). Work out and diagram the optimal pipeline schedule using full forwarding from EX or MEM stages to any other stage, Draw the pipeline execution diagram for this code and then compute the pipeline CPI: addi $t6, $t6, 10 sub $t5, $t6, $t4 srl $t5, $t5, 2 sw $t5, 20($t5) lw $t2, 0($t6) add $t7, $t2, $t3 beq $t5, $t7, End

  • 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...

  • Here is an assembled function in MIPS addi $sp, $sp, 4 Sw Li 1i L1 Li...

    Here is an assembled function in MIPS addi $sp, $sp, 4 Sw Li 1i L1 Li 0xe04800b8 ex23bdfffc addi $29, $29,exffff... 75: 0x084000bc exafb10000 sw $17,8x8000e000($29) 76: 0xe04000ce ex24020000 addiu $2,$0,0x00000000 78: 0x004000c4 0x24030000 addiu $3, $8,0x00000000 79: 0x004000c8 ex240a0020 addiu $18, s0,8xeeee... 80: 0x004000cc 8x240b000a addiu $11,s0,8x0000... 81: 0x884800de ex90910000 lbu $17,0x000e0000($4) 83: 0x004000d4 0x28840001 add1 $4,$4,0x80000001 84: 0x004008d8 8x122b0004 beq $17,$11,8x00000004 85: 0x004000dc 8x20420001 addi $2,$2,8x80000001 86: 0x804000e0 8x162afffb bne $17,$10,8xfffffffb 87: 0x004008e4 8x20630001 addi $3,$3,8x00000001 88: 0x004000e8...

  • 4. List the values on the control signals for the following instructions. The MIPS architecture and...

    4. List the values on the control signals for the following instructions. The MIPS architecture and instruction formats studied in class are shown below for reference. Your answer needs to be 1, 0, or X for each signal (a 0 or 1 will not be accepted as a substitute for X) MemtoReg MemWriteBranchALUSrc RegDst RegWrite sub r2, r5, r23 beq rl, r3, L2 sw rl, 36(r4) lw r3,100(r6) addi r2,rl4,-24 j L3 ontro Unit Write ranch PCSrc Op Funct LUSre...

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