Chapter 2: Universal Building Blocks. CS105: Great Insights in Computer Science

Similar documents
Combinational Circuits Digital Logic (Materials taken primarily from:

Binary Adders: Half Adders and Full Adders

Standard Forms of Expression. Minterms and Maxterms

Propositional Calculus: Boolean Algebra and Simplification. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

1. Mark the correct statement(s)

QUESTION BANK FOR TEST

ENGIN 112 Intro to Electrical and Computer Engineering

Assignment (3-6) Boolean Algebra and Logic Simplification - General Questions

Binary Values. CSE 410 Lecture 02

EE292: Fundamentals of ECE

CS2630: Computer Organization Homework 1 Bits, bytes, and memory organization Due January 25, 2017, 11:59pm

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

Circuit analysis summary

Propositional Calculus. Math Foundations of Computer Science

Designing Information Devices and Systems II Fall 2017 Miki Lustig and Michel Maharbiz Discussion 1B

Digital Logic Design Exercises. Assignment 1

(Refer Slide Time 3:31)

Department of Electrical Engineering McGill University ECSE 221 Introduction to Computer Engineering Assignment 2 Combinational Logic

Read this before starting!

Logic Gates and Boolean Algebra ENT263

LSN 4 Boolean Algebra & Logic Simplification. ECT 224 Digital Computer Fundamentals. Department of Engineering Technology

CARLETON UNIVERSITY. Laboratory 2.0

Experiment 4 Boolean Functions Implementation

Lecture #21 March 31, 2004 Introduction to Gates and Circuits

60-265: Winter ANSWERS Exercise 4 Combinational Circuit Design

LOGIC CIRCUITS. Kirti P_Didital Design 1

Basic Arithmetic (adding and subtracting)

GC03 Boolean Algebra

LECTURE 4. Logic Design

1010 2?= ?= CS 64 Lecture 2 Data Representation. Decimal Numbers: Base 10. Reading: FLD Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

DKT 122/3 DIGITAL SYSTEM 1

Read this before starting!

Logic Design: Part 2

Designing Information Devices and Systems II Spring 2018 J. Roychowdhury and M. Maharbiz Discussion 1A

Midterm Exam Review. CS 2420 :: Fall 2016 Molly O'Neil

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

Section 001. Read this before starting!

CSC 101: Lab #5 Boolean Logic Practice Due Date: 5:00pm, day after lab session

Read this before starting!

Combinational Logic Worksheet

Lecture (04) Boolean Algebra and Logic Gates

Lecture (04) Boolean Algebra and Logic Gates By: Dr. Ahmed ElShafee

Discrete structures - CS Fall 2017 Questions for chapter 2.1 and 2.2

Experimental Methods I

UNCA CSCI 255 Exam 1 Spring February, This is a closed book and closed notes exam. It is to be turned in by 1:45 PM.

Bawar Abid Abdalla. Assistant Lecturer Software Engineering Department Koya University

Bits and Bytes. How do computers compute?

Henry Lin, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 7 (Digital Logic) July 24 th, 2012

Unit 2: Data Storage CS 101, Fall 2018

Chapter 4: The Building Blocks: Binary Numbers, Boolean Logic, and Gates. Invitation to Computer Science, C++ Version, Third Edition

1. Boolean algebra. [6] 2. Constructing a circuit. [4] 3. Number representation [4] 4. Adders [4] 5. ALU [2] 6. Software [4]

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

Read this before starting!

2.6 BOOLEAN FUNCTIONS

Propositional Calculus. CS 270: Mathematical Foundations of Computer Science Jeremy Johnson

(Refer Slide Time 6:48)

CS140 Lecture 03: The Machinery of Computation: Combinational Logic

Read this before starting!

Grade 7/8 Math Circles Fall November 6/7/8 Boolean Logic

Lecture 3: Binary Subtraction, Switching Algebra, Gates, and Algebraic Expressions

Grade 7/8 Math Circles Fall November 6/7/8 Boolean Logic

Combinational Circuits

6. Combinational Circuits. Building Blocks. Digital Circuits. Wires. Q. What is a digital system? A. Digital: signals are 0 or 1.

Chapter 2. Boolean Expressions:

Binary. Hexadecimal BINARY CODED DECIMAL

ENGIN 112. Intro to Electrical and Computer Engineering

Read this before starting!

01 Introduction to Digital Logic. ENGR 3410 Computer Architecture Mark L. Chang Fall 2006

Address Class (Exercise) B A

Starting Boolean Algebra

COMP combinational logic 1 Jan. 18, 2016

MODULE 5 - COMBINATIONAL LOGIC

2. BOOLEAN ALGEBRA 2.1 INTRODUCTION

Lecture 10: Floating Point, Digital Design

Introduction to Boolean logic and Logical Gates

At this point in our study of digital circuits, we have two methods for representing combinational logic: schematics and truth tables.

This podcast will demonstrate a logical approach as to how a computer adds through logical gates.

CSC 101: Lab #5 Prelab Boolean Logic Practice Due Date: 5:00pm, day after lab session

01 Introduction to Digital Logic. ENGR 3410 Computer Architecture Mark L. Chang Fall 2008

Computer Organization and Levels of Abstraction

CDS Computing for Scientists. Midterm Exam Review. Midterm Exam on October 22, 2013

4. Write a sum-of-products representation of the following circuit. Y = (A + B + C) (A + B + C)

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

Data III & Integers I

Lecture 10: Floating Point, Digital Design

CS 261 Fall Mike Lam, Professor. Logic Gates

ECE 2030D Computer Engineering Spring problems, 5 pages Exam Two 8 March 2012

Course Syllabus [1/2]

Data III & Integers I

DIGITAL CIRCUIT LOGIC UNIT 7: MULTI-LEVEL GATE CIRCUITS NAND AND NOR GATES

Computer Organization and Levels of Abstraction

Philadelphia University Student Name: Student Number:

SYNERGY INSTITUTE OF ENGINEERING & TECHNOLOGY,DHENKANAL LECTURE NOTES ON DIGITAL ELECTRONICS CIRCUIT(SUBJECT CODE:PCEC4202)

Spring 2010 CPE231 Digital Logic Section 1 Quiz 1-A. Convert the following numbers from the given base to the other three bases listed in the table:

COSC 243. Data Representation 3. Lecture 3 - Data Representation 3 1. COSC 243 (Computer Architecture)

LAB #3: ADDERS and COMPARATORS using 3 types of Verilog Modeling


Chapter 4. Combinational Logic

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 09 MULTIPLEXERS

Transcription:

Chapter 2: Universal Building Blocks CS105: Great Insights in Computer Science

Homework 1 It is now available on our website. Answer questions in Word or any text editor and upload it via sakai. No paper please. Office hours for three TAs and me are posted on the website DUE NEXT WEDNESDAY, SEPT 23rd

Clicker Questions!

Review, OR and

Bit Equality The input to the function or circuit has two bits bit1, bit2 The output of the function is one bit out1 The output is true only if the value of both bits is the same. Example, if bit1 = true and bit2 = true, these bits would be equal. First, create a truth table

Bit Equality Now, we have truth table, which describes all the information about the function We can make either a logical function or a circuit, because they represent the same thing Second, make a Boolean function!

Truth Table to Formula If table is mostly False... 1. Make a clause for each True. - not A and not B and C - not A and B and C 2. Or them together. - (not A and not B and C) or (not A and B and C) 3. Simplify, if possible A B C D F F F F F F T T F T F F F T T T T F F F T F T F T T F F T T T F - D = (not A and C) or (not B and B) = not A and C

Truth Table to Formula If table is mostly True... 1. Make a clause for each False. - not A and B and not C - A and B and C 2. Or them together. - (not A and B and not C) or (A and B and C) 3. Simplify, if possible - B and ((not A and not C) or (A and C)) = B and (A=C) 4. Invert via DeMorgan s Law - D = not(b and (A=C)) = not B or (A xor C)) A B C D F F F T F F T T F T F F F T T T T F F T T F T T T T F T T T T F

