采用 Verilog HDL语言设计一个异步清零,异步置位D触发器(需要分频器,50HZ分频)

下面程序运行有误,或修改,或给更好的。分频器我有,只需给D触发器(异步清零,置位)
module d(rst1,rst0,clk,in,out);
input rst1,rst0,clk,in;
output out;
reg out;
always@(posedge clk or negedge rst1 or negedge rst0)
begin
if(rst1) out<=1;
else if(rst0) out<=0;
else
begin
if(in) out<=in;
else out<=out;
end
end
endmodule

module d(rst1,rst0,clk,in,out);
input rst1,rst0,clk,in;
output out;
reg out;
always@(posedge clk or negedge rst1 or negedge rst0)
begin
if(~rst1)  out<=1;            //注意下降沿配套的条件写法 
else if(~rst0) out<=0;    //注意下降沿配套的条件写法
else out <= in;            //直接完成D触发器的特性方程就可以了
//begin
//if(in)  out<=in;
//else out<=out;
//end
end
endmodule

温馨提示:答案为网友推荐,仅供参考
相似回答