Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Calculate lane deskew tap settings

Q196·Free·Firmware

Calculate lane deskew tap settings

Difficulty
Medium
Topic
Timing & STA
Language
C
Interview prompt

Question

Eight received lanes have measured arrival times. Each programmable tap adds 20 ps, with a maximum setting of 31. Write a C function that aligns every lane to the latest arrival without making any lane early. Target C implementations have a 32-bit int. The taps and aligned_ps output storage must not overlap; arrivals remain stable until read. Staging permits an arrival array to alias aligned_ps.

Candidate starting point

Implementation scaffold

#include <limits.h>
#include <stdint.h>
int deskew(const int arrival_ps[8], uint8_t taps[8], int aligned_ps[8]) {
  // Implement here: validate, compute staged taps/aligned times and publish.
}
Reviewed example

Trace one case

Input
arrival_ps={100,120,120,120,120,120,120,120}.
Expected output
taps={1,0,0,0,0,0,0,0} and aligned_ps is 120 for every lane.

The latest arrival is 120 ps; the first lane needs ceil((120-100)/20)=1 tap and every other lane needs zero.

What to cover

Requirements

  1. Require all pointers and require each arrival_ps[i]>=0; return -1 and preserve outputs otherwise.
  2. Let target be the largest arrival. For each lane choose taps=ceil((target-arrival)/20).
  3. Reject with -1 and preserve outputs if any tap count exceeds 31 or an aligned time cannot be represented in int; otherwise aligned=arrival+20*taps.
  4. On success every aligned time must be in target through target+19 ps, write all outputs, and return 0.
Exact question handoffPractice Q196

Solve it in the question bank, keep your progress, and reveal the reviewed solution when your access allows.

Open in question bank →
Solution accessEach time you open this Solution, one Practice Credit is used; it is not permanently unlocked. Premium Solution content also uses one credit per opening.
Continue learning

Timing Paths and Physical Reality

Review launch, data, capture, slack, skew, variation, placement, routing, and parasitics.

  • Timing & STA
  • STA
  • Deskew
  • Source-synchronous
Timing Paths and Physical Reality →
Continue practicing

Related questions

Q137 · Timing & STAEffect of positive capture-clock skewEasy→Q681 · Timing and STAFind the legal source-synchronous sampling shiftMediumP→Q1137 · Timing and STAFind the worst setup pathMediumP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi