Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Implement a divide-by-four clock model

Q193·Free·SystemVerilog

Implement a divide-by-four clock model

Difficulty
Easy
Topic
RTL Design
Language
SV
Interview prompt

Question

For simulation or FPGA-style RTL, divide clk by four with a resettable two-bit counter. Also state the safe ASIC implementation rule for a generated clock.

Candidate starting point

Implementation scaffold

module clock_div4 (
  input logic clk, rst_n,
  output logic clk_div4
);
  logic [1:0] count;
  always_ff @(posedge clk or negedge rst_n) begin : count_source_edges
    // TODO: clear or increment the two-bit counter.
  end
  always_comb begin : divided_output
    // TODO: drive clk_div4 from the specified counter bit.
  end
  // TODO: state the ASIC generated-clock implementation rule.
endmodule
Reviewed example

Trace one case

Input
Counter starts at 00; apply four rising edges
Expected output
counter: 01,10,11,00; clk_div4: 0,1,1,0

The counter MSB completes one period for every four source-clock periods.

What to cover

Requirements

  1. Clear the two-bit counter with active-low asynchronous reset.
  2. Increment it on every rising edge while reset is inactive.
  3. Drive clk_div4 from counter bit 1 for a 50 percent steady-state duty cycle.
  4. For ASIC clock consumers, require an approved clock-generation primitive and generated-clock constraint.
Exact question handoffPractice Q193

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

Logic and Timing

Review Boolean logic, clocked state, setup, hold, and register-to-register timing.

  • RTL Design
  • SystemVerilog
  • Counter
  • Clocking
Logic and Timing →
Continue practicing

Related questions

Q541 · RTL DesignDivide a 2 MHz clock by twoEasyP→Q1054 · RTL DesignGenerate a 50% duty-cycle divide-by-three clockHardP→Q690 · RTL DesignHold even decimal counts for an extra enabled cycleMediumP→Q740 · TimingGenerate a Divide-by-3 Clock with Equal High and Low TimesMediumP→Q972 · TimingTime Two Related FPGA Clock DomainsMediumP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi