求教,这部分实现了什么功能?分频吗?只定义一个wire变量后面加个赋值语句,就相当于assgin吗?
input [CLK_DIVIDER_WIDTH-1:0] clk_divider,
中间省略无关代码 CLK_DIVIDER_WIDTH=8
reg [CLK_DIVIDER_WIDTH-1:0] clk_count;
wire [CLK_DIVIDER_WIDTH-1:0] next_clk_count = clk_count + 1;
wire pulse = next_clk_count == (clk_divider >> 1);
中间省略无关代码
always @(posedge clk or negedge resetb) begin
if(pulse) begin
clk_count <= 0;
stop_s <= stop;
end else begin
clk_count <= next_clk_count;
end
|