B
bharathi
Guest
hi all,
i did a module for frequency divider , is capable to convert 30Mhz
to 400 kHz
i can get the proper simulation result, but the code is not
synthesisable, i given the code below.. suggest me some thing
module fre_div (
out_clk,
in_clk,
i_sysrst
);
input in_clk;
input i_sysrst;
output out_clk;
reg out_clk;
reg [6:0]cnt;
reg temp;
always @(posedge in_clk or i_sysrst)
begin
if(!i_sysrst)
begin
cnt <= 7'd0;
out_clk <= 1'b0;
end
else if (cnt == 7'd37)
begin
temp <= 1'b1;
cnt <= cnt +7'd1;
end
else if (cnt == 7'd75)
begin
out_clk <= ~out_clk;
cnt <= 7'd1;
end
else
cnt = cnt+7'd1;
end
always @(negedge in_clk)
begin
if(temp == 1'b1)
begin
out_clk <= ~out_clk;
temp <= 1'b0;
end
end
endmodule
i did a module for frequency divider , is capable to convert 30Mhz
to 400 kHz
i can get the proper simulation result, but the code is not
synthesisable, i given the code below.. suggest me some thing
module fre_div (
out_clk,
in_clk,
i_sysrst
);
input in_clk;
input i_sysrst;
output out_clk;
reg out_clk;
reg [6:0]cnt;
reg temp;
always @(posedge in_clk or i_sysrst)
begin
if(!i_sysrst)
begin
cnt <= 7'd0;
out_clk <= 1'b0;
end
else if (cnt == 7'd37)
begin
temp <= 1'b1;
cnt <= cnt +7'd1;
end
else if (cnt == 7'd75)
begin
out_clk <= ~out_clk;
cnt <= 7'd1;
end
else
cnt = cnt+7'd1;
end
always @(negedge in_clk)
begin
if(temp == 1'b1)
begin
out_clk <= ~out_clk;
temp <= 1'b0;
end
end
endmodule