EDAboard.com | EDAboard.eu | EDAboard.de | EDAboard.co.uk | RTV forum PL | NewsGroups PL

How do I control pulse width for frequency divider

elektroda.net NewsGroups Forum Index - Verilog Language - How do I control pulse width for frequency divider

Daku
Guest

Sat Jan 02, 2010 11:18 am   



Could some Verilog guru please help ? I have a simple divide-by-2
clock divider as:

always @ (posedge clock)
begin
if(divby2count == 2)
begin
divby2count <= 0;
divby2 <= 1;
end
else
begin
divby2count <= divby2count + 1;
divby2 <= 0;
end
end

Is there a simple way to specify and control the pulse width of
divby2, just for the main clock pulse.

Any hints. suggestions would be invaluable. Thanks in advance for your
help.

gabor
Guest

Sat Jan 02, 2010 5:12 pm   



On Jan 2, 4:18 am, Daku <dakup...@gmail.com> wrote:
Quote:
Could some Verilog guru please help ? I have a simple divide-by-2
clock divider as:

always @ (posedge clock)
  begin
    if(divby2count == 2)
     begin
       divby2count <= 0;
       divby2         <= 1;
     end
    else
      begin
        divby2count <= divby2count + 1;
        divby2         <= 0;
      end
 end

Is there a simple way to specify and control the pulse width of
divby2, just for the main clock pulse.

Any hints. suggestions would be invaluable. Thanks in advance for your
help.

First of all, the code seems to describe a divide by three counter
since you have states 0, 1, and 2 for divby2count. But as to your
original question, if this is to be synthesized, you can only
set the pulse width to some multiple of the clock period or
possible a half-period if you use both clock edges. For the
case of divide by two, you're stuck with a 50% duty cycle unless
you use both clock edges, in which case you could also get 25%
or 75% assuming a 50% duty cycle clock input.

For simulation, you can make the pulse width anything you
want using delays. Something like:
`timescale 1 ns / 1 ps
always @ (negedge divby2count[0]) begin
divby2 = 1; // immediately set pulse
#10 divby2 = 0; // 10 ns later clear the pulse
end

HTH,
Gabor

elektroda.net NewsGroups Forum Index - Verilog Language - How do I control pulse width for frequency divider

Arabic versionBulgarian versionCatalan versionCzech versionDanish versionGerman versionGreek versionEnglish versionSpanish versionFinnish versionFrench versionHindi versionCroatian versionIndonesian versionItalian versionHebrew versionJapanese versionKorean versionLithuanian versionLatvian versionDutch versionNorwegian versionPolish versionPortuguese versionRomanian versionRussian versionSlovak versionSlovenian versionSerbian versionSwedish versionTagalog versionUkrainian versionVietnamese versionChinese version
RTV map EDAboard.com map News map EDAboard.eu map EDAboard.de map EDAboard.co.uk map Opony