ELL100: INTRODUCTION TO ELECTRICAL ENGG. Course Instructors: J.-B. Seo, S. Srirangarajan, S.-D. Roy, and S. Janardhanan Department of Electrical Engineering, IITD
Number systems Decimal, Octal, Hex, binary systems Decimal number system Octal (0,1,…,7): Base 8 = 448 = 40 = 4
Number systems Decimal, Octal, Hex, binary systems Hex (0,1,…9,A, B, C,…,F): Base 16 Binary = 256 = 224
Most significant & least significant bit For any number system (non-fractional part) Right most: Least significant digit/bit (LSB) Left most: Most significant digit/bit (MSB) Decimal: 4153231 Binary: 1010001 Hex: AE143
Conversion from Decimal to Base N Divide the decimal number by N. Reminder is LSB If the quotient is not divisible, the conversion is done. Else, repeat step 1 using the quotient as a new decimal number. New reminder is the next LSB 30 1 27 13 6 3 1 16 492 16 30 2 55 2 27 2 13 2 6 2 3 480 16 54 26 12 6 2 12 ···· C 14 ···· E 1 1 1 1
Ones’ complement (1’s complement) Suppose a 8-bit (binary) integer How can we express – 127? To obtain the 1’s complement of a binary number: flip all the bits : the MSB denotes the negative sign
One’s complement value Bits Unsigned value One’s complement value 0000 0001 1 0000 0010 2 0000 0000 0111 1110 126 0111 1111 127 1000 0000 128 –127 1000 0001 129 –126 1111 1101 253 –2 1111 1110 254 –1 1111 1111 255 –0
Ones’ complement Adding two values: Align the values on the LSB Add, propagating any carry to the bit one position left. If the carry extends past the end of the word, it is said to have "wrapped around", a condition called an “end-around carry” When this occurs, the bit must be added back in at the right-most bit. 0001 0110 22 0001 0110 22 + 0000 0011 3 + 1111 1111 – 0 25 0001 1001 1 0001 0101 1 0001 0110 22
Ones’ complement 6 – 19 = 19 + 3 = 19 – (-3) = 0000 0110 6 0001 0011 Subtraction uses “end-around borrow” if necessary. Subtract it from the LSB 6 – 19 = 19 + 3 = 19 – (-3) = 0000 0110 6 0001 0011 19 – 0001 0011 19 – 1111 1100 – 3 1 1111 0101 25 1 0001 0111 1 1 1111 0100 –13 0001 0110 22
Two’s complement (2’s complement) Two’s complement of an N-bit number: Its complement with respect to 2N The two’s complement of three-bit number 010 1000 010 + 110 = 1000 – 010 110 Find one’s complement and add `1’ to the LSB 101 + 001 = 110 – 2 No negative zero: 000 111 + 001 = 000
Two’s complement Decimal value Binary (2’s compl.) Two’s complement 0000 0000 1 0000 0001 1111 1111 2 0000 0010 1111 1110 126 0111 1110 1000 0010 127 0111 1111 1000 0001 –128 1000 0000 –127 –126 –2 –1
Two’s complement (2’s complement) Adding two’s complement numbers requires no special processing 15 – 5 = 15 + (-5) 15 – (-5) = borrow 0000 1111 15 0000 1111 15 + 1111 1011 – 5 – 1111 1011 – 5 0000 1010 10 0001 0100 20 Carry bit is ignored
Two’s complement (2’s complement) Overflow 104 + 45 = (-103) + (-69) = -172 0110 1000 104 1001 1001 – 103 + 0010 1101 45 – 1011 1011 – 69 1001 0101 149 0101 0100 If the sum of two positive numbers yields a negative result, the sum has overflowed. If the sum of two negative numbers yields a positive result, the sum has overflowed. Otherwise, the sum has not overflowed.
Gates Truth table Truth table Simplest Logic Gate – also known as the complement or the invertor Truth table Simplest Logic Gate – also known as the complement or the invertor Truth table
Gates AND gate OR gate Truth table Truth table
Gates NAND gate NOR gate Truth table Truth table
Gates XOR Gate XNOR Truth table Truth table
Boolean Algebra – 1
Boolean Algebra – 2
Boolean Algebra – 2
Boolean Algebra – 2
DeMorgan’s theorem Example =
Logic circuit analysis
Karnaugh map (K-map) The sum of products (minterm) Three-variable Karnaugh map
Karnaugh map (K-map) The sum of products (minterm) Three-variable Karnaugh map
Karnaugh map (K-map) The sum of products (minterm) Three-variable Karnaugh map
Karnaugh map (K-map) The sum of products (minterm) Three-variable Karnaugh map
Karnaugh map (K-map)
Karnaugh map (K-map)
Karnaugh map (K-map)
Karnaugh map (K-map)
Karnaugh map (K-map) K-map with four variables
Example – 1 Design a circuit to take a 4-bit number ABCD and produce a single output Y that is true only if the input represents a prime number
Example – 1 Design a circuit to take a 4-bit number ABCD and produce a single output Y that is true only if the input represents a prime number or 0, and 1.
Example – 1 Design a circuit to take a 4-bit number ABCD and produce a single output Y that is true only if the input represents a prime number
Example – 1 Design a circuit to take a 4-bit number ABCD and produce a single output Y that is true only if the input represents a prime number
Example – 2 LED seven-segment display is used to indicate decimal digits, 0,1,…9. a f b g e c 8 9 d 6 7 4 5 2 3 1
Example – 2 LED seven-segment display is used to indicate decimal digits, 0,1,…9. a f b g e c 8 9 d 6 7 4 5 2 3 1
Example – 2 LED seven-segment display is used to indicate decimal digits, 0,1,…9. a f b g e c 8 9 d 6 7 4 5 2 3 1
Example – 2 1 1 1 1 1 1 x x x x x x 1 1 Don’t care condition
Example – 2 1 1 1 1 1 1 x x x x x x 1 1
Example – 2
Karnaugh map (K-map) The sum of products (minterm) The product of sums (maxterm) (_ _ _) + (_ _) + (_ _ _ ) (_ + _ + _)(_ + _)(_ + _ + _ ) Minterm Maxterm
Karnaugh map (K-map)
Karnaugh map (K-map) To convert a Boolean function F from SoP to PoS Find in SoP form Find in PoS form
Karnaugh map (K-map)
Karnaugh map (K-map)
Karnaugh map (K-map)
Karnaugh map (K-map)
Karnaugh map (K-map)
Karnaugh map (K-map)
Karnaugh map (K-map)
Karnaugh map (K-map)
Karnaugh map (K-map)
Karnaugh map (K-map)
Half-Adder
Full-Adder
Full-Adder
Full-Adder Sum Carry-out
Full-Adder
4-bit Binary Adder How can you build ? A3A2A1A0 + B3B2B1B0 ------------------------------- S3S2S1S0 -------------------------------- Cout, Cin How can you build ? Four 1-bit FA Or Eight 1-bit HA
4-bit Binary Adder How can you build ? A3A2A1A0 + B3B2B1B0 ------------------------------- S3S2S1S0 -------------------------------- Cout, Cin How can you build ? Four 1-bit FA Or Eight 1-bit HA
4-bit Binary Adder How can you build ? A3A2A1A0 + B3B2B1B0 ------------------------------- S3S2S1S0 -------------------------------- Cout, Cin How can you build ? Four 1-bit FA Or Eight 1-bit HA
4-bit Binary Adder How can you build ? A3A2A1A0 + B3B2B1B0 ------------------------------- S3S2S1S0 -------------------------------- Cout, Cin How can you build ? Four 1-bit FA Or Eight 1-bit HA
4-bit Binary Adder How can you build ? A3A2A1A0 + B3B2B1B0 ------------------------------- S3S2S1S0 -------------------------------- Cout, Cin How can you build ? Four 1-bit FA Or Eight 1-bit HA
4-bit Binary Adder How can you build ? A3A2A1A0 + B3B2B1B0 ------------------------------- S3S2S1S0 -------------------------------- Cout, Cin How can you build ? Four 1-bit FA Or Eight 1-bit HA
4-bit Binary Adder Four 1-bit FA Or Eight 1-bit HA How can you build ? A3A2A1A0 + B3B2B1B0 ------------------------------- S3S2S1S0 -------------------------------- Cout, Cin How can you build ? Four 1-bit FA Or Eight 1-bit HA
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum Select bit (M)
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum Select bit (M) = 1 ?
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum Select bit (M) = 1 output flips B
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum Select bit (M) = 1 output flips B Select bit (M) = 0 output = B
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum Select bit (M) = 1 Enable Subtract Select bit (M) = 0 Enable Add
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum Select bit (M) = 1 Enable Subtract Select bit (M) = 0 Enable Add
Design a 4-bit adder that can also subtract the two numbers ? A3A2A1A0 -/+ B3B2B1B0 ------------------------------- Design a 4-bit adder that can also subtract the two numbers ? Algorithm You will need a selection bit to select between the 2 operations – ADD or SUB If SUB, then first Flip all the bits of B, and find B’ Add B’ to A (like the normal ADDER) Add 1 to the Sum Select bit (M) = 1 Enable Subtract Select bit (M) = 0 Enable Add