DescriptionQ283
Q283FWMicronASIC interview problem
Build a deterministic memory-lane error histogram
TechniquesSiliconReliabilityDebugBuildA
DifficultyMedium
TopicPost-Silicon Validation
LanguageC
Requirements4 checkpoints
01
Problem
A lab log contains the lane number for each observed error. Firmware must return all lane counts and the hottest lane. Implement the C histogram helper with transactional outputs.
Starting declarationC
enum HistStatus { HIST_OK, HIST_BAD_ARG };
HistStatus lane_histogram(const uint8_t *events, size_t n, uint8_t lanes,
uint32_t *counts, uint8_t *hottest);Example input and output
Use this case to check your interpretationInput
events = {2, 1, 2, 3, 1, 2}, lanes = 4.Output
counts = {0, 2, 3, 1} and hottest = 2.Explanation
Lane 2 occurs three times, more than every other lane, so it is the unique hottest lane.
02
Requirements (4)
- Require lanes in 1..32, counts and hottest nonnull, and events nonnull when n>0; reject n values that could overflow a uint32_t lane count.
- Every event must be below lanes. Validate the complete input before changing counts or *hottest.
- On success overwrite counts[0..lanes-1] with exact occurrence counts and set hottest to the lane with greatest count.
- Break a count tie in favor of the lowest lane number; n=0 therefore returns all-zero counts and hottest=0.
