1 i206: Lecture 3: Boolean Logic, Logic Circuits Marti Hearst Spring 2012.

Slides:



Advertisements
Similar presentations
Chapter 4 Gates and Circuits.
Advertisements

Cosc 2150: Computer Organization Chapter 3: Boolean Algebra and Digital Logic.
Computer Organization Computer Architecture, Data Representation, Information Theory i206 Fall 2010 John Chuang Some slides adapted from Marti Hearst,
Computer Organization Boolean Logic and the CPU i206 Fall 2010 John Chuang Some slides adapted from Marti Hearst, Brian Hayes, or Glenn Brookshear.
1 Foundations of Software Design Lecture 3: How Computers Work Marti Hearst Fall 2002.
Software Design Analysis of Algorithms i206 Fall 2010 John Chuang Some slides adapted from Glenn Brookshear, Marti Hearst, or Goodrich & Tamassia.
1 Digital Logic
Chapter 4 Gates and Circuits.
1 Foundations of Software Design Lecture 2: How Computers Work Marti Hearst Fall 2002.
Software Design i206 Fall 2010 John Chuang Some slides adapted from Glenn Brookshear, Brian Hayes, Marti Hearst, or James Landay.
Inter-Process Communication i206 Fall 2010 John Chuang Some slides adapted from Coulouris, Dollimore and Kindberg; Calvert and Donahoo.
Operating System & Memory Hierarchy i206 Fall 2010 John Chuang Some slides adapted from Glenn Brookshear, Brian Hayes, or Marti Hearst.
9/19/06 Hofstra University – Overview of Computer Science, CSC005 1 Chapter 4 Gates and Circuits.
Course Review i206 Fall 2010 John Chuang. 2 Outline  Test 3 topics  Course review  Course evaluation.

