nand2/01_Boolean_Logic/Xor.v

26 lines
351 B
Coq
Raw Permalink Normal View History

2023-01-11 10:13:09 +00:00
/**
* Exclusive-or gate:
* out = not (a == b)
*/
`default_nettype none
module Xor(
input a,
input b,
output out
2023-01-11 10:13:09 +00:00
);
// Put your code here:
wire nota;
wire notb;
Not NOT1(a, nota);
Not NOT2(b, notb);
2023-01-11 10:13:09 +00:00
wire w1;
wire w2;
And AND1(a, notb, w1);
And AND2(nota, b, w2);
Or OR(w1, w2, out);
2023-01-11 10:13:09 +00:00
endmodule