Presentation is loading. Please wait.

Presentation is loading. Please wait.

CSC 110 - Intro. to Computing Lecture 5: Boolean Logic, Gates, & Circuits.

Similar presentations


Presentation on theme: "CSC 110 - Intro. to Computing Lecture 5: Boolean Logic, Gates, & Circuits."— Presentation transcript:

1 CSC 110 - Intro. to Computing Lecture 5: Boolean Logic, Gates, & Circuits

2 Announcements Quiz at end of class on Thursday  Covers converting numbers between bases Homework assignment handed out next Tuesday  Will include material from this week’s lectures CSC tutors are now available  Hours posted outside Wehle 206 & 208

3 George Boole Mathematician from English middle-class  Lived from 1815 – 1864  Started work at age 16 as a teaching assistant Held two assistantships to support family Later opened his own school Ultimately appointed a Prof. at Queen’s College  Published Mathematical Analysis of Logic in 1847

4 Mathematical Analysis of Logic Boole’s book used algebraic analysis to creating a logical system  Initially limited world to only “1” and “0” All other values were defined from these  Devised rules of addition, subtraction, and multiplication  Basis for modern field of symbolic logic  World thought work was of little importance

5 Algebra Review In algebra, define variables & functions  Variables used as placeholder for actual value E.g., 3x = 154y = 43a + 6b = 12  Functions map input values to output values E.g., f(x) = 3xg(z) = z 2 + 3z + 2  We can define new variables using functions E.g., y = f(x)h = f(g(y))

6 Boolean Algebra Name given to Boole’s system of logic System consists of two values  Think of them as “true” and “false” Logical functions take 1 or more input(s)  But still return only one of the two values You already know basic boolean functions  Work exactly as you would expect

7 Truth Table Normal way to evaluate Boolean functions Each table covers all function inputs…  …but Boolean algebra only has 2 values  A function with n input variables, has how many different possible inputs? Not nearly as complicated as it sounds

8 Boolean Function: NOT NOT is simplest function  Accepts a single input  Outputs if the input is NOT true NOT returns “the negation of the input”  Written as E.g., x is true if a is NOT true

9 Boolean Function: OR OR takes two inputs  Written as  Returns true if either input is true x will be true if either a OR b are true

10 Boolean Function: AND AND also takes two inputs  Written as  Returns true if both inputs are true x will be true if a AND b are true

11 Boolean Function: XOR First slightly unfamiliar function XOR  XOR performs “exclusive or” on two inputs  Written as x will be true if either a or b is true, but not both

12 Boolean Function: NAND NAND computes NEGATIVE AND  Written as Combines notation for AND & NOT  Returns true if either input is not true x will be false if both a AND b are true

13 Boolean Function: NOR Last function is NEGATIVE OR  Written as Shown as the negation (NOT) of the OR result  Returns true if both inputs are not true x will be false if either a OR b are true

14 George Boole: 1World: 0 Turns out Boolean algebra is VITAL  Basis for nearly all computer hardware  “Last useful thing done by anyone claimed by computer scientists” -- said by former colleague of mine (he is a hardware engineer)

15 Boolean Logic in Computers Use “1” and “0”, not “true” and “false” True  1 False  0  Changes terminology, but not results  For XOR:

16 Gate Piece of hardware which combines electrical signal input(s) to generate an output signal  Computer signals range from 0 – 5 volts 0 – 2 volts is “low” --- in “0” state 2 – 5 volts is “high” and in “1” state 6 gates commonly used today:  NOT, OR, AND, XOR, NAND, NOR

17 Logic Diagrams Another way of writing Boolean functions  Logic diagrams are more gate-centric (rather than the math-centric equations from before) Highlight the electronic nature of gates  Draws function inputs and outputs as wires  Makes drawing combinations of gates (“circuits”) much easier

18 Logic Diagrams a x a b x a b x

19 a b x a b x a b x

20 Extended Boole’s Algebra Algebra includes ability to combine functions  E.g., f(x) = 3x + 5; g(x) = 6x; g(f(x)) = 18x + 30 Functions can also be composed in boolean algebra  Computers do more than negate a single bit!  Truth tables show these results, too!

21 Extended Truth Tables Consider

22 Extended Logic Diagrams Combination of gates called a circuit How could we draw ?

23 Circuit Costs Several ways to analyze circuits  Cost – Additional gates costs money Reducing gates also reduces design complexity This is how programmers tend to evaluate designs  Time – Minimize number of gate levels Each consecutive gate takes time This is how hardware people evaluate designs Cheapest circuit is rarely the fastest

24 Algebraic Properties of Logic Algebra enables proof of important properties Properties allow proofs of circuit equivalence  E.g. Show two circuits have same output  Allows for faster or cheaper circuits

25 Algebraic Properties

26 Improving Circuit Design Use properties to remove unneeded gates Often an iterative process

27 DeMorgan’s Laws Most laws included in many algebraic systems Two particular to logical systems  Initially stated in present form by Prof. DeMorgan  Useful for evaluating & simplifying circuits  Also good test questions

28 Adders Two important circuits are the half-adder and full-adder  Half-adder adds two bits and outputs results  Full-adders sums two input bits and a carry bit from another adder and outputs results  Why use a half-adder rather than full-adder?

29 Half-Adder How will this work?

30 Full-Adder Why is this so much more complex?

31 Multiplexers Also known as a mux General purpose circuits which select a single input value to allow to pass through based upon the value of special input signals  Inputs called select signals or select control lines

32 Multiplexer The multiplexer selects which of the input lines (D0 – D7) to route through to the output F, based upon the value of the control lines (S0, S1, and S2). Figure 4.11 A block diagram of a multiplexer with three select control lines

33 For next lecture Study! Finish reading section 4 Be ready to discuss  Combinatorial vs. sequential circuits  Latches & how memory is constructed  How gates, circuits, & large chips are made


Download ppt "CSC 110 - Intro. to Computing Lecture 5: Boolean Logic, Gates, & Circuits."

Similar presentations


Ads by Google