Presentation is loading. Please wait.

Presentation is loading. Please wait.

Winter 2016CISC101 - Prof. McLeod1 Today How transistors can carry out commands in a CPU. For example, how to add two integers in an integrated circuit.

Similar presentations


Presentation on theme: "Winter 2016CISC101 - Prof. McLeod1 Today How transistors can carry out commands in a CPU. For example, how to add two integers in an integrated circuit."— Presentation transcript:

1 Winter 2016CISC101 - Prof. McLeod1 Today How transistors can carry out commands in a CPU. For example, how to add two integers in an integrated circuit. Creating an “N Bit Adder”.

2 Winter 2016CISC101 - Prof. McLeod2 Transistors - Cont. Source, Gate and Drain are also called “Collector”, “Base” and “Emitter”: A 5V signal applied to the gate or “base” is enough to cause current to flow. Zero volts turns the signal off. Combinations of transistors can be used to perform boolean logical functions, called “gates”:

3 Winter 2016CISC101 - Prof. McLeod3 “AND” Gate Two transistors forming an “AND” gate: Both Input-1 and Input-2 have to be “1” (ie. 5 volts) for the Output to be “on”. How an “AND” gate is drawn in a logic diagram: Logic or “Truth” table:

4 Winter 2016CISC101 - Prof. McLeod4 “OR” Gate Either Input-1 or Input-2 can cause Output to be “On”. An “OR” gate in a logic diagram.

5 Winter 2016CISC101 - Prof. McLeod5 “NOT” Gate The “NOT” gate just reverses the Input:

6 Winter 2016CISC101 - Prof. McLeod6 “NOR” Gate Same as NOT(OR), like an OR gate followed by a NOT gate.

7 Winter 2016CISC101 - Prof. McLeod7 “NAND” Gate Same as NOT(AND), like an AND gate followed by a NOT gate.

8 Winter 2016CISC101 - Prof. McLeod8 “XOR” Gate X Y Z=X  Y XOR gate (These are NOT(AND) or “NAND” gates.) One way:

9 CISC101 - Prof. McLeod9 Summary: “Truth” or Logic Tables AND I1I1 I2I2 Output 000 010 100 111 OR I1I1 I2I2 Output 000 011 101 111 NOT I Output 01 10 NAND I1I1 I2I2 Output 001 011 101 110 NOR I1I1 I2I2 Output 001 010 100 110 XOR I1I1 I2I2 Output 000 011 101 110

10 CISC101 - Prof. McLeod10 Summary, Cont. Gates: You can use transistors to build a circuit, or “gate”, that provides the logic for each of these operators. Notation: a  b (you will also see just “ab”) means “a AND b” a+b means “ a OR b” a means NOT(a) a  b means “a XOR b” Winter 2016

11 CISC101 - Prof. McLeod11 Digital Circuits Generally, a digital circuit can be represented by: Remember that an input or output can only be either on (1) or off (0). The gates defined above can be used to design circuits that provide a desired logic. Winter 2016

12 CISC101 - Prof. McLeod12 For Example: Adding Binary Numbers Show how to build a circuit to add binary numbers - a “one bit full adder”. First: How do you add decimal (base 10) numbers?: 0 1 0 0 0 4 5 7 0 1 2 3 4 7 2 6 9 1 7 3 Carry digits Sum + Winter 2016

13 CISC101 - Prof. McLeod13 Adding Binary Numbers, for Example The binary numeric system consists of zeros and ones – only. Also called “base 2”. Adding binary numbers: 1 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 0 1 1 0 1 0 0 1 1 0 0 0 1 1 1 0 0 Carry bits Sum + Winter 2016

14 CISC101 - Prof. McLeod14 Half Bit Adder Look at the first column of the process: 1 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 0 1 1 0 1 0 0 1 1 0 0 0 1 1 1 0 0 + carry output input 1 input 2 sum output Winter 2016

15 CISC101 - Prof. McLeod15 Half Bit Adder - Cont. Construct a truth table to describe the operation, considering every possible input: input 1input 2sum outputcarry output 0000 0110 1010 1101 Which gate produces the sum? The carry? Winter 2016

16 CISC101 - Prof. McLeod16 Write the boolean expressions for the sum output and the carry output: Where “ S ” is the sum output and “ C o ” is the carry output. Half Bit Adder - Cont. or Winter 2016

17 CISC101 - Prof. McLeod17 Half Bit Adder - Cont. Logical diagram for the sum output: (This is another way to build a “XOR” gate.) notand or Winter 2016

18 CISC101 - Prof. McLeod18 Test XOR Gate Logic notand or 1 0 0 0 1 1 0 1 1 0 1 1 1 0 0 1 0 1 Winter 2016

