CSE 370 – Winter Number syst.; Logic functions- 1

Slides:



Advertisements
Similar presentations
Chapter 2 Logic Circuits.
Advertisements

ECE C03 Lecture 21 Lecture 2 Two Level Minimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
1 COMP541 Combinational Logic Montek Singh Jan 16, 2007.
Contemporary Logic Design Two-Level Logic © R.H. Katz Transparency No. 3-1 Chapter #2: Two-Level Combinational Logic Section 2.1, Logic Functions.
Computer Programming Skills Revision Prepared by: Ghader Kurdi.
Chapter 12 Digital Logic Circuit Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
+ CS 325: CS Hardware and Software Organization and Architecture Exam 1: Study Guide.
Chapter 2: Boolean Algebra and Logic Functions
1 Modified from  Modified from 1998 Morgan Kaufmann Publishers Chapter Three: Arithmetic for Computers citation and following credit line is included:
CSE 311 Foundations of Computing I Spring 2013, Lecture 3 Propositional Logic, Boolean Logic/Boolean Algebra 1.
CSI-2111 Computer Architecture Ipage Revision  Objective : To examine basic concepts of: –2.1 Numbering Systems –2.2 Binary Numbers –2.3 Boolean.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Logic Circuits I.
Course contents Chapter 1 - section 1.6 Chapter 2 - all sections Chapter – 4.7, and 4.12 Chapter , Chapter 6 - all sections.
Chapter 2 Two- Level Combinational Logic. Chapter Overview Logic Functions and Switches Not, AND, OR, NAND, NOR, XOR, XNOR Gate Logic Laws and Theorems.
1 Lecture 6 BOOLEAN ALGEBRA and GATES Building a 32 bit processor PH 3: B.1-B.5.
1 EG 32 Digital Electronics Thought for the day You learn from your mistakes..... So make as many as you can and you will eventually know everything.
CSE 311 Foundations of Computing I
CMP 100 Introduction to Computing Lecture Binary Numbers & Logic Operations.
1 Understand the examples again Overflow –When two positive numbers added together or a negative number subtracted from a positive number yields negative.
1 CS 352 Introduction to Logic Design Lecture 1 Ahmed Ezzat Number Systems and Boolean Algebra, Ch-1 + Ch-2.
CSE 461. Binary Logic Binary logic consists of binary variables and logical operations. Variables are designated by letters such as A, B, C, x, y, z etc.
Dr. ClincyLecture Slide 1 CS6020- Chapter 3 (3A and ) Dr. Clincy Professor of CS First Exam - Tuesday, September 6th Coverage: All subjects up to.
1 CSE370, Lecture 4 Lecture 4 u Logistics n HW1 due now n HW2 posted now and is due one week from today n Lab1 going on this week n Feedback on lectures,
Digital Logic.
Lecture 4 Logistics Last lecture --- Boolean algebra Today’s lecture
© Copyright 2004, Gaetano Borriello and Randy H. Katz
Chapter 11 (Part 1): Boolean Algebra
Chapter 2: Boolean Algebra and Logic Functions
CS Chapter 3 (3A and ) Part 1 of 8
14:332:231 DIGITAL LOGIC DESIGN Boolean Algebra
ECE 2110: Introduction to Digital Systems
Logistics Always read the Calendar at
Basic Digital Logic Systems
CS Chapter 3 (3A and ) Part 1 of 8
Fundamentals & Ethics of Information Systems IS 201
University of Gujrat Department of Computer Science
Basics Combinational Circuits Sequential Circuits
Dr. Clincy Professor of CS
CSE 311 Foundations of Computing I
Boolean Algebra.
Lecture 3 Boolean algebra
Lecture 4 Sums of Product Circuits Simplification
Digital Electronics & Logic Design
Dr. Clincy Professor of CS
CSE 370 – Winter Combinational Logic - 1
ELL100: INTRODUCTION TO ELECTRICAL ENGG.
CSE 370 – Winter 2002 – Comb. Logic building blocks - 1
CSE 370 – Winter 2002 – Logic minimization - 1
Combinatorial Logic Circuit
CSE 370 – Winter Combinational Implementation - 1
Dr. Clincy Professor of CS
January 19 W’05 Yutao He 4532B Boelter Hall CSM51A/EEM16-Sec.1 W’05
COMP541 Combinational Logic - II
Chapter 2 Introduction to Logic Circuits
Spring Combinational Logic - 1
CS Chapter 3 (3A and ) – Part 2 of 5
COMS 361 Computer Organization
Overview Part 1 – Design Procedure Part 2 – Combinational Logic
Number Systems Rayat Shikshan Sanstha’s
Chapter #2: Two-Level Combinational Logic
Logic Circuits I Lecture 3.
Lecture 3: Boolean Algebra
Lab Instructors will overview the MSP430
Number Systems Rayat Shikshan Sanstha’s
Lecture 4 Logistics Last lecture --- Boolean algebra Today’s lecture
Boolean Algebra Rayat Shikshan Sanstha’s
COMP541 Combinational Logic - 3
Lecture 2: Number Systems
Boolean Algebra Rayat Shikshan Sanstha’s
Lecture 3: Boolean Algebra
Presentation transcript:

