module counter4(clk,dout,en,oc);
input wire clk;
input wire en;
output reg [3:0] dout;
output reg oc;
reg [3:0] temp;
always @(posedge clk)
if(en==1)
begin
temp<=temp+1;
if(temp==4'b1111)
oc<=1;
else
oc<=0;
dout<=temp;
end
else
begin
dout<=4'bzzzz;
oc<="z";
end
endmodule
这会就对了,各位还有什么可以教导的么,受益匪浅 啊!!
学习了
|