Add solutions for part 1
This commit is contained in:
25
projects/01/Or8Way.hdl
Normal file
25
projects/01/Or8Way.hdl
Normal file
@@ -0,0 +1,25 @@
|
||||
// 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/01/Or8Way.hdl
|
||||
|
||||
/**
|
||||
* 8-way Or:
|
||||
* out = (in[0] or in[1] or ... or in[7])
|
||||
*/
|
||||
|
||||
CHIP Or8Way {
|
||||
IN in[8];
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Or(a=in[0], b=in[1], out=a1);
|
||||
Or(a=in[2], b=in[3], out=a2);
|
||||
Or(a=in[4], b=in[5], out=a3);
|
||||
Or(a=in[6], b=in[7], out=a4);
|
||||
|
||||
Or(a=a1, b=a2, out=b1);
|
||||
Or(a=a3, b=a4, out=b2);
|
||||
|
||||
Or(a=b1, b=b2, out=out);
|
||||
}
|
||||
Reference in New Issue
Block a user