Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Help me to write the following program with VHDL

Status
Not open for further replies.

bme.gol

Newbie level 1
Joined
May 19, 2011
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
iran.tabriz
Activity points
1,286
Help me to write the following program with VHDL
Frequency divider with a ratio of 34/53
 

let me show some sample example you just modify this and go ahead
The trend here seems to be to place the intended clock input divided by two into the integer range of variable cnt and the if statement checking the value of cnt. This should work for any input clock value, assuming you change the appropriate values
25.175MHz to 1Hz Clock Divider
entity c1hz is
port( clk:in bit; clkout:eek:ut bit);
end c1hz;

architecture behavior of c1hz is
begin
process(clk)
variable cnt : integer range 0 to 12587500;
begin
if(clk'event and clk='1') then
if(cnt=12587500)then
cnt:=0;
clkout<='1';
else
cnt := cnt+1;
clkout<='0';
end if;
end if;
end process;
end behavior;
 

well, he probably wants a PLL. 34/53 is a rate that is between 3/4 and 1/2 of the clock rate. in your example, you can get 1/1, 1/2, 1/3, etc...

the alternative to a PLL/DCM based synthesizer would be to do:
Code:
if (x > y) then
  clk_out <= '1';
  x <= x - y + z;
else
  clk_out <='0';
  x <= x + z;
end if;
where z = 34, y = 53. this obviously has high jitter, as it basically looks like 010101010010101010101001 -- a clock but with occasional extra 0's.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top