Files
nand2tetris_verilog/xor.v
2024-06-13 13:29:36 -07:00

18 lines
324 B
Verilog

`ifndef _xor_v
`define _xor_v
`include "nand.v"
module Xor (input a, input b, output out);
wire tmp1;
wire tmp2;
wire tmp3;
Nand u1(.a(a), .b(b), .out(tmp1));
Nand u2(.a(a), .b(tmp1), .out(tmp2));
Nand u3(.a(b), .b(tmp1), .out(tmp3));
Nand u4(.a(tmp2), .b(tmp3), .out(out));
endmodule
`endif