Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Pulse on every adjacent pair of ones

Hardware interview practice

Pulse on every adjacent pair of ones

EasyRTL DesignSystemVerilog

A trace filter must mark every sample whose value and immediately preceding sample are both one; adjacent matches may overlap. Implement the one-bit history detector in synthesizable SystemVerilog.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

input logic clk, rst_n, bit_in;
output logic pair_pulse;
Reviewed example

Work through one case

Input
After reset, sample bit_in values 0, 1, 1 on successive edges.
Expected output
pair_pulse values are 0, 0, 1.

Only the third sample is one while the saved immediately previous sample is also one, so it completes the adjacent pair.

What to cover

Requirements

  1. Sample bit_in on each rising edge and pulse when the current and previous sampled values are both one.
  2. Allow overlap, so input 111 produces pulses on the second and third samples.
  3. When rst_n is zero at a rising edge, clear the saved history and pair_pulse.
  4. pair_pulse is low on every sample that does not complete an adjacent pair.
Continue practicing

Related questions

RTL DesignEnabled modulo-five counter→RTL DesignAccumulate a four-lane signed dot product→RTL DesignEncode the highest active request and its one-hot form→
asic.fyi · Learn silicon end to end.info@asic.fyi