stuntmaster
Newbie level 4
Help Plz new to verilog
eh everyone i am new to verilog and i am doing UART on cpld
i want to use a baud rate of 1200 so my clock frequency should be 19.2KHz
the problem is i only have 25.7MHz crystal on altera UP2 board
how can i write a verilog program to drive this frequency form the board
i have tried this code to get 1KHz just to check but it doesn't work
input clk_25mhz;
output clk_1khz;
reg clk_1khz;
reg [9:0] count1;
always @(posedge clk_25mhz)
begin : process_1
if (count1 <= 1000)
begin
count1 <= count1 + 1;
end
else
begin
count1 <= 0;
end
if (count1 < 100)
begin
clk_1khz <= 1'b 0;
end
else
begin
clk_1khz <= 1'b 1;
end
end
help PLZ
eh everyone i am new to verilog and i am doing UART on cpld
i want to use a baud rate of 1200 so my clock frequency should be 19.2KHz
the problem is i only have 25.7MHz crystal on altera UP2 board
how can i write a verilog program to drive this frequency form the board
i have tried this code to get 1KHz just to check but it doesn't work
input clk_25mhz;
output clk_1khz;
reg clk_1khz;
reg [9:0] count1;
always @(posedge clk_25mhz)
begin : process_1
if (count1 <= 1000)
begin
count1 <= count1 + 1;
end
else
begin
count1 <= 0;
end
if (count1 < 100)
begin
clk_1khz <= 1'b 0;
end
else
begin
clk_1khz <= 1'b 1;
end
end
help PLZ