Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Hardware Logic Diagrams - The Basics Marshall Thomas CIS 21JA – Fall Quarter 2012 Objectives • Explain some hardware concepts at a high level – appropriate for ASM SW Engineers. • Show the graphical pictures that the hardware folks use to describe logic diagrams. • Show how De Morgan’s theorem can be represented graphically. • Explain the equations and “what is going on” in Lab 5 Terminology • “High” => High voltage or “true” or “1” • “Low” => Low voltage or “false” or “0”. • These mean the same: => high, true, logical “1” => low, false, logical “0”. • A means: A is true when it is low, sometimes written *A (over_scores are hard to type), not the same meaning as !A • AdressBit0 means that AddressBit0 is true when this voltage is “false”, not the same in as !AddressBit0. Voltage Levels • There is uncertainty between what is “sent” and what is “received”. • This uncertainty can and does happen! This is a problem for hardware folks. Inversion at every gate • This is “how the hardware works” • This is the fastest way • If there is an inverted and a non-inverted output, the inverted output is faster • Easiest example is an “open collector” output +5V R Input output Basic Gates / Symbols • AND • OR • INVERTER • NAND • NOR NAND / “OR” Duality • NAND Gate : • If it takes two “highs” to get “low”. Doesn’t that mean that any low on any input input gives a high on the output? • So, another way to draw the exact same hardware part is: NOR / “AND” Duality • NOR Gate: • If any high gives a low, then doesn’t it take all low’s to give a high? • Another way to draw the exact same physical part: De Morgan’s Theorem • A or B A and B • A and B A or B • Swap the bubbles and the symbols XOR • Many students freak out about XOR, but is it not that complicated! • If the 2 inputs are the same: you get ”false”, 0, or “even” • If the 2 inputs are different: you get “true”, 1 or “odd”. • It is as simple as that – think “odd” or “even” • This simple thing can be used for numeric addition, calculating parity (the number of even or odd bits that are turned on in an variable), and even polynomial division! Half Adder • XOR Version A B Sum Even Carry Odd • Gate Version (same) A B Sum Carry A B sum Carry 0 1 1 0 0 1 0 1 0 1 0 0 0 0 1 1 Sum = (A+B) and AB Sum is “1” if A or B is true, unless: A and B are both true, Then sum=0 with carry Full Adder • Incorporates the Carryin • This combines 2 half-adders with an “or” A B Cin Sum Sum=1 if A,B,C Are odd Cout Note: all Nand gates Cout = (A and B) or ( (A xor B) and Cin)) Cout= ab + bc + ac Cout= ab + bc + ac • The cascading XOR’s can do the sum: Sum is “1” if combination of (A,B,C) is odd, else sum is “0” • 1+1 = 0 (sum is even) with carry 1+1+1= 1 (sum is odd) with carry • The tricky part is the carry. • We are adding 3 bits together, if any 2 of these bits are “1”, we get a carry. If all 3 are “1”, we still get a carry although the sum is different. Full Adder Truth Table Even => Sum =0 Odd => Sum =1 Cout if any 2 inputs are “1” A B Cin Sum 2 bit Cout sum 0 0 1 0 1 0 0 1 1 0 0 0 00 10 10 0 1 1 1 0 0 1 1 0 1 0 0 1 0 0 0 1 1 1 10 01 01 01 1 0 0 0 1 1 1 1 11 1