nand2tetris/projects/01/Or8Way.hdl

25 lines
599 B
Plaintext
Raw Normal View History

2021-12-05 03:37:22 +00:00
// 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:
// Put your code here:
Or(a=in[0], b=in[1], out=stepA);
Or(a=in[2], b=stepA, out=stepB);
Or(a=in[3], b=stepB, out=stepC);
Or(a=in[4], b=stepC, out=stepD);
Or(a=in[5], b=stepD, out=stepE);
Or(a=in[6], b=stepE, out=stepF);
Or(a=in[7], b=stepF, out=out);
}