fpga输出不同频率的信号
clk_out_50 输出50MHz,clk_out_s 输出小于50MHz的信号
module CLK_OUT(clk_in_b2,clk_out_s,clk_out_50);
/ clk initial ///
input clk_in_b2; //50M clk input bank2
output clk_out_s; // <50M clk output
output clk_out_50; // 50M clk output
reg clk_out_s = 0;
reg[5:0] hz_times = 0;
reg[5:0] value = 6'b00_0000; //频率的阈值
// 6'b00_0000 -> 25Mhz
// 6'b00_0001 -> 12.5Mhz
// 6'b00_0011 -> 5Mhz
// 6'b01_1000 -> 1Mhz
//
/ clk control ///
assign clk_out_50 = ~clk_in_b2; //50M clk output
always@(posedge clk_in_b2)begin // <50M clk output
if(hz_times == value)begin
hz_times = 0;
clk_out_s = ~clk_out_s;
end
else begin
hz_times = hz_times + 1;
end
end
//
endmodule