1
$\begingroup$


While studying instruction pipelining in MIPS processor, we make an assumption that registers read/write stages take only a half clock cycle, as this picture shows (half clock cycles are dotted in register operations): enter image description here

So what is the purpose of this assumption? and why is the fourth instruction in this graph is considered a hazard if we actually wrote the value of $2 in the first half clock cycle and then read it in the latter one? enter image description here

$\endgroup$
  • $\begingroup$ My guess is that in the same cycle you can read the old value of the register and write a new value on it, but you can not write a new value and read that new value. Hence the hazard. $\endgroup$ – chi May 16 at 17:03
1
$\begingroup$

By using different phases of a clock cycle for register write and register read, the number of register file ports can be reduced. (This can reduce area and latency.) A two-read and one-write instruction would otherwise require three register file ports (or introduce a structural hazard); by using different phases of the cycle one port can be used for both read and write. This can also facilitate reading from the register file in the same cycle as the value is written, which reduces the number of results that must be managed through the forwarding network.

The fourth instruction (add $14, $2, $2) does not have a data hazard even without forwarding.

$\endgroup$
  • $\begingroup$ After more reading into our course reference book, this answer makes perfect sense! Thank you. $\endgroup$ – Khalid Khalil May 18 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.