diff --git a/projects/custom/Nor.hdl b/projects/custom/Nor.hdl new file mode 100644 index 0000000..7abed00 --- /dev/null +++ b/projects/custom/Nor.hdl @@ -0,0 +1,22 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/custom/Nor.hdl + + /** + * Nor gate: + * out = 1 if (a == 0 or b == 0) + * 0 otherwise + */ + +CHIP Nor { + IN a, b; + OUT out; + + PARTS: + // Put your code here: + Nand(a=a, b=a, out=outx); + Nand(a=b, b=b, out=outy); + Nand(a=outx, b=outy, out=outz); + Nand(a=outz, b=outz, out=out); +} diff --git a/projects/custom/Xnor.hdl b/projects/custom/Xnor.hdl new file mode 100644 index 0000000..e0a2ff5 --- /dev/null +++ b/projects/custom/Xnor.hdl @@ -0,0 +1,23 @@ +// This file is part of www.nand2tetris.org +// and the book "The Elements of Computing Systems" +// by Nisan and Schocken, MIT Press. +// File name: projects/custom/Xnor.hdl + + /** + * Or gate: + * out = (a == b) + * 0 otherwise + */ + +CHIP Xnor { + IN a, b; + OUT out; + + PARTS: + // Put your code here: + Nand(a=a, b=b, out=outw); + Nand(a=a, b=outw, out=outx); + Nand(a=b, b=outw, out=outy); + Nand(a=outx, b=outy, out=outz); + Nand(a=outz, b=outz, out=out); +}