CSE 370 – Winter 2002 - Number syst.; Logic functions- 1 Overview Last lecture: Abstraction and hierarchy in digital design Combinational vs. sequential systems High-level examples of combinational and sequential designs The whole course in 2 examples! In section Number systems Binary; 2’s complement Today Number systems (very quick review) Combinational logic Logic functions and truth tables 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 1

The basics binary numbers Base conversion (binary, octal, decimal, hexadecimal) Positional number system 1012=510 (1 * 22 + 0 * 21 + 1 * 20) 1478=10310 (1 * 82 + 4 * 81 + 7 * 80) Octal (base 8) 2C116=70510 (2 * 162 + 12 * 161 + 1 * 160) hexadecimal (base 16) Do it also for fractions Conversion between binary/octal/hex Binary: 10011110001 Octal: 10 | 011 | 110 | 001=23618 Hex: 100 | 1111 | 0001=4F116 Addition and subtraction are trivial, but worth practicing See Katz, appendix A 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 2

The basics base conversion Conversion from decimal to binary/octal/hex: divide by the base The digits are generated from least significant (rightmost) to most significant (leftmost) Why does it work (recall positional system) 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 3

CSE 370 – Winter 2002 - Number syst.; Logic functions- 4 Number systems How do we write negative binary numbers? We want same number of positive and negative representations (or as close to same as possible) How do we represent zero? How do we recognize easily if a number is positive or negative? Historically: Three approaches Sign and magnitude Ones complement Twos complement Twos complement makes addition and subtraction easy Used almost universally in present-day systems 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 4

Approach 1: Sign and magnitude The most-significant bit (msb) is the sign digit 0  positive 1  negative The remaining bits are the number’s magnitude Problem 1: Two representations for zero 0 = 0000 and also –0 = 1000 Problem 2: Arithmetic is cumbersome 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 5

Approach 2: Ones complement Negative number: Bitwise complement of positive number 0011  310 1100  –310 Solves the arithmetic problem Remaining problem: Two representations for zero 0 = 0000 and also –0 = 1111 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 6

Approach 3: Twos complement Negative number: Bitwise complement plus one 0011  310 1101  –310 Number wheel Note: one more negative number 0000 0001 0011 1111 1110 1100 1011 1010 1000 0111 0110 0100 0010 0101 1001 1101 + 1 + 2 + 3 + 4 + 5 + 6 + 7 – 8 – 7 – 6 – 5 – 4 – 3 – 2 – 1 Only one zero! msb is the sign digit 0  positive 1  negative 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 7

Twos complement (con’t) Complementing a complement restores the original number Arithmetic is easy We ignore the carry Same as a full rotation around the wheel Subtraction = negation and addition Easy to implement in hardware 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 8

CSE 370 – Winter 2002 - Number syst.; Logic functions- 9 Overflow Conditions: Sign bit changes Summing two positive numbers gives a negative result Summing two negative numbers gives a positive result 0000 0001 0011 1111 1110 1100 1011 1010 1000 0111 0110 0100 0010 0101 1001 1101 + 1 + 2 + 3 + 4 + 5 + 6 + 7 – 8 – 7 – 6 – 5 – 4 – 3 – 2 – 1 0000 0001 0011 1111 1110 1100 1011 1010 1000 0111 0110 0100 0010 0101 1001 1101 + 1 + 2 + 3 + 4 + 5 + 6 + 7 – 8 – 7 – 6 – 5 – 4 – 3 – 2 – 1 6 + 4  –6 –7 – 3  +6 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 9

Combinational logic topics Logic functions, truth tables, and switches NOT, AND, OR, NAND, NOR, XOR, . . . minimal set Axioms and theorems of Boolean algebra proofs by re-writing proofs by perfect induction Gate logic networks of Boolean functions time behavior Canonical forms two-level incompletely specified functions Simplification Boolean cubes and Karnaugh maps two-level simplification 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 10

