Lecture 4 - Basic gates

NOT

{ "width":500, "height":300, "showToolbox":false, "toolbox":[ ], "devices":[ {"type":"DC","id":"dev0","x":64,"y":112,"label":"DC"}, {"type":"Toggle","id":"dev1","x":168,"y":112,"label":"Toggle"}, {"type":"NOT","id":"dev2","x":296,"y":112,"label":"NOT"}, {"type":"LED","id":"dev3","x":392,"y":112,"label":"LED"} ], "connectors":[ {"from":"dev1.in0","to":"dev0.out0"}, {"from":"dev2.in0","to":"dev1.out0"}, {"from":"dev3.in0","to":"dev2.out0"} ] }

AND gate

Output high when both inputs are high
{ "width":500, "height":300, "showToolbox":false, "devices":[ {"type":"AND","id":"dev0","x":344,"y":112,"label":"AND"}, {"type":"LED","id":"dev1","x":440,"y":112,"label":"LED"}, {"type":"DC","id":"dev2","x":64,"y":112,"label":"DC"}, {"type":"Toggle","id":"dev3","x":168,"y":72,"label":"Toggle"}, {"type":"Toggle","id":"dev4","x":168,"y":144,"label":"Toggle"} ], "connectors":[ {"from":"dev0.in0","to":"dev3.out0"}, {"from":"dev0.in1","to":"dev4.out0"}, {"from":"dev1.in0","to":"dev0.out0"}, {"from":"dev3.in0","to":"dev2.out0"}, {"from":"dev4.in0","to":"dev2.out0"} ] }

OR gate

Output high when either input is high
{ "width":500, "height":300, "showToolbox":false, "devices":[ {"type":"LED","id":"dev0","x":440,"y":112,"label":"LED"}, {"type":"DC","id":"dev1","x":64,"y":112,"label":"DC"}, {"type":"Toggle","id":"dev2","x":168,"y":72,"label":"Toggle"}, {"type":"Toggle","id":"dev3","x":168,"y":144,"label":"Toggle"}, {"type":"OR","id":"dev4","x":336,"y":112,"label":"OR"} ], "connectors":[ {"from":"dev0.in0","to":"dev4.out0"}, {"from":"dev2.in0","to":"dev1.out0"}, {"from":"dev3.in0","to":"dev1.out0"}, {"from":"dev4.in0","to":"dev2.out0"}, {"from":"dev4.in1","to":"dev3.out0"} ] }

NAND gate

Output high unless both inputs are high. AND plus NOT is show for comparison.
{ "width":500, "height":300, "showToolbox":false, "devices":[ {"type":"DC","id":"dev0","x":64,"y":112,"label":"DC"}, {"type":"Toggle","id":"dev1","x":168,"y":72,"label":"Toggle"}, {"type":"LED","id":"dev2","x":448,"y":72,"label":"LED"}, {"type":"AND","id":"dev3","x":320,"y":144,"label":"AND"}, {"type":"NAND","id":"dev4","x":320,"y":72,"label":"NAND"}, {"type":"NOT","id":"dev5","x":384,"y":144,"label":"NOT"}, {"type":"LED","id":"dev6","x":448,"y":144,"label":"LED"}, {"type":"Toggle","id":"dev7","x":168,"y":144,"label":"Toggle"} ], "connectors":[ {"from":"dev1.in0","to":"dev0.out0"}, {"from":"dev2.in0","to":"dev4.out0"}, {"from":"dev3.in0","to":"dev1.out0"}, {"from":"dev3.in1","to":"dev7.out0"}, {"from":"dev4.in0","to":"dev1.out0"}, {"from":"dev4.in1","to":"dev7.out0"}, {"from":"dev5.in0","to":"dev3.out0"}, {"from":"dev6.in0","to":"dev5.out0"}, {"from":"dev7.in0","to":"dev0.out0"} ] }

NOR

Output when both inputs are low. OR plus NOT is shown for comparison.
{ "width":500, "height":300, "showToolbox":false, "devices":[ {"type":"DC","id":"dev0","x":64,"y":112,"label":"DC"}, {"type":"Toggle","id":"dev1","x":168,"y":72,"label":"Toggle"}, {"type":"Toggle","id":"dev2","x":168,"y":144,"label":"Toggle"}, {"type":"NOR","id":"dev3","x":336,"y":64,"label":"NOR"}, {"type":"LED","id":"dev4","x":448,"y":64,"label":"LED"}, {"type":"OR","id":"dev5","x":336,"y":152,"label":"OR"}, {"type":"NOT","id":"dev6","x":392,"y":152,"label":"NOT"}, {"type":"LED","id":"dev7","x":448,"y":152,"label":"LED"} ], "connectors":[ {"from":"dev1.in0","to":"dev0.out0"}, {"from":"dev2.in0","to":"dev0.out0"}, {"from":"dev3.in0","to":"dev1.out0"}, {"from":"dev3.in1","to":"dev2.out0"}, {"from":"dev4.in0","to":"dev3.out0"}, {"from":"dev5.in0","to":"dev1.out0"}, {"from":"dev5.in1","to":"dev2.out0"}, {"from":"dev6.in0","to":"dev5.out0"}, {"from":"dev7.in0","to":"dev6.out0"} ] }

