FPGA Central

World's 1st FPGA Portal

 FPGA Groups Divide by 3/2 clock generation with 50% duty cycle?

 Verilog comp.lang.verilog newsgroup / usenet

07-22-2005, 07:08 AM
 rsk Guest Posts: n/a
Divide by 3/2 clock generation with 50% duty cycle?

Dear Friends,

I am wondered is it possible to generate such a clock with 50% duty
cycle???

Thanks & Regards,
krs...

07-23-2005, 08:30 AM
 Swapnajit Mittra Guest Posts: n/a
Re: Divide by 3/2 clock generation with 50% duty cycle?

Yes it is possible; think negedge activated flops.

- Swapnajit.

07-25-2005, 06:40 AM
 rsk Guest Posts: n/a
Re: Divide by 3/2 clock generation with 50% duty cycle?

Hi Swapnajit,

But Divide by 3/2 means, this clock will have "3/4 T" AS its active high
and low edges where "T" is the duraion of the previous clock's period.

I still didn't get any idea.Will you elaborate your idea?

Thanks & Regards,
krs

07-25-2005, 08:27 AM
 rsk Guest Posts: n/a
Re: Divide by 3/2 clock generation with 50% duty cycle?

oops...I should have asked the question more precisely like :

The logic (for divide by 3 clock generation ) should be synthesizable.

Is it possible?

Thanks & Regards,
krs...

07-25-2005, 12:30 PM
 Guest Posts: n/a
Re: Divide by 3/2 clock generation with 50% duty cycle?

rsk wrote:
> oops...I should have asked the question more precisely like :
>
> The logic (for divide by 3 clock generation ) should be synthesizable.
>
> Is it possible?
>
> Thanks & Regards,
> krs...

07-25-2005, 12:34 PM
 Guest Posts: n/a
Re: Divide by 3/2 clock generation with 50% duty cycle?

Try below code:
Cheers,
Pranav

module freq_div (clkin, rst, clkout);
input clkin;
input rst;
output clkout;
wire clkin;
wire rst;
wire clkout;
reg [1:0] cntr;

always @ (negedge clkin)
begin
if (!rst || (cntr==2))
cntr = 0;
else
cntr = cntr + 1;
end

assign clkout = ((!clkin && cntr==0) || (clkin && cntr==0) || (!clkin
&& cntr==1))
? 1'b1 : 0;

endmodule

07-25-2005, 01:04 PM
 rsk Guest Posts: n/a
Re: Divide by 3/2 clock generation with 50% duty cycle?

Hi pranav,

In your code once the "cntr" reaches to "2", it will be latched to "0".

Thanks & Regards
krs...

07-25-2005, 09:36 PM
 Guest Posts: n/a
Re: Divide by 3/2 clock generation with 50% duty cycle?

rsk wrote:
> Hi pranav,
>
> In your code once the "cntr" reaches to "2", it will be latched to "0".
>
> Thanks & Regards
> krs...

Actually it's not "latched" but clocked to zero by the negative
edge of the input clock.

In any case this code divides the clock by 3, not 3/2 (1.5)
which is I believe what you originally asked. You cannot make
an output clock with 50% duty cycle unless you have access to
a quarter-cycle shifted input clock in this case. This would
be possible for example using the DLL in a Xilinx Virtex FPGA,
but without some sort of delay element you're out of luck.

Odd integer clock division with 50% can be done as mentioned
using both edges of the input clock (but to be truly 50% the
input clock must also have 50% duty cycle).

The best you can do without a delay element for divide by 1.5
would be 66.67% duty cycle. Also for the x.5 division cases,
changing the input clock duty cycle from 50% will cause cycle
to cycle jitter in addition to changes in output duty cycle.
This is because the output clock period contains alternately
two input high times plus one input low time, then two input
low times plus one input high time.

In an FPGA, where the D-flip-flop typically has an associated
programmable clock inverter, the easiest way to divide by 1.5
is to use two flip-flops, one on each clock edge like:

always @ (posedge clk) flop1 <= !(flop1 | flop2);

always @ (negedge clk) flop2 <= !(flop1 | flop2);

assign clkout = !(flop1 | flop2);

Although the D function for each flip-flop is the same, you will
see if you simulate this that because they change on alternate
edges of the input clock the Q functions are different, in fact
forming a divide by three clock with 2 non-overlapping phases.

 Bookmarks

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post eva Verilog 1 03-29-2005 11:48 PM [email protected] Verilog 1 03-14-2005 03:40 PM FGreen Verilog 2 10-27-2004 04:40 PM MegaPowerStar Verilog 2 08-19-2003 02:29 AM Subroto Datta Verilog 9 08-02-2003 07:44 PM

All times are GMT +1. The time now is 03:36 PM.