Question

Helloo Who can help with this problem Consider the following DLX assembler program: start: LW R1,...

Helloo Who can help with this problem

Consider the following DLX assembler program:
start: LW R1, 2020 (R0)
ADD R2, R0, R0
ADD R5, R0, R0
loop: LW R3, 1000 (R2)
ADDI R2, R2, # 4
SEQ R4, R1, R3
BEQZ R4, loop2
ADDI R5, R5, # 1
loop2: SEQI R4, R2, # 1000
BEQZ R4, loop
end: SW 2000 (R0), R5
STOP


Give in a short sentence what the program calculates
And do not forget to comment each line

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

start: LW R1, 2020 (R0)            @ Load value stored at 2020 mem locations away from value in R0
ADD R2, R0, R0                       @ Store in R2 twice of R0
ADD R5, R0, R0                       @ Store the same value in R5
loop: LW R3, 1000 (R2)               @ Mark this stateent as loop, load value stored 1000 mem location away from R2 in R3
ADDI R2, R2, # 4                   @ Add 4 to R2
SEQ R4, R1, R3                       @ If value in R1 and R3 are equal, set R4 to 1 else unset to 0
BEQZ R4, loop2                       @ If R4 is 0, go to loop2 statement, else continue from below statement.
ADDI R5, R5, # 1                   @ Increment R5 by 5 units.
loop2: SEQI R4, R2, # 1000           @ if R2 equals 1000, set R4 to 1 else unset to 0, statemenet marked at loop2
BEQZ R4, loop                        @ If R4 is equal to 0, branch to loop statement
end: SW 2000 (R0), R5               @ Store value in R5 to 2000 location away from value in R0
STOP                               @ End execution

This program increases R2 in every literation of loop, until R2 becomes 1000. In every iteration, R2 is incremented by 4 units. R3 is the value stored at 1000 units away from R2 value (which changes in each iteration). In every iteration, it also checks is R1 is equal to R3.. If it is, it increments R5 by 1. So basically if increments R5 when R1 matches R3., until R2 reaches 1000.

Hope the execution flow is clear now.

Add a comment
Know the answer?
Add Answer to:
Helloo Who can help with this problem Consider the following DLX assembler program: start: LW R1,...
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
  • The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem....

    The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: • The architecture fully supports forwarding, • Register write is done in the first half of the clock cycle; register read is performed in the second half of the clock cycle, • Branches are resolved in the third stage of the pipeline and the architecture does not utilize any branch prediction mechanism, • Register R4 is initially 200. L1: lw lw...

  • help Question 11 The classic five-stage pipeline MIPS architecture is used to execute the code fragments...

    help Question 11 The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: • The architecture fully supports forwarding, • Register write is done in the first half of the clock cycle; register read is performed in the second half of the clock cycle, • Branches are resolved in the third stage of the pipeline and the architecture does not utilize any branch prediction mechanism, • Register R4 is initially 200....

  • The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem....

    The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: The architecture fully supports forwarding, Register write is done in the first half of the clock cycle; register read is performed in the second half of the clock cycle, Branches are resolved in the third stage of the pipeline and the architecture does not utilize any branch prediction mechanism, Register R4 is initially 100. L1:  lw    R1, 0(R4)   add   R3, R1, R2 sw   ...

  • Problem 5 (15pts): Describe what the following program is doing (Do not need to explain each line of instruction....

    Problem 5 (15pts): Describe what the following program is doing (Do not need to explain each line of instruction. Just show me the purpose of this code). .equ LEDS, Ox100000 10 # define LEDS Ox10000010 .text global start #base address of LEDS on DEO-Nano start: movia r2, LEDS movi r3, 0b00000001 movi r4, OX7FFF slli r4, r4, 3 add r4, r4, r4 load: movi r5, 0b10000000 loop: stw rs, o(r2) mov r6, ro count: addi r6, r6, 1 bne r6,...

  • 12 po Iw add Question 11 The dassic five-stage pipeline MIPS architecture is used to execute...

    12 po Iw add Question 11 The dassic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: • The architecture fully supports forwarding • Register write is done in the first half of the clock cycles register read is performed in the second half of the clock cyde. Branches are resolved in the third stage of the pipeline and the architecture does not utilize any branch prediction mechanism Register R4 is initially...

  • The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem....

    The classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: • The architecture fully supports forwarding, • Register write is done in the first half of the clock cycle; register read is performed in the second half of the clock cycle, • Branches are resolved in the third stage of the pipeline and the architecture does not utilize any branch prediction mechanism, • Register R4 is initially 100. L1: lw add...

  • he classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem....

    he classic five-stage pipeline MIPS architecture is used to execute the code fragments in this problem. Assume the followings: The architecture fully supports forwarding, • Register write is done in the first half of the clock cycle; register read is performed in the second half of the clock cycle, • Branches are resolved in the third stage of the pipeline and the architecture does not utilize any branch prediction mechanism, • Register R4 is initially 100. Ll: lw add SW...

  • 5. Consider the SPIM code below. globl main .text main: ori $t1, $0, 10 ori $t2,...

    5. Consider the SPIM code below. globl main .text main: ori $t1, $0, 10 ori $t2, $0, 11 add $t3, $t1,$t2 move $t4, $t3 The following image shows a screen shot of QtSPIM page when this program is loaded, and executed in step-by step fashion. Current instruction is highlighted. Data Text x Text Regs Int Regs [16] Int Regs [16] PC = 400028 EPC 0 Cause = 0 BadAddr = 0 Status = 3000ff10 HI LO = 0 = 0...

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