Verilog程序怎么实现异步清零
module counter4(tb,clk,dataout,cin);input wire tb,clk;
output reg dataout;
output reg cin;
always @(posedge clk)
begin
if(tb==1)
begin
dataout<=0;
cin<=0;
end
else
begin
dataout<=dataout+1;
if(dataout==15)
cin<=1;
else
cin<=0;
end
end
endmodule
这个程序怎么才能实现,异步清零功能! 就是在程序中加入一个输入量,使他为高电平时,输出直接为零,不必等时钟到来时才为零! 异步清零 是那样的,比较简单的东东。 恩,是的啊!!!!!!!!! always @(posedge clk or posedge clr)
if(clr)
out<=0;
else
...
...
...
这样可以! 楼上说的对极了
页:
[1]