异步复位的D触发器,与前一题不同,前一题是所有操作均在clk上升沿触发,此题异步复位,即areset为1立即复位,不必等待clk上升沿,但是输出仍要等待clk上升沿--> clk,arest敏感电平优先级应当一致。
module top_module (
input clk,
input areset, // active high asynchronous reset
input [7:0] d,
output [7:0] q
);
always@(posedge areset,posedge clk)
begin
if(areset)
q=0;
else
q<=d;
end
endmodule