clk2.v
来自「FPGA中嵌中高级课件,非常有用的课件」· Verilog 代码 · 共 44 行
V
44 行
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:17:09 08/24/06
// Design Name:
// Module Name: clk2
// Project Name:
// Target Device:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module clk2(clk,clock);
input clk;
output clock;
reg clock;
reg[15:0] state;
initial
begin
state<=16'd0;
clock<=0;
end
always@(posedge clk)
begin
state<=state+1;
begin
if (state==16'd499) //将50分频为50K
begin
clock<=~clock;
state<=16'd0;
end
end
end
endmodule
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?