Overview of Digital Electronics Embedded Systems Overview of Digital Electronics
Binary Numbers and Others System Radix Allowable Digits Binary 2 0,1 Octal 8 0,1,2,3,4,5,6,7 Decimal 10 0,1,2,3,4,5,6,7,8,9 Hexadecimal 16 0,1,2,3,4,5,6,7,8,9,A, B, C, D, E, F (4021.2)5 = 4 x 53 + 0 x 52 + 2 x 51 + 1 x 50 + 2 x 5-1 4 x 125 + 0 + 10 + 1 + 2 x (1/5) 500 + 11 + .4= (511.4)10 (B65F)16 = 11 x 163 + 6 x 162 + 5 x 161 + 15 x 160 11 x 4096 + 6 x 256 + 5 x 16 + 15 45056 + 1536 + 80 + 15 = (46687)10
Number Base Conversion Conversion from Decimal fraction (0.6875)10 to Binary: Integer Fraction Coefficient 0.6875 x 2= 1 + 0.3750 a_1=1 0.3750 x 2= 0 + 0.7500 a_2=0 0.7500 x 2= 1 + 0.5000 a_3=1 0.5000 x 2= 1 + 0.0000 a_4=1 (0.6875)10=(0.1011)2 The conversion from decimal fraction to any base-r system is similar to the example. Multiplication is by r instead of 2, and the coefficients found from the integers may range in value from 0 to r-1 instead of 0 and 1. Example: (0.513)10=(?)8
Binary Numbers Operations work similarly in all bases
Octal and Hexadecimal Numbers The conversion from binary to octal and hexadecimal plays an important part in digital systems (computers). Since 23 = 8 and 24 = 16
Octal and Hexadecimal Numbers Conversion from Octal to binary: (673.124) 8 = (110 111 011. 001 010 100) 2 Conversion from Hexadecimal to binary: (306.D) 16 = (0011 0000 0110. 1101) 2 Conversion from Hexadecimal to Decimal: (37B) 16 3 x 162 + 7 x 161 + 11 x 160 = 3 x 256 + 7 x 16 + 11 x 1 = 768 + 112 +11 = (891) 10
Complements Simplifies Two types exist the subtraction operation Logical operations Two types exist The radix complement (r’s complement) 10’s complement, 2’s complement The diminished radix complement ((r-1)’s complement) 9’s complement, 1’s complement
Diminished Radix (r-1) complement Given a number N in base r having n digits: (r-1)’s complement of N is (rn-1)-N When r=10, (r-1)’s complement is called 9’s complement. 10n-1 is a number represented by n 9’s. 9’s complement of 546700 is (n=6) 999999-546700=453299 9’s complement of 012398 is (n=6) 999999-012398=987601
Diminished Radix (r-1) complement Given a number N in base r having n digits: (r-1)’s complement of N is (rn-1)-N When r=10, (r-1)’s complement is called 9’s complement. 10n-1 is a number represented by n 9’s. 9’s complement of 546700 is (n=6) 999999-546700=453299 9’s complement of 012398 is (n=6) 999999-012398=987601
1’s complement For binary numbers, r=2 and r-1=1. 1’s complement of N is (2n-1)-N If n=4, 2n=10000. So, 2n-1=1111. To determine the 1’s complement of a number, subtract each digit from 1. Or, bit flip!!! Replace 0’s with 1’s, 1’s with 0’s!!! Example: If N= 1011000, 1’s comp.= 0100111 If N= 010110, 1’s comp.= 101001
Radix (r’s) complement Given a number N in base r having n digits: r’s complement of N is rn-N When r=10, r’s complement is called 10’s complement. 10’s complement of 546700 is (n=6) 1000000-546700=453300 10’s complement of 012398 is (n=6) 1000000-012398=987602
Radix (r’s) complement The 10’s complement of decimal 2389 = (104 –1) – 2389 + 1 = 7611. The 2’s complement of binary 101100 = (26 –1) – 101100 + 1 = 010100. 012389= (106 –1) – 012389 + 1 = 987602. 246700= (106 –1) – 246700 + 1 = 753300.
Signed Binary Numbers 00001001 = 9 Example: Represent +9 and -9 in eight bit system 00001001 = 9 Signed magnitude 10001001 =-9 Signed-1’s complement 11110110 Signed-2’s complement 11110111
Two digital circuit types Combinational digital circuits: Consist of logic gates Their current outputs are determined from the present combination of inputs. Their operations can be specified logically by sets of Boolean functions. Sequential digital circuits: Employ storage elements in addition to logic gates. Their outputs are a function of the inputs and the state of the storage elements. Their outputs depend on current inputs and past input. They have feedback connections. Digital System Design May 2, 2019
Combinational circuits 2n possible combinations of input values Specific functions Adders, subtractors, comparators, decoders, encoders, and multiplexers MSI (Medium Scale Integration) circuits or standard cells Digital System Design May 2, 2019
Example Combinational Circuit (1/2) Circuit controls the level of fluid in a tank inputs are: HI - 1 if fluid level is too high, 0 otherwise LO - 1 if fluid level is too low, 0 otherwise outputs are: Pump - 1 to pump fluid into tank, 0 for pump off Drain - 1 to open tank drain, 0 for drain closed input to output relationship is described by a truth table Digital System Design May 2, 2019
Example Combinational Circuit (2/2) HI 1 LO Pump x Drain Tank level is OK Low level, pump more in High level, drain some out inputs cannot occur Truth Table Representation HI Pump Schematic Representation Drain LO Digital System Design May 2, 2019
Analysis of A Combinational Circuit make sure that it is combinational not sequential No feedback path derive its Boolean functions (truth table) design verification a verbal explanation of its function Ex. What is the output function of this circuit? Digital System Design May 2, 2019
Example Analysis Analysis steps Label all gate outputs with symbols Find Boolean functions for all gates Express functions in terms of input variables + simplify Substitution: F = (T2T3)’ = ((xT1)’(yT1)’)’ = (xT1)+(yT1) = x(xy)’+y(xy)’= =(x(x’+y’)) + (y(x’+y’)) = xx’+xy’+yx’+yy’ = xy’+yx’ = x y T1=(xy)’ T2=(x T1)’ F=(T2T3)’ T3=(yT1)’ Digital System Design May 2, 2019
Example (1/3) What are the output functions F1 and F2? Digital System Design May 2, 2019
Example (2/3) Start with expressions that depend only on input variables: T2 = ABC T1 = A+B+C F2 = AB + AC + BC Express other outputs that depend on already defined internal signals T3 = F2’T1 F1 = T3 + T2 Digital System Design May 2, 2019
Example (3/3) Simplify: F1 = T3+T2 = F2’T1+ABC = (AB+AC+BC)'(A+B+C)+ABC = (A'+B')(A'+C')(B'+C')(A+B+C)+ABC = (A'+B'C')(AB'+AC'+BC'+B'C)+ABC = A'BC'+A'B'C+AB'C'+ABC A full-adder F1: the sum F2: the carry Digital System Design May 2, 2019
Truth Table Digital System Design May 2, 2019
Binary Adders Addition is important function in computer system What does an adder have to do? Add binary digits Generate carry if necessary Consider carry from previous digit Binary adders operate bit-wise A 16-bit adder uses 16 one-bit adders Binary adders come in two flavors Half adder : adds two bits and generate result and carry Full adder : also considers carry input Two half adders make one full adder Digital System Design May 2, 2019
Binary Half Adder Specification: Outputs: Design a circuit that adds two bits and generates the sum and a carry Outputs: Two inputs: x, y Two output: S (sum), C (carry) 0+0=0 ; 0+1=1 ; 1+0=1 ; 1+1=10 The S output represents the least significant bit of the sum. The C output represents the most significant bit of the sum or (a carry). Digital System Design May 2, 2019
Implementation of Half Adder the flexibility for implementation S=x y S = (x+y)(x'+y') S' = xy+x'y' S = (C+x'y')' C = xy = (x'+y')' S = x'y+xy' C = xy Half Adder X Y S C Digital System Design May 2, 2019
Full-Adder Specification: Inputs: Truth table: A combinational circuit that forms the arithmetic sum of three bits and generates a sum and a carry Inputs: Three inputs: x,y,z Two outputs: S, C Truth table: Full Adder X Y S Z C Digital System Design May 2, 2019
Implementation of Full Adder S=x’y’z+ x’yz’ + xyz’ + xyz C= xy + xz + yz Digital System Design May 2, 2019
Alternative Implementation of Full Adder S = z (x y)= z’(xy’+x’y) + z(xy’+x’y)’ = z’(xy’+x’y) + z(xy+x’y’) =xy’z’+x’yz’+ xyz +x’y’z C = x y + (x y) z =z(xy’ + x’y) + xy= xy’z+ x’yz+ xy = xy + xz + yz Digital System Design May 2, 2019
Binary Adder A binary adder is a digital circuit that produces the arithmetic sum of two binary numbers. A binary adder can be implemented using multiple full adders (FA). Digital System Design May 2, 2019
Example: Add 2 binary numbers Subscript i: 3 2 1 Input carry Augend Addend Ci Ai Bi Sum Carry Si Ci+1 Digital System Design May 2, 2019
Example:4-bit binary adder 4-bit Ripple Carry Adder Classical example of standard components Would require truth table with 29 entries! C 1 1 1 0 A 0 1 0 1 B 0 1 1 1 S 1 1 0 0 Digital System Design May 2, 2019
Carry Propagation In any combinational circuit, the signal must propagate through the gates before the correct output is available in the output terminals. Total propagation time = the propagation delay of a typical gateX the number of gate levels The longest propagation delay time in a binary adder is the time it takes the carry to propagate through the full adders. This is because each bit of the sum output depends on the value of the input carry. This makes the binary adder very slow. Digital System Design May 2, 2019