# Review for Exam 1 Chapters 1 through 3.

## Presentation on theme: "Review for Exam 1 Chapters 1 through 3."— Presentation transcript:

Review for Exam 1 Chapters 1 through 3

Chapter 1 Overview Information Representation
Number Systems [binary, octal and hexadecimal] Base Conversion Decimal Codes [BCD (binary coded decimal)] Alphanumeric Codes Parity Bit Gray Codes

1-2 Number Systems Positive radix, positional number systems Examples:
Decimal (radix r =10) Binary (radix r =2) Octal (radix r = ) Hexadecimal (r = ) Ex: 24.3 = 2x x100+3x10-1 Digits (0-9) Ex: = ( . )10 Bits (0-1) = = 13.25 Digits: 1,2,…9, A, B, C, D, E, F

Range of numbers Binary number: ex. a 3-bit number: n=3
000, 001 … ,111 or in decimal system: 0, 1 … 7 Total of 8 numbers (=23) Range: from 0 to 7 (0 to 23-1) In general a n-bit number represents: 2n different numbers Min: 0 Max number: 2n-1 For fractions: m bits after the radix point: Max number: (2m -1)/2m Fractions Max number: ? 2m-1/2m Proof: A A …. A-m2-m) = 2-m (A-12m-1 + A-22m-2 +… A-m20) = 2-m (2m -1)

Use of HEX system Short hand notation of large binary numbers:
Each HEX digits can be represented by exactly 4 bits (16=24) Thus ( )2 Conversion from binary to HEX and HEX to binary is very easy: ( )2 = ( )16 ( )2 = ( )16 B = ( )2 E ( )2 = ( 9D )16 ( )2 = ( )16 = 2 B C B39.7 =

Each octal digit can be represented by 3 bits
Octal system Radix r = 8 8 digits: 0, 1, 2,…7 Ex: 2758 = 2x82 + 7x8 + 5x1 = = 18910 Each octal digit can be represented by 3 bits

1-3 Conversion Between Bases
To convert from one base to another: 1) Convert the Integer Part 2) Convert the Fraction Part 3) Join the two results with a radix point

Example: convert (325.65)10 to hex
Integer part: = ( )16 Fractional part: .65 325/16 = 20 and rem = 5 20/16 = 1 and rem = 4 1/ = 0 and rem = 1 Most significant Least significant digit Thus = 14516 0.65x16 = thus int = 10= A 0.4x16 = thus int = 6 Etc. Most significant Least significant Thus = A6616 = 145.A6616

Conversion - Summary Hexadecimal Ai.16i Decimal Binary  Ai.8i Octal
Divisions (or x) by 16 Hexadecimal Ai.16i Decimal Divisons by 2 Group in bits of 4 SAi.2i Binary Divisons by 8 Octal Hex: through the binary representation Group in bits of 3  Ai.8i Octal

Example: 3-bit code can represent up to 8 different elements”
1-4 Binary Codes A n-bit binary code is a n-bit word which can represent up to 2n different elements. Example: 3-bit code can represent up to 8 different elements” All quantities in a PC needs to be expressed as a binary number: e.g. the digits 0, 1, …9; characters, control characters, etc. This can be done using a “Code

Binary Coded Decimal (BCD)
The BCD code is the 8,4,2,1 code. This code only encodes the first ten values from 0 to 9. Each decimal digit is coded separately by 4 bits Example: (325)10 = ( )BCD Exercise: (856)10 = ( )BCD (325)10 = BCD If it were a binary conversion (not BCD encoding): (9bits) (856)10 = BCD 856 = ( )2 3 2 5

Overview Chapter 2 Binary Logic and Gates Boolean Algebra
Standard Forms Two-Level Optimization Map Manipulation Other Gate Types Exclusive-OR Operator and Gates High-Impedance Outputs In this chapter we will introduce logic gates which are the simplest logic elements. However, they form the foundation of more complex blocks which will be discussed in later chapters. We will also discuss the mathematical tools that are required to design, analyze and simplify logic function (Boolean Algebra): optimization techniques

