Or8Way done
This commit is contained in:
parent
8a1072a4a5
commit
515f974aaf
|
@ -20,7 +20,7 @@ Build order as per the website. Cost for each gate in NAND in brackets.
|
|||
- [x] `And16` (32)
|
||||
- [x] `Or16` (48)
|
||||
- [x] `Mux16` (113)
|
||||
- [ ] `Or8Way` ()
|
||||
- [x] `Or8Way` (21)
|
||||
- [ ] `Mux4Way16` ()
|
||||
- [ ] `Mux8Way16` ()
|
||||
- [ ] `DMux4Way` ()
|
||||
|
|
|
@ -4,14 +4,24 @@
|
|||
// File name: projects/01/Or8Way.hdl
|
||||
|
||||
/**
|
||||
* 8-way Or:
|
||||
* 8-way Or:
|
||||
* out = (in[0] or in[1] or ... or in[7])
|
||||
*/
|
||||
|
||||
// COST = 7x3 = 21 NAND Gates
|
||||
|
||||
CHIP Or8Way {
|
||||
IN in[8];
|
||||
OUT out;
|
||||
|
||||
PARTS:
|
||||
// Put your code here:
|
||||
}
|
||||
Or(a=in[0], b=in[1], out=p);
|
||||
Or(a=in[2], b=in[3], out=q);
|
||||
Or(a=in[4], b=in[5], out=r);
|
||||
Or(a=in[6], b=in[7], out=s);
|
||||
|
||||
Or(a=p, b=q, out=x);
|
||||
Or(a=r, b=s, out=y);
|
||||
|
||||
Or(a=x, b=y, out=out);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
| in | out |
|
||||
| 00000000 | 0 |
|
||||
| 11111111 | 1 |
|
||||
| 00010000 | 1 |
|
||||
| 00000001 | 1 |
|
||||
| 00100110 | 1 |
|
Loading…
Reference in New Issue