add nor, xnor chips
This commit is contained in:
parent
7ae97dea41
commit
b3af552bfd
22
projects/custom/Nor.hdl
Normal file
22
projects/custom/Nor.hdl
Normal file
@ -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);
|
||||
}
|
23
projects/custom/Xnor.hdl
Normal file
23
projects/custom/Xnor.hdl
Normal file
@ -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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user