实验现象:
绿色led闪烁
核心源代码:
//--------------------module_counter_ctrl--------------------// module counter_ctrl ( input clk_25m, input rst_n, output fpga_ledg ); //--------------------counter_ctrl--------------------------// /*计数器控制绿色led闪烁*/ reg [24:0]cnt; reg ledg; always@(posedge clk_25m or negedge rst_n) if(!rst_n) begin ledg <= 1'd1; cnt <= 25'd0; end else if(cnt == 25'd5000000) begin ledg <= ~ledg; cnt <= 25'd0; end else cnt <= cnt + 1'd1; assign fpga_ledg = ledg; //--------------------endmodule-----------------------------// endmodule
源代码下载链接:
链接:http://pan.baidu.com/s/1dE1FRfb 密码:u34v
iCore4链接: