SpinalHDL
Description
Redline Telemetry
The racing team's replacement ECU floods cylinder four while reporting a perfectly healthy fuel system. The exhaust glows hotter on every lap. Build an independent telemetry unit that measures each injector command and catches pulses long enough to reveal a stuck-open injector.
A fuel injector control line is high for the duration of each injection. Measure every complete high pulse in the sampled input stream.
Count consecutive high samples. On the first low sample after a high run, pulse valid and report the measurement. width saturates at 255 and overflow is 1 only when the true width exceeded 255; all three outputs are zero on cycles without a completed pulse.
Hardware I/O Encoding
injectoris a stream of unsigned 1-bit samples with at most 320 elements- each output element is
(valid, width, overflow) validandoverfloware unsigned 1-bit valueswidthis an unsigned 8-bit value- the output contains one element per input sample
Example
Input [0, 1, 1, 1, 0, 1, 0] produces [(0, 0, 0), (0, 0, 0), (0, 0, 0), (0, 0, 0), (1, 3, 0), (0, 0, 0), (1, 1, 0)].