I was trying to fill in some gaps and was looking at logic gates and the article said that all of them can be made from NAND. I loaded up my JS REPL and this is my first pass:
var lgs = {
nand: function (a, b) {
return !(a && b);
},
not: function (a) {
return lgs.nand(a, a);
},
and: function (a, b) {
return lgs.not(lgs.nand(a, b));
},
or: function (a, b) {
return lgs.nand(lgs.nand(a, a), lgs.nand(b, b));
},
nor: function (a, b) {
return lgs.not(lgs.or(a, b));
},
xor: function (a, b) {
return lgs.and(lgs.nand(a, b), lgs.or(a, b));
},
xnor: function (a, b) {
return lgs.not(lgs.xor(a, b));
}
};
Questions:
.
1.) can 'or' and 'xor' be simpler?
.
2.) why is it called 'xor'?
.
3.) are there any in browser simulators?
.
4.) where should I go from here?
http://www.amazon.com/Elements-Computing-Systems-Building-Pr...
http://books.google.com/books?id=THie6tt-2z8C&dq=the+ele...
which will seriously take you from logic gate/chip design all the way to scripting languages and an implementation of tetris on a java-esque language/vm. Totally awesome!
You can download the simulation software which is used in the book here if you want to play w/ logic gates/HDL etc. more http://www1.idc.ac.il/tecs/