Solved the 'smaller' gates and probably not with the best solutions.
This commit is contained in:
@@ -15,4 +15,6 @@ CHIP And {
|
||||
|
||||
PARTS:
|
||||
// Put your code here:
|
||||
Nand(a=a, b=b, out=out1);
|
||||
Nand(a=out1, b=out1, out=out);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
| a | b | out |
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 0 |
|
||||
| 1 | 0 | 0 |
|
||||
| 1 | 1 | 1 |
|
||||
@@ -15,4 +15,11 @@ CHIP DMux {
|
||||
|
||||
PARTS:
|
||||
// Put your code here:
|
||||
// AND in, sel
|
||||
Nand(a=in, b=sel, out=out1);
|
||||
Nand(a=out1, b=out1, out=b);
|
||||
// NAND( (NOT sel), AND in)
|
||||
Nand(a=sel, b=sel, out=out2);
|
||||
Nand(a=in, b=out2, out=out3);
|
||||
Nand(a=out3, b=out3, out=a);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
| in | sel | a | b |
|
||||
| 0 | 0 | 0 | 0 |
|
||||
| 0 | 1 | 0 | 0 |
|
||||
| 1 | 0 | 1 | 0 |
|
||||
| 1 | 1 | 0 | 1 |
|
||||
@@ -15,4 +15,17 @@ CHIP Mux {
|
||||
|
||||
PARTS:
|
||||
// Put your code here:
|
||||
Nand(a=sel, b=b, out=out1);
|
||||
Nand(a=out1, b=out1, out=out2);
|
||||
|
||||
Nand(a=sel, b=sel, out=out3);
|
||||
Nand(a=a, b=out3, out=out4);
|
||||
Nand(a=out4, b=out4, out=out5);
|
||||
|
||||
//Nand(a=out2, b=out5, out=out);
|
||||
//Nand(a=out6, b=out6, out=out);
|
||||
//OR
|
||||
Nand(a=out2, b=out2, out=out6);
|
||||
Nand(a=out5, b=out5, out=out7);
|
||||
Nand(a=out6, b=out7, out=out);
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
| a | b | sel | out |
|
||||
| 0 | 0 | 0 | 0 |
|
||||
| 0 | 0 | 1 | 0 |
|
||||
| 0 | 1 | 0 | 0 |
|
||||
| 0 | 1 | 1 | 1 |
|
||||
| 1 | 0 | 0 | 1 |
|
||||
| 1 | 0 | 1 | 0 |
|
||||
| 1 | 1 | 0 | 1 |
|
||||
| 1 | 1 | 1 | 1 |
|
||||
@@ -14,4 +14,5 @@ CHIP Not {
|
||||
|
||||
PARTS:
|
||||
// Put your code here:
|
||||
Nand(a=in, b=in, out=out);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
| in | out |
|
||||
| 0 | 1 |
|
||||
| 1 | 0 |
|
||||
@@ -15,4 +15,7 @@ CHIP Or {
|
||||
|
||||
PARTS:
|
||||
// Put your code here:
|
||||
Nand(a=a, b=a, out=out1);
|
||||
Nand(a=b, b=b, out=out2);
|
||||
Nand(a=out1, b=out2, out=out);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
| a | b | out |
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 1 |
|
||||
| 1 | 0 | 1 |
|
||||
| 1 | 1 | 1 |
|
||||
@@ -14,4 +14,9 @@ CHIP Xor {
|
||||
|
||||
PARTS:
|
||||
// Put your code here:
|
||||
Nand(a=a, b=a, out=out1);
|
||||
Nand(a=b, b=b, out=out2);
|
||||
Nand(a=out1, b=b, out=out3);
|
||||
Nand(a=out2, b=a, out=out4);
|
||||
Nand(a=out3, b=out4, out=out);
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
| a | b | out |
|
||||
| 0 | 0 | 0 |
|
||||
| 0 | 1 | 1 |
|
||||
| 1 | 0 | 1 |
|
||||
| 1 | 1 | 0 |
|
||||
Reference in New Issue
Block a user