Beruflich Dokumente
Kultur Dokumente
____________________________________________________________________
# Definitions
I assume in this topic that you know what is a Clock, Duty cycle, Falling edge and
Rising edge, Counter and T-Flip Flop and Logic!
____________________________________________________________________
____________________________________________________________________
https://www.linkedin.com/pulse/digital-vlsi-topics-1-clock-dividers-mahmoud-abdellatif/ 1/16
10/26/2018 (3) [Digital VLSI Topics] [1] Clock Dividers | LinkedIn
// -- 50 % duty cycle
module clock_divide_4
https://www.linkedin.com/pulse/digital-vlsi-topics-1-clock-dividers-mahmoud-abdellatif/ 2/16
10/26/2018 (3) [Digital VLSI Topics] [1] Clock Dividers | LinkedIn
// 2-bit Counter
cnt <= 0;
else
clk_out <= 0;
else begin
clk_out <= 0;
if (cnt >= 2)
clk_out <= 1;
end
endmodule
Simulation Result
https://www.linkedin.com/pulse/digital-vlsi-topics-1-clock-dividers-mahmoud-abdellatif/ 3/16
10/26/2018 (3) [Digital VLSI Topics] [1] Clock Dividers | LinkedIn
____________________________________________________________________
Dividing by an Odd number with a 50% duty cycle basic idea is to know that you
have to use the negative edge of the reference clock reference clock somewhere to
get your 50% duty cycle. You need a design that guarantees a glitch-free output
circuit, then you need to search for the design with minimal number of Flip-Flops
and Logic gates
https://www.linkedin.com/pulse/digital-vlsi-topics-1-clock-dividers-mahmoud-abdellatif/ 4/16
10/26/2018 (3) [Digital VLSI Topics] [1] Clock Dividers | LinkedIn
1. Create counter that counts from 0 to (N-1) on the rising edge of ref_clk where N is the division number
2. Create two Toggle Flip Flops one working with the positive edge and the other on the negative edge
3. Create Enable signals to the two TFFs, the first enabled when counter =0 and the other enabled when counter = (N+1)/2
Create TFF_1 working on positive edge & TFF_2 working on negative edge
// -- 50 % duty cycle
module clock_divide_3 (
https://www.linkedin.com/pulse/digital-vlsi-topics-1-clock-dividers-mahmoud-abdellatif/ 6/16
10/26/2018 (3) [Digital VLSI Topics] [1] Clock Dividers | LinkedIn
reg tff1_out;
reg tff2_out;
// Counter
counter <= 0;
else
// TFF_1 Enable
tff1_en <= 0;
else begin
tff1_en <= 0;
if (counter == 0)
tff1_en <= 1;
end
// TFF_2 Enable
if (~rstb)
tff2_en <= 0;
else begin
tff2_en <= 0;
if (counter == 2) // (N+1)/2
tff2_en <= 1;
end
// TFF_1
tff1_out <= 0;
else if (tff1_en )
tff2_out <= 0;
else if (tff2_en )
endmodule
Simulation Result
____________________________________________________________________
____________________________________________________________________
This is very similar to dividing by Even number approach used to get 50% duty
cycle, but here you can't get the same result using only counters and positive edge!
module clock_divide_9
// 4-bit Counter
cnt <= 0;
else
https://www.linkedin.com/pulse/digital-vlsi-topics-1-clock-dividers-mahmoud-abdellatif/ 10/16
10/26/2018 (3) [Digital VLSI Topics] [1] Clock Dividers | LinkedIn
clk_out <= 0;
else begin
clk_out <= 0;
if (cnt >= 2)
clk_out <= 1;
end
endmodule
Simulation Result
https://www.linkedin.com/pulse/digital-vlsi-topics-1-clock-dividers-mahmoud-abdellatif/ 11/16
10/26/2018 (3) [Digital VLSI Topics] [1] Clock Dividers | LinkedIn
____________________________________________________________________
What if you want to divide by 1.5, or 4.5 ? In [1] and [2] many approaches are used
to generate glitch-free clock which is divided by Fractional number from a
reference clock.
Let’s start with a divide by 4.5. It means every nine reference clocks would include
two symmetrical pulses.
1. Generate a 9-bit shift register initialized by 1, the shift register is left-rotated on rising edge.
2. To generate the first pulse, first bit must be shifted by half a clock period and then OR with the first and second bit.
https://www.linkedin.com/pulse/digital-vlsi-topics-1-clock-dividers-mahmoud-abdellatif/ 12/16
10/26/2018 (3) [Digital VLSI Topics] [1] Clock Dividers | LinkedIn
3. To generate the second pulse, the 4th and 5th bits must be shifted by half a clock period and then OR with the original 5th bit.
module clock_divide_1p5
(
input wire ref_clk,
input wire rstb,
output wire clk_out
);
begin
ps_count0 <= 1'b0;
ps_count4 <= 1'b0;
ps_count5 <= 1'b0;
end
else
begin
ps_count0 <= cnt[0];
ps_count4 <= cnt[4];
ps_count5 <= cnt[5];
end
assign clk_out = (ps_count4 | ps_count5 | cnt [5]) | (cnt [0] | cnt [1] | ps_count0);
endmodule
https://www.linkedin.com/pulse/digital-vlsi-topics-1-clock-dividers-mahmoud-abdellatif/ 14/16
10/26/2018 (3) [Digital VLSI Topics] [1] Clock Dividers | LinkedIn
Simulation Result
____________________________________________________________________
https://www.linkedin.com/pulse/digital-vlsi-topics-1-clock-dividers-mahmoud-abdellatif/ 16/16