From 77c62c3504912cb853aa7fcc0b51360ace4cad6c Mon Sep 17 00:00:00 2001 From: Garritt McCune Date: Wed, 20 Jan 2021 15:14:40 -0600 Subject: [PATCH] For the first time I finished the DMux chips. Not the best way to do it, but its a start. --- projects/01/And16.hdl | 16 ++++++++++++++++ projects/01/And16.out | 7 +++++++ projects/01/DMux4Way.hdl | 16 ++++++++++++++++ projects/01/DMux4Way.out | 9 +++++++++ projects/01/DMux8Way.hdl | 21 ++++++++++++++++++++- projects/01/DMux8Way.out | 17 +++++++++++++++++ 6 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 projects/01/And16.out create mode 100644 projects/01/DMux4Way.out create mode 100644 projects/01/DMux8Way.out diff --git a/projects/01/And16.hdl b/projects/01/And16.hdl index 27fe04a..6b0deee 100644 --- a/projects/01/And16.hdl +++ b/projects/01/And16.hdl @@ -14,4 +14,20 @@ CHIP And16 { PARTS: // Put your code here: + 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]); } \ No newline at end of file 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/DMux4Way.hdl b/projects/01/DMux4Way.hdl index 24270c0..a356dd8 100644 --- a/projects/01/DMux4Way.hdl +++ b/projects/01/DMux4Way.hdl @@ -17,4 +17,20 @@ CHIP DMux4Way { PARTS: // Put your code here: + And(a=sel[0], b=sel[1], out=out1); + And(a=in, b=out1, out=d); + + //Invert sel, 00 => 11 + Not(in=sel[0], out=out2); + Not(in=sel[1], out=out3); + And(a=out2, b=out3, out=out4); + And(a=out4, b=in, out=a); + + //Output B? + And(a=sel[0], b=out3, out=out5); + And(a=out5, b=in, out=b); + + //Output C? + And(a=sel[1], b=out2, out=out6); + And(a=out6, b=in, out=c); } \ No newline at end of file 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..c528bdf 100644 --- a/projects/01/DMux8Way.hdl +++ b/projects/01/DMux8Way.hdl @@ -7,7 +7,11 @@ * 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, in, 0, 0, 0, 0, 0} if sel == 010 + {0, 0, 0, in, 0, 0, 0, 0} if sel == 011 + {0, 0, 0, 0, in, 0, 0, 0} if sel == 100 + {0, 0, 0, 0, 0, in, 0, 0} if sel == 101 + {0, 0, 0, 0, 0, 0, in, 0} if sel == 110 * {0, 0, 0, 0, 0, 0, 0, in} if sel == 111 */ @@ -17,4 +21,19 @@ CHIP DMux8Way { PARTS: // Put your code here: + Not(in=sel[2], out=out1); + + DMux4Way(in=in, sel=sel[0..1], a=outA, b=outB, c=outC, d=outD); + + And(a=out1, b=outA, out=a); + And(a=out1, b=outB, out=b); + And(a=out1, b=outC, out=c); + And(a=out1, b=outD, out=d); + + DMux4Way(in=in, sel=sel[0..1], a=outE, b=outF, c=outG, d=outH); + + And(a=sel[2], b=outE, out=e); + And(a=sel[2], b=outF, out=f); + And(a=sel[2], b=outG, out=g); + And(a=sel[2], b=outH, out=h); } \ No newline at end of file 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 |