Synchronous vs. Asynchronous
Synchronous Preset & Clear Asynchronous Clear
module sync (d,clk, clr, pre, q);
input d, clk, clr, pre ;
output q ;
reg q ;
always @(posedge clk)
begin
if (clr)
q <= 1¡¯b0 ;
else if (pre)
q <= 1¡¯b1 ;
else
q <= d ;
end
endmodule
module async (d,clk, clr, q);
input d, clk, clr ;
output q ;
reg q ;
always @(posedge clk or posedge clr)
begin
if (clr)
q <= 1¡¯b0 ;
else
q <= d ;
end
endmodule
ÀÌÀü ½½¶óÀ̵å
´ÙÀ½ ½½¶óÀ̵å
ù ½½¶óÀ̵å·Î À̵¿
±×·¡ÇÈ ¹öÀü º¸±â