XOR

Output high when exactly one input is high
{ "width":500, "height":300, "showToolbox":false, "devices":[ {"type":"LED","id":"dev0","x":440,"y":112,"label":"LED"}, {"type":"DC","id":"dev1","x":64,"y":112,"label":"DC"}, {"type":"Toggle","id":"dev2","x":168,"y":72,"label":"Toggle"}, {"type":"Toggle","id":"dev3","x":168,"y":144,"label":"Toggle"}, {"type":"EOR","id":"dev4","x":304,"y":112,"label":"EOR"} ], "connectors":[ {"from":"dev0.in0","to":"dev4.out0"}, {"from":"dev2.in0","to":"dev1.out0"}, {"from":"dev3.in0","to":"dev1.out0"}, {"from":"dev4.in0","to":"dev2.out0"}, {"from":"dev4.in1","to":"dev3.out0"} ] }

All at once!

{ "width":700, "height":500, "showToolbox": false, "devices":[ {"type":"Toggle","id":"dev0","x":168,"y":296,"label":"Toggle"}, {"type":"Toggle","id":"dev1","x":168,"y":168,"label":"Toggle"}, {"type":"DC","id":"dev2","x":64,"y":216,"label":"DC"}, {"type":"AND","id":"dev3","x":336,"y":128,"label":"AND"}, {"type":"OR","id":"dev4","x":336,"y":240,"label":"OR"}, {"type":"NAND","id":"dev5","x":336,"y":184,"label":"NAND"}, {"type":"NOR","id":"dev6","x":336,"y":296,"label":"NOR"}, {"type":"EOR","id":"dev7","x":336,"y":352,"label":"EOR"}, {"type":"LED","id":"dev8","x":424,"y":240,"label":"LED"}, {"type":"LED","id":"dev9","x":424,"y":128,"label":"LED"}, {"type":"LED","id":"dev10","x":424,"y":184,"label":"LED"}, {"type":"LED","id":"dev11","x":424,"y":296,"label":"LED"}, {"type":"LED","id":"dev12","x":424,"y":352,"label":"LED"} ], "connectors":[ {"from":"dev0.in0","to":"dev2.out0"}, {"from":"dev1.in0","to":"dev2.out0"}, {"from":"dev3.in0","to":"dev1.out0"}, {"from":"dev3.in1","to":"dev0.out0"}, {"from":"dev4.in0","to":"dev1.out0"}, {"from":"dev4.in1","to":"dev0.out0"}, {"from":"dev5.in0","to":"dev1.out0"}, {"from":"dev5.in1","to":"dev0.out0"}, {"from":"dev6.in0","to":"dev1.out0"}, {"from":"dev6.in1","to":"dev0.out0"}, {"from":"dev7.in0","to":"dev1.out0"}, {"from":"dev7.in1","to":"dev0.out0"}, {"from":"dev8.in0","to":"dev4.out0"}, {"from":"dev9.in0","to":"dev3.out0"}, {"from":"dev10.in0","to":"dev5.out0"}, {"from":"dev11.in0","to":"dev6.out0"}, {"from":"dev12.in0","to":"dev7.out0"} ] }

Sand box

Build your own circuits here
{ "width":700, "height":500, "showToolbox":true, "toolbox":[ {"type":"In"}, {"type":"Out"}, {"type":"DC"}, {"type":"LED"}, {"type":"PushOff"}, {"type":"PushOn"}, {"type":"Toggle"}, {"type":"BUF"}, {"type":"NOT"}, {"type":"AND"}, {"type":"NAND"}, {"type":"OR"}, {"type":"NOR"}, {"type":"EOR"}, {"type":"ENOR"}, {"type":"OSC"}, {"type":"7seg"}, {"type":"16seg"}, {"type":"4bit7seg"}, {"type":"RotaryEncoder"}, {"type":"BusIn"}, {"type":"BusOut"}, {"type":"RS-FF"}, {"type":"JK-FF"}, {"type":"T-FF"}, {"type":"D-FF"}, {"type":"8bitCounter"}, {"type":"HalfAdder"}, {"type":"FullAdder"}, {"type":"4bitAdder"}, {"type":"2to4BinaryDecoder"}, {"type":"3to8BinaryDecoder"}, {"type":"4to16BinaryDecoder"} ], "devices":[ {"type":"LED","id":"dev0","x":440,"y":112,"label":"LED"}, {"type":"DC","id":"dev1","x":64,"y":112,"label":"DC"}, {"type":"Toggle","id":"dev2","x":168,"y":72,"label":"Toggle"}, {"type":"Toggle","id":"dev3","x":168,"y":144,"label":"Toggle"}, {"type":"OR","id":"dev4","x":336,"y":112,"label":"OR"} ], "connectors":[ {"from":"dev0.in0","to":"dev4.out0"}, {"from":"dev2.in0","to":"dev1.out0"}, {"from":"dev3.in0","to":"dev1.out0"}, {"from":"dev4.in0","to":"dev2.out0"}, {"from":"dev4.in1","to":"dev3.out0"} ] }