Question

1. Read the following set of instructions, and answer questions. add r5, r2, r1 lw r3,...

1. Read the following set of instructions, and answer questions.

add r5, r2, r1

lw r3, 4(r5)

or r3 , r5, r3

sw r3 , 0(r5)

add r2, r5, r1

b. Assume there are no forwarding, show the result in multiple-cycle diagram.

Homework Answers

Answer #1

Answer -

1. Read the following set of instructions, and answer questions.

add r5, r2, r1 -> add the value of r5 and r2 in r1.

lw r3, 4(r5) -> load the value of r3 to r5.

or r3 , r5, r3 -> organize the value of r3 and r2 in r3.

sw r3 , 0(r5) -> (sw instruction stores a word from a register into memory) store the value of r3 to r5.

add r2, r5, r1 -> add the value of r2 and r5 in r1.

b) multiple-cycle diagram

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
(20pts each) Read the following set of instructions, and answer questions. add     r5, r2, r1 lw...
(20pts each) Read the following set of instructions, and answer questions. add     r5, r2, r1 lw      r3, 4(r5) or      r3, r5, r3 sw      r3, 0(r5) add     r2, r5, r1 Assume there are no forwarding, try reorganize the order of these instructions such that these 5 instructions can be finished sooner. Insert stall cycles only when reordering does not help. Note that reordering instructions should not cause any incorrect value being write into registers. Show the reordered 5...
(20 pts each) Read the following set of instructions, and answer questions. or r1, r2, r3...
(20 pts each) Read the following set of instructions, and answer questions. or r1, r2, r3 or r2, r1, r4 or r1, r1, r2 Assume the following cycle times for each of the options related to forwarding: Without forwarding With full forwarding With only ALU-ALU forwarding 250ps 300ps 290ps ALU-ALU forward means there is only data forward from EX/MEM to ID/EX (which is from the output of the ALU to the input of the ALU), and no data forwarding from...
The following code runs on a microprocessor with five pipelined stages. In the code lw is...
The following code runs on a microprocessor with five pipelined stages. In the code lw is a load word and sw is a store word. The register on the far right is the target register for lw and add and source for sw. The memory latency is 2 cycles. lw 0(r1),r2 label1:    beq r2,r0,label2 # not taken once, then taken lw 0(r2),r3 beq r3,r0,label1 # taken add r1,r3,r1 label2: sw 0(r2),r1 Identify all the possible hazards that may exist in...
Consider a program having following sequence of instructions, where the syntax consists of an opcode followed...
Consider a program having following sequence of instructions, where the syntax consists of an opcode followed by the destination register followed by one or two source registers: Instruction no Instructions 1 ADD R3, R1, R2 2 LOAD R6, [R3] 3 AND R7, R5, 3 4 ADD R1, R6, R0 5 SUB R2, R1, R6 6 AND R3, R7, 15 7 SUB R5, R3, R4 8 ADD R0, R1, R10 9 LOAD R6, [R5] 10 SRL R7, R0, 8 Assume the...
Consider the following MIPS code and a 5 stages processor as discussed in class, and assume...
Consider the following MIPS code and a 5 stages processor as discussed in class, and assume the loop executes 3 times: loop: lw r1,4(r7) lw r2,8(r7) lw r3,12(r7) add r1,r1, r3 sw r1,4(r7) bne r1,r2,loop addi r1,r1,42 c. Draw the execution diagram. (10 points) d. The CPI (cycles per instruction) is obtained by computing the ratio of total cycles to number of instructions. Compute the CPI for the for the pipeline on this code. (5 points)
Given the following sequential list of VEX operations: A. add $r3 = $r1, $r2 B. sub...
Given the following sequential list of VEX operations: A. add $r3 = $r1, $r2 B. sub $r8 = $r1, $r3 C. sub $r7 = $r1, 2 D. add $r1 = $r1, 1 E. mpy $r6 = $r3, $r2 Which VEX operations can be scheduled simultaneously to make up the second VLIW instruction? The constructed schedule should satisfy the following conditions: Assume infinite resources and no limit to the number of operations scheduled to a single instruction. Operations that are scheduled...
Consider these relations on the set of integers R1 = { (a,b) | a < b...
Consider these relations on the set of integers R1 = { (a,b) | a < b or a ≥ b} R2 = { (a,b) | a + b < 5 } R3 = { (a,b) | a <= b } R4 = { (a,b) | a = b +3 } R5 = { (a,b) | a < b - 1 } R6 = { (a,b) | a + 2 > b } Choose following pairs that fit at least four...
III. After execution of the following instructions what value will be in register r0? LDR                ...
III. After execution of the following instructions what value will be in register r0? LDR                 r12, =0xA4000000 LDR                 r0, =0x75 LDR                 r1, =0xD2 LDR                 r2, =0x9C LDR                 r5, =0xC STMDB           r12!, {r0-r2, r5} LDR                 r0, [r12, #8] SUB                 r0, #0x77 IV. Assume that the variables f, g, h, i, and j are assigned to registers r0, r1, r2, r3, and r4, respectively. Assume that the base address of the arrays A and...
I. What value will be in register r2 after execution of the following instructions? Show your...
I. What value will be in register r2 after execution of the following instructions? Show your work with the register values after executing each instruction. MOV r2, #0x0 LDR r1, =0xCF MOVS r1, r1, LSR #1 ADC r2, r2, #0 MOVS r1, r1, LSR #1 ADC r2, r2, #0 II. Assume a 32 bit register holds a data of four bytes as B3B2B1B0. Write a sequence of ARM instruction that takes this data as input and swaps the bytes 0...
Suppose a MIPS processor uses the simple 5-stage pipeline described in the text, where the stages...
Suppose a MIPS processor uses the simple 5-stage pipeline described in the text, where the stages are instruction fetch, instruction decode and operand fetch, execute and calculate address, memory access, and register write. Suppose further that • There is a single memory for both instruction and data, which can only support one read or write each cycle. • There is no “forwarding” in the pipeline. Thus, if an instruction B relies on a value written into a register by an...