Files
skills-win/vivado-sim-workspace/iteration-1/eval-counter/with_skill/outputs/counter8.v
T
2026-05-09 01:12:34 -05:00

19 lines
497 B
Verilog
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// 8位计数器模块
module counter8 (
input wire clk, // 系统时钟
input wire rst_n, // 低有效复位
input wire en, // 使能信号
output reg [7:0] count, // 计数输出
output wire overflow // 溢出标志(count == 8'hFF)
);
assign overflow = (count == 8'hFF) & en;
always @(posedge clk or negedge rst_n) begin
if (!rst_n)
count <= 8'h00;
else if (en)
count <= count + 1'b1;
end
endmodule