Bit Equality, Part Deux Lastly, we can make a representation using only, OR and gates from our logical expression!

Bit Equality Input: bit1, bit2: Output: out1 = ((bit1 and bit2) or (not bit1 and not bit2)) bit1 bit2 equal OR out1 Output True if either bit1 = True and bit2 = True or bit1 = False and bit2 = False (they are equal).

Group Equality Now that we can test two bits for equality, we would like to test a group of 5 bits for equality (two bit patterns). Two groups are equal if each of their bits are equal: bit 0 = bit 0, bit 1 = bit 1, etc. Input: char1, char2 Output: (equal(char1[0],char2[0]) and (equal(char1[1],char2[1]) and (equal(char1[2],char2[2]) and (equal(char1[3],char2[3]) and equal(char1[4],char2[4])))))

equal5 Equal5 Diagram equal OR char1 char2 equal OR equal OR equal OR equal OR 0 1 2 3 4 0 1 2 3 4 EQUAL EQUAL EQUAL EQUAL EQUAL 5

equal5 Equal5 Diagram equal OR char1 char2 equal OR equal OR equal OR equal OR 0 1 2 3 4 0 1 2 3 4 5

Equal5 Diagram OR equal OR char1 char2 0 1 2 3 4 0 1 2 3 4 equal OR equal OR equal equal5 OR equal

