2023-01-11 10:13:09 +00:00
|
|
|
/**
|
|
|
|
* Exclusive-or gate:
|
|
|
|
* out = not (a == b)
|
|
|
|
*/
|
|
|
|
|
|
|
|
`default_nettype none
|
|
|
|
module Xor(
|
2024-10-17 18:36:58 +00:00
|
|
|
input a,
|
|
|
|
input b,
|
|
|
|
output out
|
2023-01-11 10:13:09 +00:00
|
|
|
);
|
|
|
|
|
2024-10-17 18:36:58 +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
|
|
|
|
2024-10-17 18:36:58 +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
|