|

楼主 |
发表于 2012-3-30 20:15:11
|
显示全部楼层
本帖最后由 hexuezu 于 2012-3-30 20:16 编辑
回复 2# gordon_m
module mod1(clk,clr,counter,en);
input clk,clr,en;
output [3:0]counter;
wire clk,clr,en;
reg [3:0]counter;
reg [3:0] counter_reg;
always @(posedge clk)
begin
if (!clr)
counter_reg<=4'b0000;
else if(en)
counter_reg<=counter_reg+4'b0001;
end
always @(posedge clk)
counter<=counter_reg;
endmodule |
|