Boolen Logic Building Modern Computer From First Principles www.nnd2tetris.org Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 1
Usge nd Copyright Notice: Copyright Nom Nisn nd Shimon Schocken This presenttion ccompnies the textook The Elements of Computing Systems y Nom Nisn & Shimon Schocken, MIT Press, 2005. We provide 13 such presenttions. Ech presenttion is designed to support 3 hours of clssroom or self-study instruction. You re welcome to use or edit this presenttion s you see fit for instructionl nd noncommercil purposes. If you use our ook nd course mterils, plese include reference to www.nnd2tetris.org If you hve ny questions or comments, plese write us t nnd2tetris@gmil.com This work is licensed under Cretive Commons Attriution-NonCommercil-ShreAlike 3.0 Unported License. Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 2
Boolen lger Some elementry Boolen functions: Not(x) And(x,y) Or(x,y) Nnd(x,y) Boolen functions: x y z f ( x, y, z) = ( x + y) z x Not(x) 0 1 1 0 x y Or(x,y) 0 0 0 0 1 1 1 0 1 1 1 1 x y And(x,y) 0 0 0 0 1 0 1 0 0 1 1 1 x y Nnd(x,y) 0 0 1 0 1 1 1 0 1 1 1 0 0 0 0 0 0 0 1 0 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 1 1 1 1 0 A Boolen function cn e expressed using functionl expression or truth tle expression Importnt oservtion: Every Boolen function cn e expressed using And, Or, Not. Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 3
Boolen lger Given: Nnd(,), flse We cn uild: Not() = Nnd(,) true = Not(flse) And(,) = Not(Nnd(,)) George Boole, 1815-1864 ( A Clculus of Logic ) Or(,) = Not(And(Not(),Not())) Xor(,) = Or(And(,Not()),And(Not(),))) Etc. Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 4
Multiplexer sel 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 Mux sel sel 0 1 Proposed Implementtion: sed on Not, And, Or gtes. Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 5
Exmple: Building n And gte And.cmp Contrct: And 0 0 0 0 1 0 1 0 0 1 1 1 When running your.hdl on our.tst, your. should e the sme s our.cmp. And.hdl And.tst CHIP And { IN, ; OUT ; // implementtion missing } lod And.hdl, put-file And., compre-to And.cmp, put-list ; set 0,set 0,evl,put; set 0,set 1,evl,put; set 1,set 0,evl,put; set 1, set 1, evl, put; Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 6
Building n And gte Interfce: And(,) = 1 exctly when ==1 And And.hdl CHIP And { IN, ; OUT ; // implementtion missing } Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 7
Building n And gte Implementtion: And(,) = Not(Nnd(,)) And.hdl CHIP And { IN, ; OUT ; // implementtion missing } Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 8
Building n And gte Implementtion: And(,) = Not(Nnd(,)) Nnd x in Not And.hdl CHIP And { IN, ; OUT ; // implementtion missing } Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 9
Building n And gte Implementtion: And(,) = Not(Nnd(,)) NAND x in NOT And.hdl CHIP And { IN, ; } OUT ; Nnd( =, =, = x); Not(in = x, = ) Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 10
Hrdwre simultor (demonstrting Xor gte construction) HDL progrm test script Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 11
Hrdwre simultor HDL progrm Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 12
Hrdwre simultor HDL progrm put file Elements of Computing Systems, Nisn & Schocken, MIT Press, www.nnd2tetris.org, Chpter 1: Boolen Logic slide 13