本人刚刚学FPGA,用verilog写了个20分频,占空比是50%的代码,但是结果不对。不知道问题出在哪儿了,请教高手们问题出在哪儿?
module fenpin(gclk_20m, encoder_clock); input gclk_20m; output encoder_clock; reg encoder_clock; reg [10:0] cnt = 11'b00000000000; always @ (posedge gclk_20m) begin if (cnt <= 9) begin cnt <= cnt+1; encoder_clock <= 1; end else if (10<= cnt < 20) begin cnt <= cnt+1; encoder_clock <= 0; end else begin cnt <= 0; end end endmodule
|