P10.1.1 Find the Rate Where the Bus Breaks

EasyImplementIcarus · browser samples / server checksReview the topic

Eight wires, one clock and a table of trace delays. Find the shortest bit time the bus can run at, and the wire that sets it.

Hardware context: The digital blocks of a serializer/deserializer: line encoder and decoder, scrambler, CRC and error-correcting code. Keep the line balanced and busy, and detect or correct the errors a fast serial link makes.

A board has an eight-bit parallel bus and a forwarded clock. Layout gives you the delay of every trace. The team wants to know how fast the bus can go before the first wire is captured wrongly.

The clock edge is sent in the middle of each bit. Every wire must be stable 20 ps before the edge arrives (setup) and 20 ps after it (hold).

Write bus_limit(delays, clk_ps). Return the shortest bit time at which all eight wires still meet setup and hold. Also return the wire that sets this limit, and whether its setup or its hold check is the tight one.

For the bus of the lesson the answer is 440 ps, set by the setup check of wire 6.

Signals in the Timeline

SignalWidthRole
test_number8input of each check
Full specification
Signature (keep it)
function automatic [19:0] bus_limit(input [95:0] delays, input int clk_ps);   // returns {limiting_check, limiting_wire[2:0], min_bit_ps[15:0]}
ItemRule
delaysWire w has the delay delays[12*w+11 : 12*w], in ps.
Setup check of wire wHalf a bit time must be at least delay[w] - clk_ps + 20.
Hold check of wire wHalf a bit time must be at least clk_ps - delay[w] + 20.
min_bit_psTwice the largest of these 16 values.
limiting_wire, limiting_checkThe wire and the check (0 setup, 1 hold) with that largest value.
TiesThe lowest wire number wins. On the same wire, setup wins.

All delays are between 0 and 4,095 ps. The setup and hold times of 20 ps are fixed.

Examples

Example 1

The Bus of the Lesson
Input
delays 500, 520, 480, 610, 450, 530, 700, 490 ps; clock 500 ps
Output
min_bit_ps = 440, limiting_wire = 6, limiting_check = setup (0)

Wire 6 arrives 200 ps after the clock and needs 20 ps of setup. Half a bit must be 220 ps, so the bit time is 440 ps.

Example 2

The Same Bus with a Late Clock
Input
the same delays; clock 700 ps
Output
min_bit_ps = 540, limiting_wire = 4, limiting_check = hold (1)

Now wire 4 is 250 ps ahead of the clock. Its next bit must not arrive within 20 ps after the edge: half a bit must be 270 ps.

Example 3

Perfectly Matched Traces
Input
all delays and the clock at 500 ps
Output
min_bit_ps = 40, limiting_wire = 0, limiting_check = setup (0)

With no skew only setup and hold remain: half a bit is 20 ps. All 16 checks tie, so wire 0 and setup are reported.

Constraints and Contract

  • Keep the function name, the arguments and the 20-bit result.
  • All times are whole picoseconds.
  • The result always fits in 16 bits.

Hints

Hint 1

Take one wire. When does its new bit arrive, and when does the clock edge arrive? The gap between them must cover the setup time.

Hint 2

A wire that is slower than the clock is short of setup time. A wire that is faster than the clock is short of hold time. Each wire gives you two numbers.

Hint 3

Only half of the bit time lies between a data change and the clock edge. Double the worst number at the end.

What the grader checks: The fixture checks your function on 17 delay tables against the timing rule of the lesson. It is a timing budget: it does not simulate the wires.

17 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

The Bus of the Lesson

Input
delays 500, 520, 480, 610, 450, 530, 700, 490 ps; clock 500 ps
Expected output
min_bit_ps = 440, limiting_wire = 6, limiting_check = setup (0)

Wire 6 arrives 200 ps after the clock and needs 20 ps of setup. Half a bit must be 220 ps, so the bit time is 440 ps.

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

Icarus · browser samples / server checks