820 likes | 990 Views
Modern Instrumentation PHYS 533/CHEM 620. Lecture 7 Digital Circuits Amin Jazaeri Fall 2007. History. 1850: George Boole invents Boolean algebra maps logical propositions to symbols permits manipulation of logic statements using mathematics
E N D
Modern InstrumentationPHYS 533/CHEM 620 Lecture 7 Digital Circuits Amin Jazaeri Fall 2007
History • 1850: George Boole invents Boolean algebra • maps logical propositions to symbols • permits manipulation of logic statements using mathematics • 1938: Claude Shannon links Boolean algebra to switches • his Masters’ thesis • 1945: John von Neumann develops the first stored program computer • its switching elements are vacuum tubes (a big advance from relays) • 1946: ENIAC . . . The world’s first completely electronic computer • 18,000 vacuum tubes • several hundred multiplications per minute • 1947: Shockley, Brittain, and Bardeen invent the transistor • replaces vacuum tubes • enable integration of multiple devices into one package • gateway to modern electronics
Binary Number System Base = 22 Digits: 0, 1 Examples: 1001b = 1 * 23 + 0 * 22 + 0 * 21 + 1 * 20 = 8 + 1 = 9 1010 1101b = 1 * 27 + 1 * 25 + 1 * 23 + 1 * 22 + 1 = 128 + 32 + 8 + 4 + 1 = 173 Note: it is common to put binary digits in groups of 4 to make it easier to read them.
Signed Integers • “unsigned integers” = positive values only • Must also have a mechanism to represent “signed integers” (positive and negative values!) -1010 = ?2 • Two common schemes: • sign-magnitude and • twos complement
+5: 0 0 0 1 0 1 -5: 1 0 0 1 0 1 +ve -ve 5 5 Sign-Magnitude • Extra bit on left to represent sign • 0 = positive value • 1 = negative value • 6-bit sign-magnitude representation of +5 and –5:
Difficulties with Sign-Magnitude • Two representations of zero • Using 6-bit sign-magnitude… • 0: 000000 • 0: 100000 • Arithmetic is awkward!
2’s Complement • Most common scheme of representing negative numbers • natural arithmetic - no special rules! • Rule to represent a negative number in 2’s C • Decide upon the number of bits (n) • Find the binary representation of the +ve value in n-bits • Flip all the bits • Add 1
000101 +5 111010 + 1 111011 -5 2’s Complement Example • Represent -5 in binary using 2’s complement notation • Decide on the number of bits • Find the binary representation of the +ve value in 6 bits • Flip all the bits • Add 1 6 (for example) 111010
+5: 0 0 0 1 0 1 -5: 1 1 1 0 1 1 +ve 5 -ve Sign Bit • In 2’s complement notation, the MSB is the sign bit (as with sign-magnitude notation) • 0 = positive value • 1 = negative value 2’s complement
+5 0 0 0 1 0 1 2’s C 1 1 1 0 1 0+ 1 -5 1 1 1 0 1 1 2’s C 0 0 0 1 0 0+ 1 +5 0 0 0 1 0 1 Example 2’s C +ve -ve 2’s C
Sign-magnitude 2’s complement -6: 10000110+6: +00000110 10001100 -6: 11111010+6: +00000110 00000000 What is -6 plus +6? • Zero, but let’s see
2’s Complement Subtraction • Easy, no special rules • Subtract?? • Actually … addition! A – B = A + (-B) add 2’s complement of B
What is 10 subtract 3? • 7, but… • Let’s do it (we’ll use 6-bit values) 10 – 3 = 10 + (-3) = 7 001010+111101 000111 +3: 000011 -3: 111101
001010+000011 001101 What is 10 subtract -3? • 13, but… • Let’s do it (we’ll use 6-bit values) 10 – (-3) = 10 + (-(-3)) = 13 -3: 111101 +3: 000011
Digital Circuits • Combinatorial logic • Results of an operation depend only on the present inputs to the operation • Uses: perform arithmetic, control data movement, compare values for decision making • Sequential logic • Results depend on both the inputs to the operation and the result of the previous operation • Uses: counter
Boolean Algebra • Rules that govern constants and variables that can take on 2 values • True/false; on/off; yes/no; 0/1 • Boolean logic • Rules for handling Boolean constants and variables • 3 fundamental operations: AND, OR and NOT • Truth Table: specifies results for all possible input combinations
Boolean Operators • AND • Result TRUE if and only if both input operands are true • C = A B • OR • Result TRUE if any input operands are true • C = A + B
Boolean Operators • NOT • Result TRUE if single input value is FALSE • C = A
Boolean Operators • EXCLUSIVE-OR • Result TRUE if either A or B is TRUE but not both • C = A*B • Can be derived from INCLUSIVE-OR, AND and NOT A xor B equals A or B but not both A and B A xor B = either A and not B or B and not A
Boolean Functions • A Boolean function has: • At least one Boolean variable, • At least one Boolean operator, and • At least one input from the set {0,1}. • It produces an output that is also a member of the set {0,1}.
Boolean Function • The truth table for the Boolean function: is shown at the right. • To make evaluation of the Boolean function easier, the truth table contains extra (shaded) columns to hold evaluations of subparts of the function.
Boolean Function • As with common arithmetic, Boolean operations have rules of precedence. • The NOT operator has highest priority, followed by AND and then OR. • This is how we chose the (shaded) function subparts in our table.
Boolean Implementation • Digital computers contain circuits that implement Boolean functions. • The simpler that we can make a Boolean function, the smaller the circuit that will result. • Simpler circuits are cheaper to build, consume less power, and run faster than complex circuits. • With this in mind, we always want to reduce our Boolean functions to their simplest form. • There are a number of Boolean identities that help us to do this.
Boolean Identities • Most Boolean identities have an AND (product) form as well as an OR (sum) form. We give our identities using both forms. Our first group is rather intuitive:
Boolean Identities • Our second group of Boolean identities should be familiar to you from your study of algebra:
Boolean Identities • Our last group of Boolean identities are perhaps the most useful. • If you have studied set theory or formal logic, these laws are also familiar to you.
Boolean Algebra • We can use Boolean identities to simplify the function: as follows:
Boolean Algebra • Sometimes it is more economical to build a circuit using the complement of a function (and complementing its result) than it is to implement the function directly. • DeMorgan’s law provides an easy way of finding the complement of a Boolean function. • Recall DeMorgan’s law states:
Boolean Algebra • DeMorgan’s law can be extended to any number of variables. • Replace each variable by its complement and change all ANDs to ORs and all ORs to ANDs. • Thus, we find the the complement of: is:
Boolean Algebra • Through our exercises in simplifying Boolean expressions, we see that there are numerous ways of stating the same Boolean expression. • These “synonymous” forms are logically equivalent. • Logically equivalent expressions have identical truth tables. • In order to eliminate as much confusion as possible, designers express Boolean functions in standardized or canonical form.
Boolean Algebra • There are two canonical forms for Boolean expressions: sum-of-products and product-of-sums. • Recall the Boolean product is the AND operation and the Boolean sum is the OR operation. • In the sum-of-products form, ANDed variables are ORed together. • For example: • In the product-of-sums form, ORed variables are ANDed together: • For example:
Boolean Algebra • It is easy to convert a function to sum-of-products form using its truth table. • We are interested in the values of the variables that make the function true (=1). • Using the truth table, we list the values of the variables that result in a true function value. • Each group of variables is then ORed together.
Boolean Algebra • The sum-of-products form for our function is: We note that this function is not in simplest terms. Our aim is only to rewrite our function in canonical sum-of-products form.
Logic Gates • The three simplest gates are the AND, OR, and NOT gates. • They correspond directly to their respective Boolean operations, as you can see by their truth tables.
Logic Gates • Another very useful gate is the exclusive OR (XOR) gate. • The output of the XOR operation is true only when the values of the inputs differ. Note the special symbol for the XOR operation.
Logic Gates • NAND and NOR are two very important gates. Their symbols and truth tables are shown at the right.
Logic Gates • NAND and NOR are known as universal gates because they are inexpensive to manufacture and any Boolean function can be constructed using only NAND or only NOR gates.
Nand and Nor Realization x1 x1 x1 x1 x2 x2 x2 x2 x3 x3 x3 x3 x4 x4 x4 x4 x5 x5 x5 x5 x1 x1 x2 x2 x3 x3 x4 x4 x5 x5 Using NAND gates to implement a sum-of-products. Using NOR gates to implement a product-of sums.
Karnaugh Maps x x x x 1 2 1 2 x x x x 3 4 3 4 00 01 11 10 00 01 11 10 00 0 0 0 0 00 0 0 0 0 01 0 0 1 1 01 0 0 1 1 11 1 0 0 1 11 1 1 1 1 10 1 0 0 1 10 1 1 1 1 f = x x + x x x f = x + x x 2 3 1 3 1 4 2 3 1 4 x x x x 1 2 1 2 x x x x 3 4 3 4 00 01 11 10 00 01 11 10 00 1 0 0 1 00 1 1 1 0 01 0 0 0 0 01 1 1 1 0 11 1 1 1 0 11 0 0 1 1 10 1 1 0 1 10 0 0 1 1 x x 1 2 f = x x + x x + x x x f = x x + x x + or 2 4 1 1 3 3 3 2 3 4 4 1 3 x x 2 3 Examples of four-variable Karnaugh maps.
Logic Gates • Gates can have multiple inputs and more than one output. • A second output can be provided for the complement of the operation. • We’ll see more of this later.
Digital Component • The main thing to remember is that combinations of gates implement Boolean functions. • The circuit below implements the Boolean function: We simplify our Boolean expressions so that we can create simpler circuits.
Combinational Circuits • We have designed a circuit that implements the Boolean function: • This circuit is an example of a combinational logic circuit. • Combinational logic circuits produce a specified output (almost) at the instant when input values are applied. • In a later section, we will explore circuits where this is not the case.
Combinational Circuits • Combinational logic circuits give us many useful devices. • One of the simplest is the half adder, which finds the sum of two bits. • We can gain some insight as to the construction of a half adder by looking at its truth table, shown at the right.
Combinational Circuits • As we see, the sum can be found using the XOR operation and the carry using the AND operation.
Combinational Circuits • We can change our half adder into to a full adder by including gates for processing the carry bit. • The truth table for a full adder is shown at the right.
Combinational Circuits • Here’s our completed full adder.
Decoders • Decoders are another important type of combinational circuit. • Among other things, they are useful in selecting a memory location according a binary value placed on the address lines of a memory bus. • Address decoders with n inputs can select any of 2n locations. This is a block diagram for a decoder.