Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Synchronize and filter an asynchronous alarm

Hardware interview practice

Synchronize and filter an asynchronous alarm

MediumCDC and ResetSystemVerilog

An asynchronous thermal alarm may chatter. The destination must synchronize it and change its output only after three equal synchronized samples. Implement the two-flop synchronizer and three-sample filter in 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, alarm_async;
output logic alarm_filtered;
Reviewed example

Work through one case

Input
Starting with alarm_filtered = 0, present second-stage synchronized samples 1, 1, 1.
Expected output
alarm_filtered changes to 1 on the third sample.

Three consecutive equal synchronized samples satisfy the assertion threshold exactly on the final sample.

What to cover

Requirements

  1. Pass alarm_async through two destination flip-flops before the filter uses it.
  2. Set alarm_filtered after three consecutive second-stage samples of one; clear it after three consecutive samples of zero.
  3. A sample opposite to the current run restarts the run count at one for the new value.
  4. Synchronous active-low reset clears both synchronizer stages, the run state, the count, and alarm_filtered.
Continue practicing

Related questions

CDC and ResetOne-outstanding-event CDC handshake→CDC and ResetBridge a sticky memory-error alarm across clocks→CDC and ResetCheck reset-bounded delivery of asynchronous events→
asic.fyi · Learn silicon end to end.info@asic.fyi