基于 Verilog HDL 的分频器设计
Verilog HDL 的分频器设计 作者:nyj
文中的第一个模块为通用的偶分频模块,第二个模块为通用的奇分频模块,2 个模块
分频占空比都为 1:1,使用时只需将相应模块中 parameter DIV_N = N; 中的 N 改为想
要的分频数即可。
/********************************************
**File name: Divide_Frequency_module
**Author: nyj
**Version:
**Data: 11/7/17
**Description: Even divide FPGA CLK frequency
**********************************************/
module Divide_Frequency_module
(
input CLK_In,
input RSTn,
output CLK_Out
);
/*****************************************/
parameter DIV_N = N;
/***********************************************/
reg [DIV_N:0] count;
reg clk_N;
always @ ( posedge CLK_In or negedge RSTn )
begin
if(!RSTn)
begin
count <= 1'b0;
clk_N <= 1'b0;
end
else if( count == DIV_N/2 - 1'b1)
begin
count <= 1'b0;
clk_N <= ~clk_N;
评论0
最新资源