module andgate(clk,a,b); input clk; input a; input b; reg c; wire x; wire y; initial c = 0; assign x = a & b; assign y = (a)?b:x; always @(posedge clk) begin c = ~x + c; end endmodule