使用Verilog语言编写基于FPGA的数字频率计模块化设计 要求:1能测量矩形波的频率;2频率测量范围为:1Hz—20MHz;3LED显示测量值 。
module frequency_counter( input clk, input rst, input signal, output [7:0] display );
reg [31:0] count; reg [31:0] freq;
always @(posedge clk or posedge rst) begin if (rst) begin count <= 0; freq <= 0; end else begin count <= count + 1; if (signal != signal_prev) begin freq <= count; count <= 0; end end end
assign display = freq[31:24];
endmodule
原文地址: https://www.cveoy.top/t/topic/fTqf 著作权归作者所有。请勿转载和采集!