Mod02.03.DigLogic.ExtraMats

.pdf
School
Southern Methodist University**We aren't endorsed by this school
Course
COMPUTER S 7311
Subject
Computer Science
Date
Jan 3, 2025
Pages
17
Uploaded by SargentDangerPuppy30
1 Digital Logic - Extra Material 1 Number Systems and Truth Tables: OverviewElectronic systems are often classified as digital or analog - this refers to how their signals are treated. Analog - signals may have many different values Digital- all signal values are interpreted as one of two values: 0 (or low or false) 1 (or high or true) Many analog systems have gone digital: Analog digital Cameras film digital-memory chip Video recordings tape (VCR) digital-versatile disc (DVD) Audio recordings tape (cassette) compact disc (CD) Why use digital systems instead of analog? Easier to design Easier to modify and update Cheaper to design - cheaper to manufacture 1.1 Number Systems 1.1.1 Decimal Assume that we have the decimal (base 10) number 123.4 This number can also be written as 1*102+ 2*101+ 3*100+ 4*10-1The number is represented by a string of digits Each digit position has an associated weight The value of the number = the weighted sum of the digits A decimal number D = dp-1dp-2d1d0.d-1d-2d-ndp-1is the most significant digitof D
Background image
2 d-nis the least significant digitof D Range on values for di= {0,1,2,3,4,5,6,7,8,9} 1.1.2 Octal Now we have an octal (base 8) number 1278Subscript denotes number base: 127812710range on values for ci= {0,1,2,3,4,5,6,7} 1278= 1*82+ 2*81+ 7*80= 64 + 16 + 7 = 8710Convert from decimal to octal? 87/8 = 10.875, or 10 7/8 (quotient 10, remainder 7) keep remainder as octal digit, divide quotient again: x/8 q r octal digit 87/8 10 7 7 10/8 1 2 2 1/8 0 1 1
Background image
3 1.1.3 Hexadecimal Next, we have hexadecimal (base 16) number 1A516Often called hex for short - this is not a curse! range on values for xi= {0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F} A = 10, B = 11, ... F = 15 So 1A516= 1*162+ 10*161+ 5*160= 256 + 160 + 5 = 42110Convert 42110to hex? x/16 q r hex digit 421/16 26 5 5 26/16 1 10 A 1/16 0 1 1 1.1.4 Binary Finally, we have the binary (base 2) number 11012range on binary digits (bits) = {0,1} 11012= 1*23+ 1*22+ 0*21+ 1*20= 8 + 4 + 1 = 1310Convert 1310to binary? x/2 q r bit 13/2 6 1 1 6/2 3 0 0 3/2 1 1 1 ½ 0 1 1
Background image
4 1.1.5 Comparison of Bases Decimal Binary Octal Hexadecimal 0 0000 00 0 1 0001 01 1 2 0010 02 2 3 0011 03 3 4 0100 04 4 5 0101 05 5 6 0110 06 6 7 0111 07 7 8 1000 10 8 9 1001 11 9 10 1010 12 A 11 1011 13 B 12 1100 14 C 13 1101 15 D 14 1110 16 E 15 1111 17 F Note: 3 bits represent 1 octal digit 4 bits represent 1 hex digit So can convert between binary and octal or hex easily 1100101011012= 110 010 101 1012= 625581100101011012= 1100 1010 11012= CAD161F716= 0001 1111 010121278= 001 010 1112
Background image
5 1.1.6 Negative Binary Numbers 1.1.6.1 1's-complement representation For each bit biof B, bit bi' of B' = (1-bi) E.g. Assume that we want to represent the number -210as a 3-bit 1's-complement binary number. for the 3-bit number 010, its 1's-comp is 101 1.1.6.2 2's-complement representation Add 1 to the one's-complement of B For our previous example, 010 101 (1's-comp) 110 (2's comp) What is the 2’s comp rep of a positive number? Same as binary rep. 510= 010122’s comp rep:+510= 01012-510= 10112How to know if positive or negative number? Look at MSB: 0 = positive, 1 = negative. Why use two's-comp instead of one's-comp for signed number representation? Number 0: 000021's -comp: 11112"-0" - we have twozero values (+0,-0) 2's-comp: 00002= 0 (same positive or negative) How do we distinguish 1011 (-5 2's-com, but 11 unsigned)? First, must be told that this is a 2's-complement number.Then, MSB is sign bit. Range on 2's-comp numbers depend on number of bits. For example, 2-bit numbers: 00 0 01 1 10 -2 11 -1
Background image
6 3-bit numbers: 000 0 001 1 010 2 011 3 100 -4 101 -3 110 -2 111 -1
Background image
7 1.2 Truth Tables Digital logic uses binary number system: An inputvalueto a logic circuit must be either 0 or 1 An output valueof a logic circuit will be either 0 or 1 A truth table defines the relationship between inputs and outputs of a binary system. The table is constructed by listing all input combinations and their corresponding outputs. Example: Z = A and B Row A B Z 0 0 0 0 1 0 1 0 2 1 0 0 3 1 1 1 Note that the table rows correspond to binary numbers in the range 0 to 2i, where i = number of inputs 2 inputs 22= 4 rows Example: EE 4073 (Communications) requires EE 3113 and (STAT 3813 or 4413) as prerequisites. Let Z = student can take EE 4073 A = student has taken EE 3113 B = student has taken STAT 3813 C = student has taken STAT 4413 Then Z = A and (B or C) 3 inputs 23= 8 rows Row A B C Z 0 0 0 0 0 1 0 0 1 0 2 0 1 0 0 3 0 1 1 0 4 1 0 0 0 5 1 0 1 1 6 1 1 0 1 7 1 1 1 1
Background image
8 1.2.1 Don't-cares Look at our previous truth table again: Note that if input A = 0, the value of Z=0, regardless of the value of B and C. Thus, we "don't care" about the values of B and C if A = 0, since Z will be 0. We can rewrite the truth table as: A B C Z 0 X X 0 1 0 0 0 1 0 1 1 1 1 0 1 1 1 1 1 Where X = "don't care".
Background image
9 2 Switching Algebra: OverviewLast section used truth tables to describe logic behavior simple, but take space more compact representation logic expressions oalgebraic expression of digital logic Logic circuits hardware to implement digital logic expressions 2.1 Definition of Switching Algebra Switching algebra algebra on binary numbers. Also called Boolean algebra. All variables and constants take one of two values: 0 or 1 Digital Logic- all possible values mapped into one of two subsets 1.0, low, false 2.1, high, true Combinational Circuit- logic circuit whose outputs depend only on its current inputs. Operation is described by a truth table. Basic logic functions: AND, OR, NOT Circuit element that performs a basic logic function is called a gate.
Background image
10 2.2 Basic Logic Gates 2.2.1 AND ANDgate produces a 1 output iff all of its inputs are 1 F = A and B => F = AB or F = AB (also called logical product) Circuit Symbol: Truth Table: F = AB A B F 0 0 0 0 1 0 1 0 0 1 1 1 2.2.2 OR ORgate produces a 1 output iff one or more of its inputs are 1 A or B => A+B (also called logical sum) Circuit Symbol: Truth Table: F = A+B A B F 0 0 0 0 1 1 1 0 1 1 1 1
Background image
11 2.2.3 NOT NOTgate (inverter) produces an output value that is the opposite of its input value NOT A => A' (also called complement) Circuit Symbol: Truth Table: F = A’A F 0 1 1 0 2.3 Other Logic Gates We can represent any logic equation with a combination of AND, OR, NOT (inverter) gates. However, some functions occur frequently, such that specific gates have been designed to implement them. 2.3.1 NAND For a complemented logical product (AB)’, we can use AND and NOT, or use a NAND gate Circuit Symbol: Truth Table: F = (AB)’A B F 0 0 1 0 1 1 1 0 1 1 1 0
Background image
12 2.3.2 NOR For a complemented logical sum (A+B)’, we can use OR and NOT, or use a NOR gate Circuit Symbol: Truth Table: F = (A+B)’A B F 0 0 1 0 1 0 1 0 0 1 1 0 2.3.3 XOR Recall the OR function A B A+B 0 0 0 0 1 1 1 0 1 1 1 1 This is also called inclusive-or.Now assume that we have the following function: A B F 0 0 0 0 1 1 1 0 1 1 1 0 Note that F=1 only if AB Write the logic equation: F = A'B + AB'
Background image
13 This function is called exclusive-or: F = A B XORNote: 0'1AAAA3 Other Digital Logic Components: OverviewPrevious discussion: combo logic - using basic gates (AND, OR, NOT) to implement logic functions These basic functions can be combined to form more complex logic devices 3.1 Multiplexers Assume we have a 4-position switch that connects one of four inputs (D0, D1, D2, D3) to output OUT. Now, we wish to implement this switch using digital logic inputs will be selected using SELECT lines. We have four inputs, so we have 2 select bits: S1, S0 S1 S0 OUT 0 0 D0 0 1 D1 1 0 D2 1 1 D3 (show partial circuit logic for D0, D1 with select lines) The operation of selecting one of many inputs to be passed on to an output is called multiplexing. A logical device that performs this operation is called a multiplexer, or MUX. This circuit can be represented by a black box as shown: Inputs (D0, D1, D2, D3) at left Outputs (OUT) at right Select lines (S1, S0) at bottom This particular MUX has four inputs and one output, so is called a 4-to-1 MUX
Background image
14 3.1.1 Standard MUX Sizes We saw 4-to-1: (2 select lines) Other common sizes: 2-to-1: (1 select line) 8-to-1: (3 select lines) 16-to-1: (4 select lines) 3.2 Demultiplexer The opposite function of MUX is DEMUX - takes one input and passes it on to one of 2nselected outputs For our previous example: 1-to-4 DEMUX IN1Q0Q1Q2Q35678S0S1001-4 DEMUXS1 S0 IN goes to 0 0 Q0 0 1 Q1 1 0 Q2 1 1 Q3 Q0 = INS1'S0' Q1 = INS1'S0 Q2 = INS1S0' Q3 = INS1S0
Background image
15 3.3 Encoders Now assume we have a circuit with 4 inputs and 2 outputs. Also assume that only one input is HI at a time. Inputs Outputs A3 A2 A1 A0 Y1 Y0 0 0 0 1 0 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0 0 0 1 1 Note that the outputs reflect the particular input that is HI. This function is called binary encoding; this truth table represents the function of a 4-to-2 encoderCan we develop the circuit for this encoder? Y1 = A2 + A3 Y0 = A1 + A3
Background image
16 3.4 Decoders Decoder performs the opposite function of an encoder. For our previous example, a 2-to-4 decoder e.g, 2-to-4 binary decoder 2 inputs (A1, A0) 4 outputs (Y3, Y2, Y1, Y0) - depending on the input values, one of the outputs goes high Inputs Outputs Y1 Y0 B3 B2 B1 B0 0 0 0 0 0 1 0 1 0 0 1 0 1 0 0 1 0 0 1 1 1 0 0 0 B0 = Y1' Y0' B1 = Y1' Y0 B2 = Y1 Y0' B3 = Y1 Y0
Background image
17 3.4.1 Seven-Segment Decoder On your watch or calculator, you have an LCD that displays digits Each digit represents a decimal number 0-9 How many bits do we need to represent 10 digits? 23= 8, 24= 16 4 bits (not all used) Let w,x,y,z be the input bits develop truth table. Note that morethan one output can be high at a time (unlike standard decoder) row W X Y Z a b c d e f g 0 0 0 0 0 1 1 1 1 1 1 0 1 0 0 0 1 0 1 1 0 0 0 0 2 0 0 1 0 1 1 0 1 1 0 1 3 0 0 1 1 1 1 1 1 0 0 1 4 0 1 0 0 0 1 1 0 0 1 1 5 0 1 0 1 1 0 1 1 0 1 1 6 0 1 1 0 1 0 1 1 1 1 1 7 0 1 1 1 1 1 1 0 0 0 0 8 1 0 0 0 1 1 1 1 1 1 1 9 1 0 0 1 1 1 1 1 0 1 1 a b c d e f g
Background image