Download presentation
Presentation is loading. Please wait.
Published byJoseph Kurzmann Modified over 5 years ago
1
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 Number syst.; Logic functions- 1
2
The basics binary numbers
Base conversion (binary, octal, decimal, hexadecimal) Positional number system 1012=510 (1 * * * 20) 1478=10310 (1 * * * 80) Octal (base 8) 2C116=70510 (2 * * * 160) hexadecimal (base 16) Do it also for fractions Conversion between binary/octal/hex Binary: Octal: | 011 | 110 | 001=23618 Hex: | 1111 | 0001=4F116 Addition and subtraction are trivial, but worth practicing See Katz, appendix A 7/15/2019 CSE 370 – Winter Number syst.; Logic functions- 2
3
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 Number syst.; Logic functions- 3
4
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 Number syst.; Logic functions- 4
5
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 Number syst.; Logic functions- 5
6
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 Number syst.; Logic functions- 6
7
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 Number syst.; Logic functions- 7
8
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 Number syst.; Logic functions- 8
9
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 Number syst.; Logic functions- 9
10
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 Number syst.; Logic functions- 10
11
Logic functions and truth tables
X Y Buffer (identity) X NOT X X’ AND X.Y XY OR X+Y X Y X Y X Y X X Y Z Z Y X Y Z X Z Y 7/15/2019 CSE 370 – Winter Number syst.; Logic functions- 11
12
Logic functions and truth tables (ct’d)
X Y Z NAND X.Y XY NOR X+Y XOR X Y X Z Y X Y Z X Z Y X Y Z X Z Y 7/15/2019 CSE 370 – Winter Number syst.; Logic functions- 12
13
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 possible functions (F0–F15) 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 Number syst.; Logic functions- 13
14
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 Number syst.; Logic functions- 14
15
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 Number syst.; Logic functions- 15
16
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 Number syst.; Logic functions- 16
17
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 Number syst.; Logic functions- 17
18
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 Number syst.; Logic functions- 18
19
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 1 1 1 X Y X' X' • Y X Y X' Y' X • Y X' • Y' ( X • Y ) + ( X' • Y' ) ( 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 Number syst.; Logic functions- 19
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.