mirror of
https://github.com/soconnor0919/eceg431.git
synced 2025-12-11 22:54:43 -05:00
project01: Comments/cleanup
This commit is contained in:
12
01/Mux.hdl
12
01/Mux.hdl
@@ -11,8 +11,12 @@ CHIP Mux {
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
Not(in=sel, out=tmp1);
|
||||
And(a=a, b=tmp1, out=tmp2);
|
||||
And(a=b, b=sel, out=tmp3);
|
||||
Or(a=tmp2, b=tmp3, out=out);
|
||||
// invert selector
|
||||
Not(in=sel, out=notSel);
|
||||
// when sel=0: aPath gets a
|
||||
And(a=a, b=notSel, out=aPath);
|
||||
// when sel=1: bPath gets b
|
||||
And(a=b, b=sel, out=bPath);
|
||||
// combine both paths
|
||||
Or(a=aPath, b=bPath, out=out);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user