module t_ff ( input CLK, input T, output reg Q ); always @(posedge CLK) begin if (T) Q <= ~Q; end endmodule