1
\$\begingroup\$

I want to calculate the cycle time of a single-cycle datapath. Then from the course, I know the time should be the execution time of the longest instruction, which is 'lw' in MIPS. So I try to calculate the time latency for 'lw'.

I think the longest path/time for 'lw' woud be:

PC -> I-Mem -> Read-Reg -> ALU -> Data-Mem -> Mux(to select Mem to Register) -> Write-Reg

(In the path, I think the mux to choose read-register1 or write-register, sing-extend for immediate value and mux to choose read-data 2 or immediate value are all ignored, since the circuits are in parallel, they would take less time than other parts in parallel.)

But when I tried to find some solutions, there are some different answers, but none are identical to mine.

Someone said, the time/path should be:

PC -> I-Mem -> Read-Reg -> Mux(choose the input of ALU) -> ALU -> Data Memory -> Mux(select Mem to Register) -> Write-Reg

And some other versions:

PC -> I-Mem -> Read-Reg -> ALU -> Data Memory -> Mux(select Mem to Register)

But without Write-Reg

I really don't know which is really the right answer. Can anyone help me to solve this problem?

\$\endgroup\$
0
\$\begingroup\$

Draw it out. Graphviz is great for this sort of thing.

The clock cycle starts with the PC and ends with the Regsiter Write operation, shown here as square boxes. Everything else (ovals) is combinatorial.

dataflow diagram

Note that there are two paths between I_memory and ALU (we can assume that the WriteRegisterMux isn't in the longest path). It can be argued that since SignExtend doesn't really involve any logic (it's just wires), and that a simple mux is faster than RegisterRead, that the latter is the critical path.

Therefore, the clock edge to clock edge path delays are:

  • PC clock-to-output
  • I memory
  • Register Read
  • ALU
  • D memory
  • Write Data mux
  • Register Write setup-to-clock time

The answer that you found that puts the ALUmux in the critical path is confused about which register read port is being used for this instruction.

The other answer omits the Register Write setup time, which they may simply be assuming is zero.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Thanks very much. I think your answer is really clear and it is identical to mine. But actually all the solutions and answers of homework or exercises I saw from university websites and textbooks are really different, which confused me for such a long time. Thank you for your explanation. I think our answer is really correct. \$\endgroup\$ – Will Oct 12 '19 at 10: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.