如果将64M用500分频,不如计数到249使信号反转,实现500分频,这样信号占空比是50%(除非有要求是其它占空比)。 注意,不能计数到250,因为0~250等于计数值是251,多计数了1次。前面程序也是,不应该计数到500,到499就要停止了。 |
我也在学习FPGA,看了一下,counter在499时也应该+1 reg [8:0]counter; always @(posedge clk_64M or negedge Reset_n) if(!Reset_n) clk_out<=0; counter <= 9'h000; // 清零 else if(counter==499) begin clk_out<=1; counter <= counter + 9'h001; // 增加的+1 else if(counter==500) begin counter<=0; clk_out<=0; end else counter<=counter+1'b1; |
npn 发表于 2024-1-13 18:24 他也没用PLL来编程啊? |
FPGA的PLL是一个硬件IP核,不是所有的FPGA都有PLL,不同品牌型号的用法可能有不同。 |