1.D触发器:
module D_flip_flop(
input [1:0] d,
input clk,
output reg[1:0] q,
output reg[1:0] qb
);
always @(posedge clk) //时钟上升沿触发D触发器
begin
q<= d ;
qb<= ~d ;
end
module D_flip_flop(
input [1:0] d,
input clk,
output reg[1:0] q,
output reg[1:0] qb
);
always @(posedge clk) //时钟上升沿触发D触发器
begin
q<= d ;
qb<= ~d ;
end