The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+1 vote
add \$so,\$to,\$t1

sub \$t2,\$S0,\$t3  

Num of stall cyles i am getting 2 stall but the books says 3

1.No data data forwarding

2.Write to register file in first half and read from second half in clock cycle  my timing dig goes like this

add  IF ID EX MEM WB     



                            IF ID  EXE .....
asked in CO & Architecture by (245 points)
retagged by | 472 views

1 Answer

0 votes

This will be the timing diagram. Three stall cycles are needed to ensure WB is completed before the ID stage of the SUB instruction. This assumes Register File read is performed during the ID stage of the pipeline.

  Clk1 Clk2 Clk3 Clk4 Clk5 Clk6 Clk7 Clk8 Clk9
SUB   IF Stall Stall Stall ID EX MEM WB


answered by Veteran (14.6k points)
But why cant wb and id stage be in same cycle h&p does this all the time because it says reg file is written in the first half clk cycle and read in the second half clk cylcle read during second half and this example is from h&p
In that case, there will be only 2 stall cycles. But unless that is specified in the question, we cannot assume that.
yes 2 stalls

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

32,545 questions
39,231 answers
36,613 users