19 CISC101 - Prof. McLeod19 Test XOR Gate, Cont. notand or 0 0 1 0 0 1 0 0 0 1 1 0 1 1 0 0 0 0 Winter 2016

20 CISC101 - Prof. McLeod20 Half Bit Adder - Cont. Back to the expression for “ S ”: So, S can be generated by an “XOR” gate and C o by an “AND” gate: I1I1 I2I2 S CoCo Winter 2016

21 CISC101 - Prof. McLeod21 Full Bit Adder Look at one column of the addition process that also adds the carry bit: 1 1 1 0 0 0 1 1 0 1 0 1 1 0 0 1 1 0 1 1 0 1 0 0 1 1 0 0 0 1 1 1 0 0 + carry output carry input input 1 input 2 sum output Winter 2016

22 CISC101 - Prof. McLeod22 Full Bit Adder - Cont. Construct a logic table to describe what happens - list every input possibility: carry inputinput 1input 2sum outputcarry output 00000 10010 01010 00110 11001 10101 01101 11111 Winter 2016

23 CISC101 - Prof. McLeod23 Full Bit Adder - Cont. Create boolean expressions: Where “ I ” is input, “ C i ” is carry input, “ C o ” is carry output and “ S ” is sum output. (Don’t panic! You don’t have to know where these expressions come from and you don’t have to remember them!) Winter 2016

24 CISC101 - Prof. McLeod24 Full Bit Adder - Cont. You can write the logical diagram from these expressions as they are but it can be simplified using two “half-bit” adders and an OR gate: S CoCo I1I1 I2I2 CiCi Winter 2016

25 CISC101 - Prof. McLeod25 Full Bit Adder - Cont. How many transistors required? –AND and OR have 2 each, NOT has 1 (and a resistor) –Then XOR must have 8 (2 NOTs, 2 ANDs, 1 OR) –Half-bit adder must have 10 (1 XOR, 1 AND) –Full-bit adder must have 22 (2 half-bits, 1 OR) Winter 2016

26 CISC101 - Prof. McLeod26 N Bit Full Adder Winter 2016

27 CISC101 - Prof. McLeod27 N Bit Full Adder – Cont. How many transistors? –22 times N –Integers might occupy 4 bytes or 32 bits for example: 704 transistors, minimum! –Just to add two integers! Winter 2016

28 YouTube Video Another presentation of this topic that might help: https://www.youtube.com/watch?v=VBDoT8o4q00 Winter 2016CISC101 - Prof. McLeod28

29 Aside - Minecraft Constructions People with a lot of time on their hands have built adders like these in Minecraft. For example, see these YouTube videos: One bit: http://www.youtube.com/watch?v=tTAuD3Y4meQ 32 bit: http://www.youtube.com/watch?v=R-UdWu60eaI CISC101 - Prof. McLeod29Winter 2016

30 CISC101 - Prof. McLeod30 Other Operations So, a full adder can be used to produce a N+1-bit number as the sum of two other N bit numbers. How about multiplication? From Grade 4: 27  13 81 270 351 11011  1101 11011 000000 1101100 11011000 101011111 Base 10: Base 2: Winter 2016

31 CISC101 - Prof. McLeod31 Multiplication, Cont. So what kind of logic would you build to do multiplication of x times y? Create a running sum, s. For each digit, x i : If x i equals 1 then add 2 i  y to x. Use a bitwise shift operation to calculate 2 i  y (ie. Add a zero to the right of the number). So, an N-bit adder would be used along with some other simple circuits. Winter 2016

32 CISC101 - Prof. McLeod32 Summary of Digital Logic The CPU needs to carry out many other operations than just addition: –subtraction –comparison –multiplication –division, etc. Some common functions (trig, exp, log, etc) would work faster if they were hard coded into the processor too. Lots (and lots!) of transistors!! Winter 2016

33 Aside – My CPU, for Example Intel Core i7 2670QM, 2.2 GHz (up to 3.2 GHz): –32 nm technology –6MB cache –4 cores, 8 threads –995 million transistors, total. –988 pins. CISC101 - Prof. McLeod33Winter 2016

34 CISC101 - Prof. McLeod34 “Don’t Worry, Be Happy!” You do not need to be able to design microprocessor circuits! Besides, INTEL and AMD have some fancy programs that do all the work. The purpose of this discussion has been to give you some idea of how an integrated circuit carries out instructions. (Not MAGIC! Just some good technology!) Winter 2016


Download ppt "Winter 2016CISC101 - Prof. McLeod1 Today How transistors can carry out commands in a CPU. For example, how to add two integers in an integrated circuit."

Similar presentations


Ads by Google