Operator Definitions and Truth Tables
Truth table - a tabular listing of the values of a function for all possible combinations of values on its arguments Example: Truth tables for the basic logic operations: 1 Z = X·Y Y X AND OR X Y Z = X+Y 1 1 X NOT Z =

Existence complements
2-2 Boolean Algebra Boolean algebra deals with binary variables and a set of three basic logic operations: AND (.), OR (+) and NOT ( ) that satisfy basic identities Basic identities 1. X + 0 = 2. X . 1 = Existence 0 and 1 or operations with 0 and 1 3. X + 1 = 1 4. X . 0 = Idempotence 5. 6. X . X X = X + X Boolean algebra deals with binary variables and a set of three basic logic operations: AND, OR and NOT which satisify a set of basic identities 7. 8. = X . X 1 X + X Existence complements Involution 9. X = X Dual Replace “+” by “.”, “.” by +, “0” by “1” and “1’’ by”0”

Boolean Algebra Dual Boolean Theorems of multiple variables 10. X + Y
Y + X = Commutative 11. XY YX = 12. (X + Y) Z + X + (Y Z) = 13. (XY) Z X(Y Z ) = Associative 14. X (Y+ Z) XY XZ + = 15. X + YZ (X + Y) (X + Z) = Distributive 17. X . Y X + Y = 16. X + Y X . Y = DeMorgan’s Dual Boolean algebra deals with binary variables and a set of three basic logic operations: AND, OR and NOT which satisify a set of basic identities

Other useful Theorems Dual XY + XY = Y Minimization (X + Y)(X + Y) = Y
X(X + Y) = X X + XY = X Absorption X(X + Y) = XY X + XY = X + Y Simplification XY + XZ + YZ = XY + XZ Consensus Consensus: xy + x’z + yz = xy + x’z + yz( x+x’) = xy(1+z) + x’z(1+y) = xy + x’z (X + Y)( X + Z)(Y + Z) = (X + Y)( X + Z)

2-3 Standard (Canonical) Forms
It is useful to specify Boolean functions in a form that: Allows comparison for equality. Has a correspondence to the truth tables Canonical Forms in common usage: Sum of Products (SOP), also called Sum or Minterms (SOM) Product of Sum (POS), also called Product of Maxterms (POM)

Maxterms and Minterms Examples: Two variable minterms and maxterms.
The index above is important for describing which variables in the terms are true and which are complemented. Index Minterm Maxterm 0 (00) x y x + y 1 (01) 2 (10) 3 (11)

Index Examples – Four Variables
Index Binary Minterm Maxterm i Pattern mi Mi Notice: the variables are in alphabetical order in a standard form d c b a d c b a ? ? d c b a + d c b a + ? M1 = a + b + c + d’ m3 = a’ b’ c d m7 = a’ b c d M 13 = a’ + b’ + c + d’ d b a c + ? Relationship between min and MAX term? i m M =

Minterm Function Example
F(A, B, C, D, E) = m2 + m9 + m17 + m23 F(A, B, C, D, E) write in standard form: Sum of Product (SOP) expression: F = Σm(2, 9, 17, 23) A’B’C’DE’ + A’BC’D’E + AB’C’D’E + AB’CDE m2 m9 m17 m23 F(A,B,C,D,E) = A’B’C’DE’ + A’BC’D’E + AB’C’D’E + AB’CDE