Distributed Systems & Networks i206 Fall 2010 John Chuang Some slides adapted from Coulouris, Dollimore and Kindberg.
16/07/2015CSE1303 Part B lecture notes 1 Hardware Implementation Lecture B17 Lecture notes section B17.
Part 2: DESIGN CIRCUIT. LOGIC CIRCUIT DESIGN x y z F F = x + y’z x y z F Truth Table Boolean Function.
Chapter 4 Gates and Circuits. 4–2 Chapter Goals Identify the basic gates and describe the behavior of each Describe how gates are implemented using transistors.
Introduction to Digital Logic Design Appendix A of CO&A Dr. Farag
Chapter 4 Gates and Circuits.
Quiz # 2 Chapters 4, 5, & 6.
Introduction to Computing Systems from bits & gates to C & beyond Chapter 3 Digital Logic Structures Transistors Logic gates & Boolean logic Combinational.
Chapter 4 Gates and Circuits. Integrated Circuits aka CHIPS What’s in this thing???? 4–2.
+ CS 325: CS Hardware and Software Organization and Architecture Combinational Circuits 1.
Digital Electronics. Introduction to Number Systems & Codes Digital & Analog systems, Numerical representation, Digital number systems, Binary to Decimal.
Introduction to Computing Systems from bits & gates to C & beyond Chapter 3 Digital Logic Structures Transistors Logic gates & Boolean logic Combinational.
CS1Q Computer Systems Lecture 9 Simon Gay. Lecture 9CS1Q Computer Systems - Simon Gay2 Addition We want to be able to do arithmetic on computers and therefore.
CPS120: Introduction to Computer Science
School of Computer Science G51CSA 1 Computer Systems Architecture Fundamentals Of Digital Logic.
1 i206: Lecture 18: Regular Expressions Marti Hearst Spring 2012.
1 The Chinese University of Hong Kong Faculty of Education Diploma in Education (Part-Time) Winter 1997 Educational Communications and Technology Assignment.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Monday, December 6 Assignment(s) due:Assignments #11(original or redo), #12 and #EC2 are due tonight Tonight is the last chance to turn in Quizzes #13.
Compsci Today’s topics l Binary Numbers  Brookshear l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive.
1 Boolean Algebra & Logic Gates. 2 Objectives Understand the relationship between Boolean logic and digital computer circuits. Learn how to design simple.
1 i206: Lecture 2: Computer Architecture, Binary Encodings, and Data Representation Marti Hearst Spring 2012.
Compsci Today’s topics l Binary Numbers  Brookshear l Slides from Prof. Marti Hearst of UC Berkeley SIMS l Upcoming  Networks Interactive.
מבנה מחשב תרגול 2. 2 Boolean AND Operation Truth Table Equivalent Gate Different notations:
4. Computer Maths and Logic 4.2 Boolean Logic Logic Circuits.
Chapter 7 Logic Circuits 1.State the advantages of digital technology compared to analog technology. 2. Understand the terminology of digital circuits.
1 i206: Lecture 4: The CPU, Instruction Sets, and How Computers Work Marti Hearst Spring 2012.
CHAPTER-2 Fundamentals of Digital Logic. Digital Logic Digital electronic circuits are used to build computer hardware as well as other products (digital.
Logic Gates Informatics INFO I101 February 3, 2003 John C. Paolillo, Instructor.
CS/COE0447 Computer Organization & Assembly Language
Logic Design / Processor and Control Units Tony Diep.
Chapter 3 Digital Logic Structures. Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 3-2 Transistor: Building.
Logic Design CS221 1 st Term combinational circuits Cairo University Faculty of Computers and Information.
Introduction to Computing Systems and Programming Digital Logic Structures.
Digital Logic Design Basics Combinational Circuits Sequential Circuits Pu-Jen Cheng Adapted from the slides prepared by S. Dandamudi for the book, Fundamentals.
WORKING PRINCIPLE OF DIGITAL LOGIC
Winter 2016CISC101 - Prof. McLeod1 Today How transistors can carry out commands in a CPU. For example, how to add two integers in an integrated circuit.
Logic Gates Dr.Ahmed Bayoumi Dr.Shady Elmashad. Objectives  Identify the basic gates and describe the behavior of each  Combine basic gates into circuits.
4–1. BSCS 5 th Semester Introduction Logic diagram: a graphical representation of a circuit –Each type of gate is represented by a specific graphical.
LOGIC CIRCUITLOGIC CIRCUIT. Goal To understand how digital a computer can work, at the lowest level. To understand what is possible and the limitations.
Chapter 3 Boolean Algebra and Digital Logic T103: Computer architecture, logic and information processing.
Everything is a number Everything in a computer memory and on storages is a number. Number  Number Characters  Number by ASCII code Sounds  Number.
DIGITAL LOGIC CIRCUITS
Why the interest in Queries?
University of Gujrat Department of Computer Science
Basics Combinational Circuits Sequential Circuits Ahmad Jawdat
Chapter 4 Gates and Circuits.
i206: Lecture 20: Memory Management; Operating Systems
CS105 Introduction to Computer Concepts GATES and CIRCUITS
Fundamentals of Computer Science Part i2
Digital Logic Structures Logic gates & Boolean logic
CISC101 Reminders Your group name in onQ is your grader’s name.
Logic Gates.
Digital Logic Circuits
Digital Circuits and Logic
Presentation transcript:

1 i206: Lecture 3: Boolean Logic, Logic Circuits Marti Hearst Spring 2012

2 Today Quick Binary Exercise Boolean Logic –deMorgan’s Law How Bits are Made Relating Boolean Logic to Circuits –Logic gates

3 Review Binary Binary used as a code Can use binary to encode a game representation. Shapes Actions Colors

4 Review Binary Two approaches: modular and efficient Modular: –Shape bits, then color bits, then action bits (circle, blue, jump) –Allows for expansion if you allow extra bits –Make it work for 7 colors: Efficient: –Minimize the number of bits needed –There are a total of 5 * 3 * 2 = 30 unique states So minimum number of bits = 5 –6 bits can support 7 * 3 * 2 = 42, for 7 colors, but would not be modular representation. Shape: 3 (2 bits) Color: 5 (3 bits) Action: 2 (1 bit) Shape: 3 (2 bits) Color: 5 (3 bits) Action: 2 (1 bit)

5 Boolean Logic CPU Operation Bits & Bytes Binary Numbers Number Systems Gates Boolean Logic Circuits CPU Machine Instructions Assembly Instructions Program Algorithms Application Memory Data compression Compiler/ Interpreter Operating System Data Structures Analysis I/O Memory hierarchy Design Methodologies/ Tools Process Truth table Venn Diagram DeMorgan ’ s Law Numbers, text, audio, video, image, … Decimal, Hexadecimal, Binary AND, OR, NOT, XOR, NAND, NOR, etc. Op-code, operands Instruction set arch Lossless v. lossy Info entropy & Huffman code Adders, decoders, Memory latches, ALUs, etc. Data Representation Data storage Principles Network Distributed Systems Security Cryptography Standards & Protocols Inter-process Communication Formal models Finite automata regex

6 How Do Computers Work? We are going bottom-up, with digressions Bits & BytesBinary Numbers Number Systems Orders of MagnitudeGates Boolean Logic Circuits CPUMachine Instructions Assembly Language Programming Languages Address Space Code vs. Data

7 Boolean Logic Boolean algebra = logical calculation of truth values (true/false values) Basic boolean operators –AND –OR –XOR (exclusive-OR) –NOT

8 Boolean Logic Where else have we seen this? Queries! –(“apple” OR “pear” OR “berry”) AND (“juice” OR “smoothie”) Venn Diagrams show Union and Intersection

9 Simple query language: Boolean –Terms + Connectors (or operators) –terms words normalized (stemmed) words phrases thesaurus terms –connectors AND OR NOT

10 Boolean Queries Cat Cat OR Dog Cat AND Dog (Cat AND Dog) (Cat AND Dog) OR Collar (Cat AND Dog) OR (Collar AND Leash) (Cat OR Dog) AND (Collar OR Leash)

11 Boolean Queries (Cat OR Dog) AND (Collar OR Leash) –Documents (columns) containing each of the following combinations satisfy this Boolean query: Catxxxx Dogxxxxx Collarxxxx Leashxxxx

12 Boolean Queries (Cat OR Dog) AND (Collar OR Leash) –None of the following combinations work; no documents returned: Catxx Dog xx Collarxx Leashxx

13 Boolean Notation U OperatorSymbolExample AND* or orA*B = AB = A B = AB OR+ or UA+B = A U B NOT¬ or ¯ or - ¬(A+B) = (A+B) = -(A+B) XORA B = AB + AB + U +

14 Boolean Queries –Usually expressed as INFIX operators in IR ((a AND b) OR (c AND b)) –NOT is UNARY PREFIX operator ((a AND b) OR (c AND (NOT b))) –AND and OR can be n-ary operators (a AND b AND c AND d) –Some rules - (De Morgan revisited) NOT(a) AND NOT(b) = NOT(a OR b) NOT(a) OR NOT(b)= NOT(a AND b) NOT(NOT(a)) = a

15 Boolean Logic Relationships A BC D Union (OR) Intersection (AND) Venn Diagram

16 Boolean Searching “ Measurement of the width of cracks in prestressed concrete beams ” Formal Query: cracks AND beams AND Width_measurement AND Prestressed_concrete Cracks Beams Width measurement Prestressed concrete

17 Boolean Logic and Venn Diagrams 3t33t3 1t11t1 2t22t2 1D11D1 2D22D2 3D33D3 4D44D4 5D55D5 6D66D6 8D88D8 7D77D7 9D99D9 10 D D 11 m1m1 m2m2 m3m3 m5m5 m4m4 m7m7 m8m8 m6m6 m 2 = t 1 t 2 t 3 m 1 = t 1 t 2 t 3 m 4 = t 1 t 2 t 3 m 3 = t 1 t 2 t 3 m 6 = t 1 t 2 t 3 m 5 = t 1 t 2 t 3 m 8 = t 1 t 2 t 3 m 7 = t 1 t 2 t 3

18 Boolean Logic and Logic Gates AND, OR, NOT, NOR, NAND, XOR Boolean Logic can be expressed as a Logic Gate Gates are devices that produce the outputs of Boolean operations when given the operations ’ input values –Often implemented as electronic circuits called transistors –Provide the building blocks from which computers are constructed Gates operate on inputs of 0 and 1 Gates are used to build up circuits that perform computations (e.g., addition, subtraction), or store values to be used later

19 AND, OR, XOR, and NOT: Gates and Truth Tables

20 Exercise Let ’ s solve a problem using Boolean Logic –First express the problem using Boolean expressions and/or truth table –Then implement solution using Boolean gates

21 Making Bits

22 Making Bits Digital signals are interpreted by a system as high and low states, –above and below a defined voltage threshold. In practice, especially at higher speeds, digital signals are rarely ideal with flat high and low levels and clean edge transitions.

23 NAND, NOR, XNOR NAND and NOR gates easier to implement in hardware than AND and OR gates Example: AND logic can be implemented with two NOTs and a NOR (DeMorgan ’ s Law) A B = A B

24 Inverter (NOT Gate) Implements the simplest Boolean operator “ NOT ” using two transistors Photolithography techniques used in fabrication of integrated circuit (IC) chips Image and further reading at:

25 NAND Gate NAND gate implemented using 4 transistors

26 Integrated Circuit (IC) Chips Contain Gates & Connectors Images from

27 LEDs (light-emitting diodes) Images from The circuit can turn the LED on or off.

28 Interactive demo of Boolean logic

29 Circuits for Binary Addition Half Adder Images from

30 Circuit Board for Half-Adder

31 Circuits for Binary Addition Full Adder Images from

32 Circuits for Binary Addition Full Adder, 4 bit output + carry Can link up an arbitrary number of input bits Can modify this easily to do subtraction Can also modify to do multiplication –How? –Usually division is done with a special floating point chip Images from

33 Flip-Flops Also called a latch Used to “ remember ” values Keep the same value until the input signals a change Example –Circuit with two inputs –Setting input A to 1 means “ set output to 1 ” –Setting input B to 1 means “ set output to 0 ” output Input A Input B

34 Simple Flip-Flop: The Problem –If both inputs change simultaneously, the final state of the latch cannot be determined ahead of time. This is called: A Race Condition: the result depends on which input got changed first. Nondeterministic: Not being able to predict what will happen with certainty. bad –Nondeterminism is very, very bad from the perspective of computer science (most of the time).

35 The clock –CPS (cycles per second): The measure of how frequently an alternating current changes direction. This term has been replaced by the term hertz (Hz). –gigahertz (GHz): A unit of frequency denoting 10 9 Hz.

36 Clock cycles Logic gates introduce propagation delays as the signal goes through them. Therefore, a clock cycle is introduced into the circuit. –It’s like a heart beat for the system. It connects up to all the circuits that need it, so they can all be told to update at the same time. –The clock cycle can be no faster than the slowest set of logic gates. The clock keeps the circuit running in a predictable fashion, by making sure every part of the circuit gets changes to input at the same time.

37 Clocked D Latch Solves the problem: Clock line allows the system to control when to read the inputs. BUT only allows for one input. Image from

38 Example; Linking Boolean to Circuits Lighting up a digital clock How are the LEDS for the digital clock controlled?

39 7 Segment LEDs Images from Need to control the inputs a through g Which ones are turned on to make a 5?

40 7 Segment LEDs: How to set the digits Images from

41 7 segment Digital Display How to turn on only 1 of the 4 digits at a time? Images from a b c d e f g p i1 i2 i3 i4

42 n-bit Decoder: Takes as input n inputs; turns on 1 (and only 1) of outputs Righthand image from AB W X Y Z a b c d e f g p ? ?

43 n-bit Decoder: Takes as input n inputs; turns on 1 (and only 1) of outputs Righthand image from Notice where the invertors are. They look like the inputs of a truth table. AB W X Y Z

44 Summary Quick Binary Exercise Boolean Logic –deMorgan’s Law How Bits are Made Relating Boolean Logic to Circuits –Logic gates Special gates: –Flip Flops –Adders –Decoders Next time: The CPU and instruction sets!