Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Code an asynchronously reset register with enable

Q102·Free·SystemVerilog

Code an asynchronously reset register with enable

Difficulty
Easy
Topic
RTL Design
Language
SV
Interview prompt

Question

Write parameterized RTL for a register that samples data when enable is high, holds its value otherwise, and asserts reset asynchronously low. Require W>=1.

Candidate starting point

Implementation scaffold

module enabled_register #(
  parameter int W = 8
) (
  input  logic         clk,
  input  logic         rst_n,
  input  logic         en,
  input  logic [W-1:0] d,
  output logic [W-1:0] q
);
  // TODO: implement reset, enable, and hold behavior.
endmodule
Reviewed example

Trace one case

Input
W=8; rst_n=1, en=1, d=8'h5A at a rising clock edge
Expected output
q=8'h5A after the nonblocking update

With reset inactive and enable asserted, the edge samples d into q. If enable were low, q would retain its prior value.

What to cover

Requirements

  1. Assert reset on negedge rst_n without waiting for a clock edge.
  2. Model normal reset release behavior at the next posedge clk.
  3. Hold q when en is low.
  4. Use nonblocking assignments for q.
Exact question handoffPractice Q102

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

RTL Clock Boundaries and Flow

Review reset, clock boundaries, arbitration, ready-valid flow, FIFOs, and backpressure.

  • RTL Design
  • SystemVerilog
  • Flip-flop
  • Reset
RTL Clock Boundaries and Flow →
Continue practicing

Related questions

Q014 · RTL DesignRegister a glitch-free decoded enableEasy→Q674 · TimingImplement a Flip-Flop Divide-by-2 OutputEasyP→Q892 · Clock and Reset DomainsGate Functional DDR Commands Around TrainingHardP→Q515 · RTL DesignCode an active-low asynchronous-reset registerEasyP→Q690 · RTL DesignHold even decimal counts for an extra enabled cycleMediumP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi