Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 . 2 Complete the timeline of the program assuming that you have an always - taken branch predictor. Assume that the branch prediction happens

1.2 Complete the timeline of the program assuming that you have an always-taken branch predictor. Assume that the branch prediction happens
within the ID stage, and the full branch outcome is available in the EX stage. For conciseness, use F/D/E/M/W for IF/ID/EX/MEM/WB stages in the
table. Also use "N" for NOP. In empty rows, add proper instructions from the assembly program and complete the table. Show mispredicted
instructions as well in the table; you need to invalidate those instructions at the right time. (60 pts)Consider the code snippet given below:
addi x14, x0,3
addi x15, x0,0
addi x12, x0,0
LOOP:
lw x10,0(x13)
lw x11,4(x13)
add x16, x10, x11
add x12, x16, x12
addi x13, x13,16
addi x15, x15,1
blt x15, x14, LOOP
* Abbreviations
- IF: Instruction fetch stage
- ID: Instruction decode / register file read stage
- EX: execution
- MEM: Data memory access
- WB: Write back to the register file
- NOP: No operation; a bubble
* Key assumptions
- The write-back data in the WB stage is available in the decode stage at the same cycle.
- The processor has forwarding links for data hazard resolution (EX -> ID and MEM -> ID)
- Forwarded data from the execution/memory stage is visible to the decode stage at the same cycle (i.e., if an instruction receives a forwarded data from EX/MEM stage, align the ID stage of the next instruction with the EX/MEM stage of the previous instruction)
- The processor has a branch predictor (each problem will specify which predictor we have) and a branch target buffer (BTB).
- We need to compute the full branch outcome at least once to have the target address in the branch target buffer.
- When "NOP" exists in a pipeline stage, the next instruction cannot complete the previous stage. For example, in the timeline given below, instruction B cannot start IF until the NOP in ID stage of instruction A is removed. Likewise, Instruction C needs to wait until the NOP in the ID stage caused by instruction B is removed (that's why IF for instruction C started at cycle 6, not 5).
1.1 Write a C code that performs the same job as the given assembly program.
The assembly program implements the highlighted part in the following C code
snippet. (20 pts)
(hint: the program includes a loop)
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

P (1.46 Answered: 1 week ago

Answered: 1 week ago