Logic functions and truth tables X Y 0 0 1 1 Buffer (identity) X NOT X X’ AND X.Y XY OR X+Y X Y X Y 0 1 1 0 X Y X X Y Z 0 0 0 0 1 0 1 0 0 1 1 1 Z Y X Y Z 0 0 0 0 1 1 1 0 1 1 1 1 X Z Y 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 11

Logic functions and truth tables (ct’d) X Y Z 0 0 1 0 1 1 1 0 1 1 1 0 NAND X.Y XY NOR X+Y XOR X  Y X Z Y X Y Z 0 0 1 0 1 0 1 0 0 1 1 0 X Z Y X Y Z 0 0 0 0 1 1 1 0 1 1 1 0 X Z Y 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 12

Possible logic functions of two variables There are 16 possible functions of 2 input variables: in general, there are 2**(2**n) functions of n inputs X F Y X Y 16 possible functions (F0–F15) 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 X Y not Y not X X xor Y X = Y X and Y X nand Y X or Y X nor Y 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 13

Cost of different logic functions Different functions are easier or harder to implement each has a cost associated with the number of switches (transistors) needed 0 (F0) and 1 (F15): require 0 switches, directly connect output to low/high X (F3) and Y (F5): require 0 switches, output is one of inputs X' (F12) and Y' (F10): require 2 switches for "inverter" or not-gate X nor Y (F4) and X nand Y (F14): require 4 switches (cf. Katz page 677) X or Y (F7) and X and Y (F1): require 6 switches X = Y (F9) and X  Y (F6): require 16 switches thus, because NOT, NOR, and NAND are the cheapest they are the functions we implement the most in practice 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 14

Minimal set of functions All logic functions can be implemented from NOT, AND, and OR Can we do it with only 2 of the 3? Can we implement all logic functions from NOT, NOR, and NAND? For example, implementing X and Y is the same as implementing not (X nand Y) In fact, we can do it with only NOR or only NAND NOT is just a NAND or a NOR with both inputs tied together X’ = X nand X X’ = X nor X NAND and NOR are "duals", that is, it’s easy to implement one using the other X nand Y  not ( (not X) nor (not Y) ) X nor Y  not ( (not X) nand (not Y) ) 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 15

From (logic) expressions to gates More than one way to map expressions to gates e.g., Z = A' • B' • (C + D) = (A' • (B' • (C + D))) T2 T1 use of 3-input gate A Z A B T1 B Z C C T2 D D 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 16

What is the optimal gate realization? We can use the theorems and axioms of Boolean algebra to optimize our designs Design goals vary depending on the technology. For example: Reduce the number of inputs? (variables, e.g., A, X and their complements, e.g., A are also called literals) Reduce number of gates? Reduce number of levels? More options (e.g., limited fan-in and fan-out) How do we explore the trade-offs? CAD tools Logic minimization: Reduce number of gates and complexity Logic optimization: Minimization vs. speed and delay 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 17

The Mathematics: Boolean algebra A Boolean algebra is an algebraic structure that consists of a set of elements B; B = {0, 1} binary operations { + , • }; + is logical OR, • is logical AND and a unary operation { ' }; ' is logical NOT such that the following axioms (laws) hold: 1. the set B contains at least two elements, a, b, such that a  b 2. closure: a + b is in B a • b is in B 3. commutativity: a + b = b + a a • b = b • a 4. associativity: a + (b + c) = (a + b) + c a • (b • c) = (a • b) • c 5. identity: a + 0 = a a • 1 = a 6. distributivity: a + (b • c) = (a + b) • (a + c) a • (b + c) = (a • b) + (a • c) 7. complementarity: a + a' = 1 a • a' = 0 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 18

Logic functions and Boolean algebra Any logic function that can be expressed as a truth table can be written as an expression in Boolean algebra using the operators: ', +, and • X Y X • Y 0 0 0 0 1 0 1 0 0 1 1 1 X Y X' X' • Y 0 0 1 0 0 1 1 1 1 0 0 0 1 1 0 0 X Y X' Y' X • Y X' • Y' ( X • Y ) + ( X' • Y' ) 0 0 1 1 0 1 1 0 1 1 0 0 0 0 1 0 0 1 0 0 0 1 1 0 0 1 0 1 ( X • Y ) + ( X' • Y' )  X = Y Boolean expression that is true when the variables X and Y have the same value and false, otherwise X, Y are Boolean algebra variables 7/15/2019 CSE 370 – Winter 2002 - Number syst.; Logic functions- 19