G5.10.1 How Much Can the Latch Borrow?

MediumImplementIcarus · browser samples / server checksReview the topic

Find how far a slow stage of a two-phase latch pipeline can borrow into the next stage, and what time is left.

Hardware context: A datapath of latches on two non-overlapping clocks whose first stage is slower than half a cycle. Compute the borrowing limit and the time left for the next stage of a latch pipeline.

A datapath uses latches on two non-overlapping clocks. Its first stage is slower than half a cycle. With flip-flops it would fail; with latches it can borrow time from the second stage. The designer needs the numbers.

This is an Implement problem with no logic to write. Work out each answer by hand and write it into the answer module as a constant. The first three constants are worked examples and are already correct.

The check compares every constant with the right value and names the first one that is wrong.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification
QuantityValue
Cycle time1200 ps
phi1 high0 to 570 ps
phi2 high620 to 1150 ps
Latch setup time (before it closes)35 ps
Latch D to Q (while open)55 ps
Latch clock to Q (data waiting when it opens)80 ps
Stage A logic delay700 ps
The pipeline
latch 1 (open on phi1) -> stage A logic -> latch 2 (open on phi2) -> stage B logic -> latch 3 (open on the next phi1)
ConstantWhat to write
L2_OPENSThe time latch 2 opens, in ps (the rising edge of phi2).
L2_CLOSESThe time latch 2 closes, in ps (the falling edge of phi2).
L2_LATESTThe latest arrival at latch 2 that still meets its setup time, in ps (1150 - 35).
MAX_BORROWThe most time stage A can borrow from stage B: the latest arrival minus the opening of latch 2, in ps.
A_ARRIVESWhen stage A's data reaches latch 2, in ps, for a stage A delay of 700 ps.
A_BORROWSHow much time stage A borrows, in ps.
Q2_LEAVESWhen the data leaves latch 2, in ps.
B_MAXThe largest stage B delay that still meets the setup time of latch 3 (next phi1), in ps.
A_MAXThe largest stage A delay latch 2 can accept at all, in ps.

Data enters latch 1 before phi1 rises at 0 ps, so it leaves latch 1 at 0 + clock to Q. These are exercise numbers.

Examples

Example 1

Worked Example: Latch 2 Opens
Input
the time latch 2 opens, in ps (the rising edge of phi2)
Output
l2_opens = 620

Latch 2 is open while phi2 is high, from 620 ps. This constant is already filled in.

Example 2

Worked Example: Latch 2 Closes
Input
the time latch 2 closes, in ps (the falling edge of phi2)
Output
l2_closes = 1150

phi2 falls at 1150 ps. This constant is already filled in.

Example 3

Worked Example: The Latest Arrival
Input
the latest arrival at latch 2 that still meets its setup time, in ps (1150 - 35)
Output
l2_latest = 1115

Data must be stable 35 ps before latch 2 closes: 1150 - 35 = 1115 ps. This constant is already filled in.

Constraints and Contract

  • Keep the module name answer and the names of the constants.
  • Every answer is a whole number of ps.

Hints

Hint 1

A latch can accept data any time while it is open, up to its setup time before it closes. Data that comes after it opens passes through, D to Q later.

Hint 2

Borrowing is the time between the opening of the latch and the arrival of the data. It cannot go past the setup limit before the closing edge.

Hint 3

Stage B starts when the data leaves latch 2, not when latch 2 opened. Its own limit is the setup time before latch 3 closes.

What the grader checks: The check reads nine constants and compares each with a value computed in JavaScript from the table. It cannot see how a value was found.

9 checks on Icarus · browser samples / server checks. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.

See all 1 steps and the final capstone

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

Worked Example: Latch 2 Opens

Input
the time latch 2 opens, in ps (the rising edge of phi2)
Expected output
l2_opens = 620

Latch 2 is open while phi2 is high, from 620 ps. This constant is already filled in.

Run samples executes all 3 public checks. Check all tests runs 9 checks on the server.

Icarus · browser samples / server checks