Initial commit, add project skeleton files
x1phosura x1phosura@x1phosura.zone
Sun, 28 Nov 2021 18:16:12 -0800
16 files changed,
279 insertions(+),
0 deletions(-)
jump to
A
.gitignore
@@ -0,0 +1,5 @@
+# ignore nand2tetris testing files +projects/*/*.cmp +projects/*/*.tst +projects/*/*.out +
A
projects/01/And.hdl
@@ -0,0 +1,18 @@
+// 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/And.hdl + +/** + * And gate: + * out = 1 if (a == 1 and b == 1) + * 0 otherwise + */ + +CHIP And { + IN a, b; + OUT out; + + PARTS: + // Put your code here: +}
A
projects/01/And16.hdl
@@ -0,0 +1,17 @@
+// 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/And16.hdl + +/** + * 16-bit bitwise And: + * for i = 0..15: out[i] = (a[i] and b[i]) + */ + +CHIP And16 { + IN a[16], b[16]; + OUT out[16]; + + PARTS: + // Put your code here: +}
A
projects/01/DMux.hdl
@@ -0,0 +1,18 @@
+// 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/DMux.hdl + +/** + * Demultiplexor: + * {a, b} = {in, 0} if sel == 0 + * {0, in} if sel == 1 + */ + +CHIP DMux { + IN in, sel; + OUT a, b; + + PARTS: + // Put your code here: +}
A
projects/01/DMux4Way.hdl
@@ -0,0 +1,20 @@
+// 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/DMux4Way.hdl + +/** + * 4-way demultiplexor: + * {a, b, c, d} = {in, 0, 0, 0} if sel == 00 + * {0, in, 0, 0} if sel == 01 + * {0, 0, in, 0} if sel == 10 + * {0, 0, 0, in} if sel == 11 + */ + +CHIP DMux4Way { + IN in, sel[2]; + OUT a, b, c, d; + + PARTS: + // Put your code here: +}
A
projects/01/DMux8Way.hdl
@@ -0,0 +1,20 @@
+// 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/DMux8Way.hdl + +/** + * 8-way demultiplexor: + * {a, b, c, d, e, f, g, h} = {in, 0, 0, 0, 0, 0, 0, 0} if sel == 000 + * {0, in, 0, 0, 0, 0, 0, 0} if sel == 001 + * etc. + * {0, 0, 0, 0, 0, 0, 0, in} if sel == 111 + */ + +CHIP DMux8Way { + IN in, sel[3]; + OUT a, b, c, d, e, f, g, h; + + PARTS: + // Put your code here: +}
A
projects/01/Mux.hdl
@@ -0,0 +1,18 @@
+// 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/Mux.hdl + +/** + * Multiplexor: + * out = a if sel == 0 + * b otherwise + */ + +CHIP Mux { + IN a, b, sel; + OUT out; + + PARTS: + // Put your code here: +}
A
projects/01/Mux16.hdl
@@ -0,0 +1,18 @@
+// 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/Mux16.hdl + +/** + * 16-bit multiplexor: + * for i = 0..15 out[i] = a[i] if sel == 0 + * b[i] if sel == 1 + */ + +CHIP Mux16 { + IN a[16], b[16], sel; + OUT out[16]; + + PARTS: + // Put your code here: +}
A
projects/01/Mux4Way16.hdl
@@ -0,0 +1,20 @@
+// 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/Mux4Way16.hdl + +/** + * 4-way 16-bit multiplexor: + * out = a if sel == 00 + * b if sel == 01 + * c if sel == 10 + * d if sel == 11 + */ + +CHIP Mux4Way16 { + IN a[16], b[16], c[16], d[16], sel[2]; + OUT out[16]; + + PARTS: + // Put your code here: +}
A
projects/01/Mux8Way16.hdl
@@ -0,0 +1,22 @@
+// 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/Mux8Way16.hdl + +/** + * 8-way 16-bit multiplexor: + * out = a if sel == 000 + * b if sel == 001 + * etc. + * h if sel == 111 + */ + +CHIP Mux8Way16 { + IN a[16], b[16], c[16], d[16], + e[16], f[16], g[16], h[16], + sel[3]; + OUT out[16]; + + PARTS: + // Put your code here: +}
A
projects/01/Not.hdl
@@ -0,0 +1,17 @@
+// 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/Not.hdl + +/** + * Not gate: + * out = not in + */ + +CHIP Not { + IN in; + OUT out; + + PARTS: + // Put your code here: +}
A
projects/01/Not16.hdl
@@ -0,0 +1,17 @@
+// 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/Not16.hdl + +/** + * 16-bit Not: + * for i=0..15: out[i] = not in[i] + */ + +CHIP Not16 { + IN in[16]; + OUT out[16]; + + PARTS: + // Put your code here: +}
A
projects/01/Or.hdl
@@ -0,0 +1,18 @@
+// 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/Or.hdl + + /** + * Or gate: + * out = 1 if (a == 1 or b == 1) + * 0 otherwise + */ + +CHIP Or { + IN a, b; + OUT out; + + PARTS: + // Put your code here: +}
A
projects/01/Or16.hdl
@@ -0,0 +1,17 @@
+// 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/Or16.hdl + +/** + * 16-bit bitwise Or: + * for i = 0..15 out[i] = (a[i] or b[i]) + */ + +CHIP Or16 { + IN a[16], b[16]; + OUT out[16]; + + PARTS: + // Put your code here: +}
A
projects/01/Or8Way.hdl
@@ -0,0 +1,17 @@
+// 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: +}
A
projects/01/Xor.hdl
@@ -0,0 +1,17 @@
+// 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/Xor.hdl + +/** + * Exclusive-or gate: + * out = not (a == b) + */ + +CHIP Xor { + IN a, b; + OUT out; + + PARTS: + // Put your code here: +}