Files
eceg431/01/Or8Way.hdl
Sean O'Connor ecdc6ab2bc Refactor: Use simple tmp variable names instead of descriptive ones
- Changed nandOut -> tmp
- Changed notA, notB -> tmp1, tmp2
- Changed descriptive names -> tmp1, tmp2, tmp3, etc.

Makes code cleaner and more concise while maintaining functionality.
2025-08-28 14:39:07 +02:00

23 lines
603 B
Plaintext

// 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/1/Or8Way.hdl
/**
* 8-way Or gate:
* out = in[0] Or in[1] Or ... Or in[7]
*/
CHIP Or8Way {
IN in[8];
OUT out;
PARTS:
// Chain Or gates to combine all 8 inputs
Or(a=in[0], b=in[1], out=tmp1);
Or(a=in[2], b=in[3], out=tmp2);
Or(a=in[4], b=in[5], out=tmp3);
Or(a=in[6], b=in[7], out=tmp4);
Or(a=tmp1, b=tmp2, out=tmp5);
Or(a=tmp3, b=tmp4, out=tmp6);
Or(a=tmp5, b=tmp6, out=out);
}