From 515f974aaf01aff0283b6923f54bceef6e3ec972 Mon Sep 17 00:00:00 2001 From: Nemo Date: Tue, 19 May 2020 22:52:09 +0530 Subject: [PATCH] Or8Way done --- README.md | 2 +- projects/01/Or8Way.hdl | 16 +++++++++++++--- projects/01/Or8Way.out | 6 ++++++ 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 projects/01/Or8Way.out diff --git a/README.md b/README.md index a1679d8..483fca1 100644 --- a/README.md +++ b/README.md @@ -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` () diff --git a/projects/01/Or8Way.hdl b/projects/01/Or8Way.hdl index db03a73..3eac0de 100644 --- a/projects/01/Or8Way.hdl +++ b/projects/01/Or8Way.hdl @@ -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: -} \ No newline at end of file + 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); +} diff --git a/projects/01/Or8Way.out b/projects/01/Or8Way.out new file mode 100644 index 0000000..b9f8d99 --- /dev/null +++ b/projects/01/Or8Way.out @@ -0,0 +1,6 @@ +| in | out | +| 00000000 | 0 | +| 11111111 | 1 | +| 00010000 | 1 | +| 00000001 | 1 | +| 00100110 | 1 |