Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are given the following C code, which is executed on a RISC - V processors with a 5 - stage pipeline, including support for
You are given the following C code, which is executed on a RISCV processors with a stage pipeline, including support for forwarding and hazard detection.
for i; i; i
for j;j; j
aij bji;
bne instruction at the end of loop body
The following questions concern the branch instruction at the end of the innermost loop's body. If the pipeline resolves branches in the decode ID stage, meaning it does the branch target address calculation and the branch comparison in the ID stage, how many stall cycles will this code have because of the innermost loop's branch instruction? If the pipeline:
has a twobit branch predictor, as shown in the figure below, and,
both the branch outcome and the target of the branch are predicted in the IF stage, and,
the branch predictor resolves the actual branch target address and takennot taken direction in the ID stage, and,
the branch predictor does not know the target address of the branch until the branch is executed for the first time, and,
the branch predictor state is initialized to predict taken;
How many stall cycles will this code incur because of branches?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started