Work out the MTBF of a synchronizer from the numbers a library and a layout give you. The chains have two, three and four flops.
Hardware context: The MTBF arithmetic of a synchronizer chain: tau and T0 of the flop, the clock and data rates, setup time and the wire delay between the flops. Write the function that returns log10 of the MTBF of a synchronizer chain.
A review asks one question about every crossing: how long until this synchronizer fails? The library gives tau and T0 for the flop. The design gives the clock and data rates. The layout gives the wire delay between the synchronizer flops. Somebody has to combine them, and unit slips are common.
This is an Implement problem: write the arithmetic once, as a function, so that it can be checked. MTBF runs from seconds to far beyond the age of the universe. The function therefore returns its log: log10 of the MTBF in seconds.
The model: a metastable flop has one hop to settle before the next flop samples it. One hop is the clock period minus the wire delay to the next flop and minus that flop's setup time. A chain of N flops has N - 1 hops, and the settle times of all hops add up in the exponent.
Your answer passes when it is within 5 % of the MTBF, which is 0.0212 in log10. This function is a calculator, not hardware, so no synthesis check runs.
Signals in the Timeline
| Signal | Width | Role |
|---|---|---|
stages | 32 | input of each check |
Full specification
function automatic real log10_mtbf_s(
input real tau_ps, // the flop's resolution time constant, ps
input real t0_ps, // the flop's metastability window, ps
input real fclk_mhz, // the sampling clock, MHz
input real fdata_mhz, // how often the crossing signal changes, MHz
input real tsu_ps, // setup time of each synchronizer flop, ps
input real troute_ps, // wire delay between two synchronizer flops, ps
input int stages // flops in the synchronizer chain, 2 or more
);
// your arithmetic
endfunction
| Quantity | Unit given | Role |
|---|---|---|
| tau_ps | picoseconds | how fast a metastable flop resolves |
| t0_ps | picoseconds | the width of the window in which a change makes the flop metastable |
| fclk_mhz | megahertz | the sampling clock; its period is 1 000 000 / fclk_mhz picoseconds |
| fdata_mhz | megahertz | how often the crossing signal changes |
| tsu_ps, troute_ps | picoseconds | setup time of each flop, and wire delay between two flops |
| stages | a count | flops in the chain; the tests use 2, 3 and 4 |
Lesson R6.1 gives the MTBF formula for one settle time. Use it with the total settle time of the chain. Mind the units: the formula needs seconds and hertz, or a consistent set.
Real math functions you may need: $ln(x), $log10(x), $exp(x), $pow(x, y). An MTBF itself may be too large for a real in the worst cases, so work in logs.
Result: verdict is "within 5 %", "too short" or "too long". A result that is not a number counts as too short.
Examples
Example 1
Two Flops at 500 MHz- Input
tau=25 ps, T0=50 ps, clock=500 MHz, data=50 MHz, setup=60 ps, wire=140 ps, stages=2
- Output
verdict = within 5 % (0)
The period is 2000 ps. One hop is 2000 - 140 - 60 = 1800 ps, which is 72 times tau. The answer is 25.17, about 4.7e+17 years.
Example 2
The Same Crossing with a Third Flop- Input
tau=25 ps, T0=50 ps, clock=500 MHz, data=50 MHz, setup=60 ps, wire=140 ps, stages=3
- Output
verdict = within 5 % (0)
Two hops give 3600 ps of settle time. The log rises to 56.44: the exponent doubled, and the MTBF did far more than double.
Example 3
A Long Wire Between the Flops- Input
tau=25 ps, T0=50 ps, clock=500 MHz, data=50 MHz, setup=60 ps, wire=900 ps, stages=2
- Output
verdict = within 5 % (0)
A 900 ps wire leaves a hop of 1040 ps. The log falls to 11.97. Placing the two flops apart cost about 13 decades.
Constraints and Contract
- Keep the function name and its arguments. Every input is positive, and stages is at least 2.
- The settle time of one hop is positive in every test.
Hints
Hint 1
Find the settle time of one hop first, in picoseconds. Then count the hops in a chain of N flops.
Hint 2
log10 of e to the power x is x divided by the natural log of 10. A division becomes a subtraction of logs.
Hint 3
Check your units on the first example. T0 times the clock rate must be a pure number: seconds times hertz.
What the grader checks: Ten directed and twelve seeded sets of numbers are applied. Each answer is compared with an independent model and must be within 5 % of the MTBF. Passing shows the arithmetic and the units are right on these sets. The constants are illustrative; real ones come from the library vendor.
22 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