module D_flip_flop(output reg Q, input D, clk, rst_n); always @(posedge clk) begin if(!rst_n) Q <= 0; else Q <= D; end endmodule