// ============================================================
// Basic Gates (given)
// ============================================================
module and_gate(input a, b, output y);
assign y = a & b;
endmodule
module or_gate(input a, b, output y);
assign y = a | b;
endmodule
module not_gate(input a, output y);
assign y = ~a;
endmodule
// ============================================================
// XOR Gate
// ============================================================
module xor_gate (
input a, b,
output y
);
not_gate nota(a,nota);
not_gate notb(b,notb);
and_gate and_anotb(a,notb,y1);
and_gate and_bnota(nota,b,y2);
or_gate or_y1y2(y1,y2,y);
endmodule