Frequency Divider by 4
Problem Description
Design and implement a Verilog module that divides an input clock frequency by 4 and produces an output clock with a 50% duty cycle.
The design should use a synchronous counter-based approach and must satisfy the following requirements:
The module shall accept a single input clock
input_clk.The module shall generate an output clock
output_clkwhose frequency is one-fourth of the input clock.The duty cycle of
output_clkmust be exactly 50%.The design shall include an active-low asynchronous reset (
rst).When
rst = 0, the counter and output clock must be initialized to0.On every rising edge of
input_clk, the internal counter should increment and control the toggling ofoutput_clk.
π Functional Behavior
Input Clock Cycles | Counter Value | Output Clock |
|---|---|---|
0 β 1 | 00 β 01 | 0 |
1 β 2 | 01 β 10 | 1 |
2 β 3 | 10 β 11 | 1 |
3 β 4 | 11 β 00 | 0 |
This behavior repeats continuously, resulting in a frequency division of 4 with a 50% duty cycle.
β Example
If the input clock is:
1 0 1 0 1 0 1 0 ...
Then the output clock should be:
0 0 1 1 0 0 1 1 ...
π― Objective
Implement the Verilog module and verify its functionality using simulation.
Verilog
Code Editor Access
Log in to write, run and submit your solution to this interview question. It's free.
