From b8f53f80d0a506f1c64d2318db8e05f844bb1fa0 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Wed, 29 Nov 2017 16:19:33 +0100 Subject: Finished Project 1. --- projects/01/And16.hdl | 18 +++++++++++++++++- projects/01/And16.out | 7 +++++++ projects/01/And1With16.hdl | 22 ++++++++++++++++++++++ projects/01/DMux4Way.hdl | 5 ++++- projects/01/DMux4Way.out | 9 +++++++++ projects/01/DMux8Way.hdl | 5 ++++- projects/01/DMux8Way.out | 17 +++++++++++++++++ projects/01/Mux16.hdl | 16 ++++++++++++++++ projects/01/Mux16.out | 9 +++++++++ projects/01/Mux4Way16.hdl | 5 ++++- projects/01/Mux4Way16.out | 9 +++++++++ projects/01/Mux8Way16.hdl | 5 ++++- projects/01/Mux8Way16.out | 17 +++++++++++++++++ projects/01/Not16.hdl | 18 +++++++++++++++++- projects/01/Not16.out | 6 ++++++ projects/01/Or16.hdl | 18 +++++++++++++++++- projects/01/Or16.out | 7 +++++++ projects/01/Or8Way.hdl | 9 ++++++++- projects/01/Or8Way.out | 6 ++++++ 19 files changed, 200 insertions(+), 8 deletions(-) create mode 100644 projects/01/And16.out create mode 100644 projects/01/And1With16.hdl create mode 100644 projects/01/DMux4Way.out create mode 100644 projects/01/DMux8Way.out create mode 100644 projects/01/Mux16.out create mode 100644 projects/01/Mux4Way16.out create mode 100644 projects/01/Mux8Way16.out create mode 100644 projects/01/Not16.out create mode 100644 projects/01/Or16.out create mode 100644 projects/01/Or8Way.out diff --git a/projects/01/And16.hdl b/projects/01/And16.hdl index 27fe04a..10c8603 100644 --- a/projects/01/And16.hdl +++ b/projects/01/And16.hdl @@ -14,4 +14,20 @@ CHIP And16 { PARTS: // Put your code here: -} \ No newline at end of file + And (a=a[0], b=b[0], out=out[0]); + And (a=a[1], b=b[1], out=out[1]); + And (a=a[2], b=b[2], out=out[2]); + And (a=a[3], b=b[3], out=out[3]); + And (a=a[4], b=b[4], out=out[4]); + And (a=a[5], b=b[5], out=out[5]); + And (a=a[6], b=b[6], out=out[6]); + And (a=a[7], b=b[7], out=out[7]); + And (a=a[8], b=b[8], out=out[8]); + And (a=a[9], b=b[9], out=out[9]); + And (a=a[10], b=b[10], out=out[10]); + And (a=a[11], b=b[11], out=out[11]); + And (a=a[12], b=b[12], out=out[12]); + And (a=a[13], b=b[13], out=out[13]); + And (a=a[14], b=b[14], out=out[14]); + And (a=a[15], b=b[15], out=out[15]); +} diff --git a/projects/01/And16.out b/projects/01/And16.out new file mode 100644 index 0000000..fb8dbfc --- /dev/null +++ b/projects/01/And16.out @@ -0,0 +1,7 @@ +| a | b | out | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | +| 0000000000000000 | 1111111111111111 | 0000000000000000 | +| 1111111111111111 | 1111111111111111 | 1111111111111111 | +| 1010101010101010 | 0101010101010101 | 0000000000000000 | +| 0011110011000011 | 0000111111110000 | 0000110011000000 | +| 0001001000110100 | 1001100001110110 | 0001000000110100 | diff --git a/projects/01/And1With16.hdl b/projects/01/And1With16.hdl new file mode 100644 index 0000000..c6d412c --- /dev/null +++ b/projects/01/And1With16.hdl @@ -0,0 +1,22 @@ +CHIP And1With16 { + IN a, b[16]; + OUT out[16]; + + PARTS: + And (a=a, b=b[0], out=out[0]); + And (a=a, b=b[1], out=out[1]); + And (a=a, b=b[2], out=out[2]); + And (a=a, b=b[3], out=out[3]); + And (a=a, b=b[4], out=out[4]); + And (a=a, b=b[5], out=out[5]); + And (a=a, b=b[6], out=out[6]); + And (a=a, b=b[7], out=out[7]); + And (a=a, b=b[8], out=out[8]); + And (a=a, b=b[9], out=out[9]); + And (a=a, b=b[10], out=out[10]); + And (a=a, b=b[11], out=out[11]); + And (a=a, b=b[12], out=out[12]); + And (a=a, b=b[13], out=out[13]); + And (a=a, b=b[14], out=out[14]); + And (a=a, b=b[15], out=out[15]); +} diff --git a/projects/01/DMux4Way.hdl b/projects/01/DMux4Way.hdl index 24270c0..18b725d 100644 --- a/projects/01/DMux4Way.hdl +++ b/projects/01/DMux4Way.hdl @@ -17,4 +17,7 @@ CHIP DMux4Way { PARTS: // Put your code here: -} \ No newline at end of file + DMux (in=in, sel=sel[1], a=e, b=f); + DMux (in=e, sel=sel[0], a=a, b=b); + DMux (in=f, sel=sel[0], a=c, b=d); +} diff --git a/projects/01/DMux4Way.out b/projects/01/DMux4Way.out new file mode 100644 index 0000000..9dd708f --- /dev/null +++ b/projects/01/DMux4Way.out @@ -0,0 +1,9 @@ +| in | sel | a | b | c | d | +| 0 | 00 | 0 | 0 | 0 | 0 | +| 0 | 01 | 0 | 0 | 0 | 0 | +| 0 | 10 | 0 | 0 | 0 | 0 | +| 0 | 11 | 0 | 0 | 0 | 0 | +| 1 | 00 | 1 | 0 | 0 | 0 | +| 1 | 01 | 0 | 1 | 0 | 0 | +| 1 | 10 | 0 | 0 | 1 | 0 | +| 1 | 11 | 0 | 0 | 0 | 1 | diff --git a/projects/01/DMux8Way.hdl b/projects/01/DMux8Way.hdl index 75714a5..6038fa6 100644 --- a/projects/01/DMux8Way.hdl +++ b/projects/01/DMux8Way.hdl @@ -17,4 +17,7 @@ CHIP DMux8Way { PARTS: // Put your code here: -} \ No newline at end of file + DMux (in=in, sel=sel[2], a=i, b=j); + DMux4Way (in=i, sel=sel[0..1], a=a, b=b, c=c, d=d); + DMux4Way (in=j, sel=sel[0..1], a=e, b=f, c=g, d=h); +} diff --git a/projects/01/DMux8Way.out b/projects/01/DMux8Way.out new file mode 100644 index 0000000..ebf9304 --- /dev/null +++ b/projects/01/DMux8Way.out @@ -0,0 +1,17 @@ +| in | sel | a | b | c | d | e | f | g | h | +| 0 | 000 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 001 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 010 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 011 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 100 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 101 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 110 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 0 | 111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 1 | 000 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | +| 1 | 001 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | +| 1 | 010 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | +| 1 | 011 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | +| 1 | 100 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | +| 1 | 101 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | +| 1 | 110 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | +| 1 | 111 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | diff --git a/projects/01/Mux16.hdl b/projects/01/Mux16.hdl index 97dd784..ff09c6b 100644 --- a/projects/01/Mux16.hdl +++ b/projects/01/Mux16.hdl @@ -15,4 +15,20 @@ CHIP Mux16 { PARTS: // Put your code here: + Mux (a=a[0], b=b[0], sel=sel, out=out[0]); + Mux (a=a[1], b=b[1], sel=sel, out=out[1]); + Mux (a=a[2], b=b[2], sel=sel, out=out[2]); + Mux (a=a[3], b=b[3], sel=sel, out=out[3]); + Mux (a=a[4], b=b[4], sel=sel, out=out[4]); + Mux (a=a[5], b=b[5], sel=sel, out=out[5]); + Mux (a=a[6], b=b[6], sel=sel, out=out[6]); + Mux (a=a[7], b=b[7], sel=sel, out=out[7]); + Mux (a=a[8], b=b[8], sel=sel, out=out[8]); + Mux (a=a[9], b=b[9], sel=sel, out=out[9]); + Mux (a=a[10], b=b[10], sel=sel, out=out[10]); + Mux (a=a[11], b=b[11], sel=sel, out=out[11]); + Mux (a=a[12], b=b[12], sel=sel, out=out[12]); + Mux (a=a[13], b=b[13], sel=sel, out=out[13]); + Mux (a=a[14], b=b[14], sel=sel, out=out[14]); + Mux (a=a[15], b=b[15], sel=sel, out=out[15]); } diff --git a/projects/01/Mux16.out b/projects/01/Mux16.out new file mode 100644 index 0000000..d2e472e --- /dev/null +++ b/projects/01/Mux16.out @@ -0,0 +1,9 @@ +| a | b | sel | out | +| 0000000000000000 | 0000000000000000 | 0 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 1 | 0000000000000000 | +| 0000000000000000 | 0001001000110100 | 0 | 0000000000000000 | +| 0000000000000000 | 0001001000110100 | 1 | 0001001000110100 | +| 1001100001110110 | 0000000000000000 | 0 | 1001100001110110 | +| 1001100001110110 | 0000000000000000 | 1 | 0000000000000000 | +| 1010101010101010 | 0101010101010101 | 0 | 1010101010101010 | +| 1010101010101010 | 0101010101010101 | 1 | 0101010101010101 | diff --git a/projects/01/Mux4Way16.hdl b/projects/01/Mux4Way16.hdl index 75baced..a47dbae 100644 --- a/projects/01/Mux4Way16.hdl +++ b/projects/01/Mux4Way16.hdl @@ -17,4 +17,7 @@ CHIP Mux4Way16 { PARTS: // Put your code here: -} \ No newline at end of file + Mux16 (a=a, b=b, sel=sel[0], out=out1); + Mux16 (a=c, b=d, sel=sel[0], out=out2); + Mux16 (a=out1, b=out2, sel=sel[1], out=out); +} diff --git a/projects/01/Mux4Way16.out b/projects/01/Mux4Way16.out new file mode 100644 index 0000000..659176d --- /dev/null +++ b/projects/01/Mux4Way16.out @@ -0,0 +1,9 @@ +| a | b | c | d | sel | out | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 00 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 01 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 10 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 11 | 0000000000000000 | +| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 00 | 0001001000110100 | +| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 01 | 1001100001110110 | +| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 10 | 1010101010101010 | +| 0001001000110100 | 1001100001110110 | 1010101010101010 | 0101010101010101 | 11 | 0101010101010101 | diff --git a/projects/01/Mux8Way16.hdl b/projects/01/Mux8Way16.hdl index 88c791e..6c88945 100644 --- a/projects/01/Mux8Way16.hdl +++ b/projects/01/Mux8Way16.hdl @@ -19,4 +19,7 @@ CHIP Mux8Way16 { PARTS: // Put your code here: -} \ No newline at end of file + Mux4Way16 (a=a, b=b, c=c, d=d, sel=sel[0..1], out=out1); + Mux4Way16 (a=e, b=f, c=g, d=h, sel=sel[0..1], out=out2); + Mux16 (a=out1, b=out2, sel=sel[2], out=out); +} diff --git a/projects/01/Mux8Way16.out b/projects/01/Mux8Way16.out new file mode 100644 index 0000000..11ff518 --- /dev/null +++ b/projects/01/Mux8Way16.out @@ -0,0 +1,17 @@ +| a | b | c | d | e | f | g | h | sel | out | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 000 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 001 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 010 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 011 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 100 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 101 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 110 | 0000000000000000 | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 0000000000000000 | 111 | 0000000000000000 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 000 | 0001001000110100 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 001 | 0010001101000101 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 010 | 0011010001010110 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 011 | 0100010101100111 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 100 | 0101011001111000 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 101 | 0110011110001001 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 110 | 0111100010011010 | +| 0001001000110100 | 0010001101000101 | 0011010001010110 | 0100010101100111 | 0101011001111000 | 0110011110001001 | 0111100010011010 | 1000100110101011 | 111 | 1000100110101011 | diff --git a/projects/01/Not16.hdl b/projects/01/Not16.hdl index 3d25bbe..f24fdb0 100644 --- a/projects/01/Not16.hdl +++ b/projects/01/Not16.hdl @@ -14,4 +14,20 @@ CHIP Not16 { PARTS: // Put your code here: -} \ No newline at end of file + Not (in=in[0], out=out[0]); + Not (in=in[1], out=out[1]); + Not (in=in[2], out=out[2]); + Not (in=in[3], out=out[3]); + Not (in=in[4], out=out[4]); + Not (in=in[5], out=out[5]); + Not (in=in[6], out=out[6]); + Not (in=in[7], out=out[7]); + Not (in=in[8], out=out[8]); + Not (in=in[9], out=out[9]); + Not (in=in[10], out=out[10]); + Not (in=in[11], out=out[11]); + Not (in=in[12], out=out[12]); + Not (in=in[13], out=out[13]); + Not (in=in[14], out=out[14]); + Not (in=in[15], out=out[15]); +} diff --git a/projects/01/Not16.out b/projects/01/Not16.out new file mode 100644 index 0000000..ae2ad1d --- /dev/null +++ b/projects/01/Not16.out @@ -0,0 +1,6 @@ +| in | out | +| 0000000000000000 | 1111111111111111 | +| 1111111111111111 | 0000000000000000 | +| 1010101010101010 | 0101010101010101 | +| 0011110011000011 | 1100001100111100 | +| 0001001000110100 | 1110110111001011 | diff --git a/projects/01/Or16.hdl b/projects/01/Or16.hdl index 0238f05..4b46ec5 100644 --- a/projects/01/Or16.hdl +++ b/projects/01/Or16.hdl @@ -14,4 +14,20 @@ CHIP Or16 { PARTS: // Put your code here: -} \ No newline at end of file + Or (a=a[0], b=b[0], out=out[0]); + Or (a=a[1], b=b[1], out=out[1]); + Or (a=a[2], b=b[2], out=out[2]); + Or (a=a[3], b=b[3], out=out[3]); + Or (a=a[4], b=b[4], out=out[4]); + Or (a=a[5], b=b[5], out=out[5]); + Or (a=a[6], b=b[6], out=out[6]); + Or (a=a[7], b=b[7], out=out[7]); + Or (a=a[8], b=b[8], out=out[8]); + Or (a=a[9], b=b[9], out=out[9]); + Or (a=a[10], b=b[10], out=out[10]); + Or (a=a[11], b=b[11], out=out[11]); + Or (a=a[12], b=b[12], out=out[12]); + Or (a=a[13], b=b[13], out=out[13]); + Or (a=a[14], b=b[14], out=out[14]); + Or (a=a[15], b=b[15], out=out[15]); +} diff --git a/projects/01/Or16.out b/projects/01/Or16.out new file mode 100644 index 0000000..8664afe --- /dev/null +++ b/projects/01/Or16.out @@ -0,0 +1,7 @@ +| a | b | out | +| 0000000000000000 | 0000000000000000 | 0000000000000000 | +| 0000000000000000 | 1111111111111111 | 1111111111111111 | +| 1111111111111111 | 1111111111111111 | 1111111111111111 | +| 1010101010101010 | 0101010101010101 | 1111111111111111 | +| 0011110011000011 | 0000111111110000 | 0011111111110011 | +| 0001001000110100 | 1001100001110110 | 1001101001110110 | diff --git a/projects/01/Or8Way.hdl b/projects/01/Or8Way.hdl index 24c78c4..495972b 100644 --- a/projects/01/Or8Way.hdl +++ b/projects/01/Or8Way.hdl @@ -14,4 +14,11 @@ CHIP Or8Way { PARTS: // Put your code here: -} \ No newline at end of file + Or (a=in[0], b=in[1], out=in01); + Or (a=in01, b=in[2], out=in02); + Or (a=in02, b=in[3], out=in03); + Or (a=in03, b=in[4], out=in04); + Or (a=in04, b=in[5], out=in05); + Or (a=in05, b=in[6], out=in06); + Or (a=in06, b=in[7], 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 | -- cgit v1.2.3