1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| 位拼接运算符,实现移位操作
module sp6( input ext_clk_25m, input ext_rst_n, output reg[7:0] led );
reg[23:0] cnt;
always @ (posedge ext_clk_25m or negedge ext_rst_n) if(!ext_rst_n) cnt <= 20'd0; else cnt <= cnt+1'b1;
always @ (posedge ext_clk_25m or negedge ext_rst_n) if(!ext_rst_n) led <= 8'b1111_1010; else if(cnt == 20'hff_ff_ff) led <= {led[6:0],led[7]}; else ;
endmodule
|