Gates in EQUAL5 10 inputs (2 groups of 5), 1 output bit. The equal5 gate consists of - 1 and5 gate - 4 and gates (4 total) - 5 equal gates - 2 and, 2 not, 1 or (5 total) - Total = 29 gates

Gates: Could Create And-k: k ins, 1 out (True if all ins are True) Or-k: k ins, 1 out (True if any ins are True) Equal-k: 2 k-bit blocks in, 1 out (True if blocks same) And many other interesting functions

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). n Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n. n 2 2n

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). n 2 2n 0 2 Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). n 2 2n 0 2 Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). n 2 2n 0 2 1 4 Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). n 2 2n 0 2 1 4 Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). n 2 2n 0 2 1 4 2 16 Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). n 2 2n 0 2 1 4 2 16 Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. n 2 2n 0 2 1 4 2 16 3 256 For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. n 2 2n 0 2 1 4 2 16 3 256 For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. n 2 2n 0 2 1 4 2 16 3 256 4 65536 For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. n 2 2n 0 2 1 4 2 16 3 256 4 65536 For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. n 2 2n 0 2 1 4 2 16 3 256 4 65536 5 4294967296 For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. n 2 2n 0 2 1 4 2 16 3 256 4 65536 5 4294967296 For n inputs: 2 2n.

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n. n 2 2n 0 2 1 4 2 16 3 256 4 65536 5 4294967296 6

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n. n 2 2n 0 2 1 4 2 16 3 256 4 65536 5 4294967296 6

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n. n 2 2n 0 2 1 4 2 16 3 256 4 65536 5 4294967296 6 7

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n. n 2 2n 0 2 1 4 2 16 3 256 4 65536 5 4294967296 6 7

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n. n 2 2n 0 2 1 4 2 16 3 256 4 65536 5 4294967296 6 18446744073709551616 7

Counting Boolean Functions With 2 input bits, there are 2 2 =4 rows of the truth table (combinations of truth assignments to these variables). Each row can take an output of true or false, for a total of 2 4 =16 tables. For n inputs: 2 2n. n 2 2n 0 2 1 4 2 16 3 256 4 65536 5 4294967296 6 7 18446744073709551616 34028236692093846346 3374607431768211456

Universal Gate A B Take two inputs, A and B. Take four more inputs defining what the gate should output for each combination of A and B. d00 d01 d10 UNIV2 3 3 3 Output the right bit! d11 3 OR4

Algebraic Version Input: (A, B, d00, d01, d10, d11): w = 3(not A, not B, d00) x = 3(not A, B, d01) y = 3(A, not B, d10) z = 3(A, B, d11) Output: OR4(w,x,y,z) hard to follow...

Can Represent Them All Almost all multi-input functions require an enormous number of logic gates. However, the most useful ones can be represented succinctly.

Binary Numbers!

Magic Trick?

Reminder: Decimal Notation 2 0 7 1000 100 10 1 10 3 10 2 10 1 10 0 2x100 +0x10 +7x1 = 207

Binary Notation 1 0 0 1 1 0 1 0 128 64 32 16 8 4 2 1 2 7 2 6 2 5 2 4 2 3 2 2 2 1 2 0 1x128+0x64+0x32+1x16+1x8+0x4+1x2+0x1 = 154 How can you tell if a binary number is even?

Conversion To Binary To go from decimal to binary, start with the biggest power of 2 no bigger than your number. Write down a 1. Subtract the power of 2 from your number. Cut the power of 2 in half. If your remaining number is larger than the power of 2, write down a 1 and subtract the power of 2. If not, write down 0. Repeat by cutting the power of 2 in half (until you get to 1).

Conversion To Binary To go from decimal to binary, start with the biggest power of 2 no bigger than your number. If your remaining number is larger than the power of 2, write down a 1 and subtract the power of 2. Write down a 1. Subtract the power of 2 from your number. If not, write down 0. Repeat by cutting the power of 2 in half (until you get to 1). Cut the power of 2 in half. It s a bit like making change.

Example: Convert 651 Bigger than: 2 9 = 512. 1 Next power of 2 = 16. 0 651-512=139. Next power of 2 = 8. 1 Next power of 2 = 256. 0 11-8=3 Next power of 2 = 128. 1 Next power of 2 = 4. 0 139-128=11. Next power of 2 = 2. 1 Next power of 2 = 64. 0 3-2=1 Next power of 2 = 32. 0 Last power of 2 = 1. 1010001011=651 1

Welcome to the Club There are 10 kinds of people in the world. Those who understand binary. And those who don t.