Expressing a function with Maxterms
Start with the SOP: F1(x,y,z) =m1 + m4 + m7 Thus its complement F1can be written as F1 = m0 +m2 +m3 + m5 + m6 (missing term of F1) Apply deMorgan’s theorem on F1: (F1 = (m0 +m2 +m3 + m5 + m6) = m0.m2.m3.m5.m6 = M0.M2.M3.M5.M6 = ΠM(0,2,3,5,6) Thus the Product of Sum terms (POS): also called, Big M notation ) z y z)·(x ·(x z) (x F 1 + = x )·( ·(

2-4 Circuit Optimization
Goal: To obtain the simplest implementation for a given function Optimization requires a cost criterion to measure the simplicity of a circuit Distinct cost criteria we will use: Literal cost (L) Gate input cost (G) Gate input cost with NOTs (GN) Other possible criteria: Speed Power consumption Size and cost

Literal Cost Literal – a variable or its complement
Literal cost – the number of literal appearances in a Boolean expression corresponding to the logic circuit diagram Examples (all the same function): F = BD + AB’C + AC’D’ L = 8 F = BD + AB’C + AB’D’ + ABC’ L = F = (A + B)(A + D)(B + C + D’)( B’ + C’ + D) L = Which solution is best? 2nd Literal Cost = 11 3rd Literal Cost = 10 The first solution is best NOTE: all these represent the same function: f=Sum m(5,7,8,10,11,12,13,15)

Karnaugh Maps (K-map) A K-map is a collection of squares
Each square represents a minterm The collection of squares is a graphical representation of a Boolean function Adjacent squares differ in the value of one variable Alternative algebraic expressions for the same function are derived by recognizing patterns of squares The K-map can be viewed as A reorganized version of the truth table A topologically-warped Venn diagram as used to visualize sets in algebra of sets

2-5 Map Manipulation: Systematic Simplification
A Prime Implicant is a product term obtained by combining the maximum possible number of adjacent squares in the map into a rectangle with the number of squares a power of 2. A prime implicant is called an Essential Prime Implicant if it is the only prime implicant that covers (includes) one or more minterms. Prime Implicants and Essential Prime Implicants can be determined by inspection of a K-Map.

Don't Cares in K-Maps Sometimes a function table or map contains entries for which it is known: the input values for the minterm will never occur, or The output value for the minterm is not used In these cases, the output value need not be defined Instead, the output value is defined as a “don't care” By placing “don't cares” ( an “x” entry) in the function table or map, the cost of the logic circuit may be lowered. Example 1: A logic function having the binary codes for the BCD digits as its inputs. Only the codes for 0 through 9 are used. The six codes, 1010 through 1111 never occur, so the output values for these codes are “x” to represent “don’t cares.”

Other Gate Types: overview
B A B A B A A B A B BUF NAND NOR XOR XNOR

The Tri-State Buffer Symbol Truth Table OUT= IN.EN
For the symbol and truth table, IN is the data input, and EN, the control input. For EN = 0, regardless of the value on IN (denoted by X), the output value is Hi-Z. For EN = 1, the output value follows the input value. Variations: Data input, IN, can be inverted Control input, EN, can be inverted by addition of “bubbles” to signals. IN EN OUT Truth Table EN IN OUT X Hi-Z 1 OUT= IN.EN

NAND Mapping Algorithm
Replace ANDs and ORs: Repeat the following pair of actions until there is at most one inverter between : A circuit input or driving NAND gate output, and The attached NAND gate inputs.

NOR Mapping Algorithm Replace ANDs and ORs:
Repeat the following pair of actions until there is at most one inverter between : A circuit input or driving NAND gate output, and The attached NAND gate inputs.

Enabling Function Enabling permits an input signal to pass through to an output Disabling blocks an input signal from passing through to an output, replacing it with a fixed value The value on the output when it is disable can be Hi-Z (as for three-state buffers and transmission gates), 0 , or 1 When disabled, 0 output When disabled, 1 output See Enabling App in text

3-7 Decoding A n-bit binary code can represent up to m=2n elements:
m elements n-bit binary code Decoding - the conversion of an n-bit input code to an m-bit output code with n ≤ m ≤ 2n such that each valid code word produces a unique output code encoding (ex. 256 alpha-num. chars) (ex. 8-bit ASCII code) decoding A0 : An-1 D0 D1 Dm-1 n-2n decoder n bits m-elements ≤ 2n

2-to-4 Line Decoder circuit
= A 1 2 3 Notice that the outputs of the decoder correspond to the minterms: Di=mi

Decoder Expansion Larger decoders can be realized by implementing each minterm using a single AND gate: However for large decoders this requires multiple input AND gates which is not always feasible. Better to use a hierarchical approach: build larger ones from smaller decoders. Approach: Output AND gates have only 2 inputs and implement the minterms. The output AND gates are driven by two decoders with their numbers of inputs either equal or differing by 1.

Rule for building large decoders
k-to-2k decoder: One needs 2k output AND gates If k can be divided by 2: use two k/2-to-2k/2 decoders If k cannot divided by 2: use a (k+1)/2 and use a (k-1)/2 decoder. Previous example: 3-to-8 decoder (k=3): Use a 2-to-4 and a 1-to-2 decoder

Combinational Logic Implementation - Decoder and OR Gates
Implement m functions of n variables with: Sum-of-minterms expressions One n-to-2n-line decoder m OR gates, one for each output

Example Design and implement a majority function F(ABC) using a 3-to-8 decoder Truth table: Minterms: F=m(3,5,6,7) Implementation using decoder: A B C F Indicate MSB, LSB 1 2 3 4 5 6 7 A B C 2 1 F m(3,5,6,7) Thus use a 3-to-8 decoder with OR gate

Encoding Typically, an encoder converts a code containing exactly one bit that is 1 to a binary code corresponding to the position in which the 1 appears: ex. D1=1  output 0001 Examples: Octal-to-Binary encoder Other examples? A0 : An-1 D0 D1 Dm-1 encoder 1 2 3 m-1 n-1 1 1 Examples: Hex-to-Binary encoder Decimal to BCD encoder Decimal to binary encoder ASCI to binary Grades (ABCDF) to binary: A, B, C, D, F to 3 bit binary code

Priority Encoder If more than one input value is 1, then the encoder just designed does not work. An encoder that can accept all possible combinations of input values and produce a meaningful result is a priority encoder. Among the 1s that appear, it selects the most significant input position (or the least significant input position) containing a 1 and responds with the corresponding binary code for that position. D0 D1 D2 D3 A1 A0 ? V 1 2 3 processor To

3-9 Selecting (multiplexers)
Selecting of data or information is a critical function in digital systems and computers Circuits that perform selecting have: A set of n information inputs from which the selection is made A set of k control (select) lines for making the selection A single output 1 2 3 : n-1 I0 I1 I2 I3 In-1 OUT n ≤ 2k inputs k Sk-1..S1 S0 k select lines

4:1 MUX realization Expression for OUT Circuit implementation: SOP
4 AND gates (4 product terms) 2-to-4 line decoder (to generate the minterms) S1 S0 OUT I0 I1 I2 I3 OUT = S1S0 I0+ S1S0 I1+ S1S0 I2+ S1S0 I3 m3 m2 m1 m0 or OUT = Σ mi Ii i=0 2k-1

Exercise Build a 8:1 MUX using two 4:1 and one 2:1 muxes I0 I1 4:1 I2
1 2 3 1 0 1 OUT S1 S0 I4 I5 I6 I7 4:1 1 2 3 We need 3 select signals: S2,S1 and S0 S2 1 0 Ex: S2S1S0=110 : select I6

Multiplexer-based combinational circuits realization- Approach 1
A mux can be easily used to implement a function defined by a truth table (lookup table) Indeed the output F of a mux is equal to: F = Σ mi Ii i=0 2k-1 Example A B OUT =F I I I I m0 m1 m2 m3 F= Σm(1,2) Give the input Ii the value of 0 or 1 as shown in the truth table 1 4:1 1 2 3 1 0 F A B

Combinational Logic Implementation - Multiplexer Approach 2
Implement any m functions of n + 1 variables by using: An m-wide 2n-to-1-line multiplexer Design: Find the truth table for the functions. Based on the values of the first n variables, separate the truth table rows into pairs For each pair and output, define a rudimentary function of the final variable (0, 1, X, ) X

Download ppt "Review for Exam 1 Chapters 1 through 3."

Similar presentations