FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > Verilog

Verilog comp.lang.verilog newsgroup / usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-22-2005, 06:08 AM
rsk
Guest
 
Posts: n/a
Default 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...

Reply With Quote
  #2 (permalink)  
Old 07-23-2005, 07:30 AM
Swapnajit Mittra
Guest
 
Posts: n/a
Default Re: Divide by 3/2 clock generation with 50% duty cycle?

Yes it is possible; think negedge activated flops.

- Swapnajit.

Reply With Quote
  #3 (permalink)  
Old 07-25-2005, 05:40 AM
rsk
Guest
 
Posts: n/a
Default 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

Reply With Quote
  #4 (permalink)  
Old 07-25-2005, 07:27 AM
rsk
Guest
 
Posts: n/a
Default 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...

Reply With Quote
  #5 (permalink)  
Old 07-25-2005, 11:30 AM
Guest
 
Posts: n/a
Default 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...


Reply With Quote
  #6 (permalink)  
Old 07-25-2005, 11:34 AM
Guest
 
Posts: n/a
Default 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

Reply With Quote
  #7 (permalink)  
Old 07-25-2005, 12:04 PM
rsk
Guest
 
Posts: n/a
Default 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...



Reply With Quote
  #8 (permalink)  
Old 07-25-2005, 08:36 PM
Guest
 
Posts: n/a
Default 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.

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to divide the clock by 2 using only xor gates? eva Verilog 1 03-29-2005 10:48 PM
timescale and duty cycle [email protected] Verilog 1 03-14-2005 02:40 PM
Random number generation in Windows - how to use wall clock? FGreen Verilog 2 10-27-2004 03:40 PM
generate a 20 MHZ clock(pulse) with duty cycle other than 50 % from master clock 40 MHZ having 50 % duty cycle MegaPowerStar Verilog 2 08-19-2003 01:29 AM
Re: Multi Cycle path and False paths Subroto Datta Verilog 9 08-02-2003 06:44 PM


All times are GMT +1. The time now is 11:55 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved