Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 CE 454 Computer Architecture Lecture 5 Ahmed Ezzat The Digital Logic, Ch-3.1, 3.2.

Similar presentations


Presentation on theme: "1 CE 454 Computer Architecture Lecture 5 Ahmed Ezzat The Digital Logic, Ch-3.1, 3.2."— Presentation transcript:

1 1 CE 454 Computer Architecture Lecture 5 Ahmed Ezzat The Digital Logic, Ch-3.1, 3.2

2 CE 454Ahmed Ezzat 2 Outline Transistors and Logic Gates Boolean Algebra Implementation of Boolean Algebra Circuit Equivalence Integrated Circuits Combinational Circuits Arithmetic Circuits Clocks

3 CE 454Ahmed Ezzat 3 Transistors and Logic Gates Border of Computer Science and Electrical Engineering Digital circuit has 2 logical values: (0 – 2.5) volts and (3.5 – 5) volts. Values outside these ranges are not allowed. Gates are the devices that can compute various functions for these two-values signals. Gates are the basis of digital computers. The heart of the Gate logic is the transistor and its use as a binary switch! Details of how to build gates (device level) is not in our scope – pure Electrical Engineering.

4 CE 454Ahmed Ezzat 4 Transistors and Logic Gates Transistor Types: Bipolar Transistor :  TTL (Transistor-Transistor Logic)  ECL (Emitter-Coupled Logic) MOSFET (Metal Oxide Semiconductor Field Effect Transistors):  PMOS: p-channel (switch is ON when input is low)  NMOS: n-channel (switch is ON when input is high)  CMOS: Complementary Metal Oxide Semiconductor Bipolar is faster than CMOS. CMOS is much more dense and uses less power than Bipolar. Functionality is the same. Most modern CPUs (logic functions) and Memories (storage elements) use CMOS technology

5 CE 454Ahmed Ezzat 5 Transistors and Logic Gates Gate Drain Source Switch

6 CE 454Ahmed Ezzat 6 Transistors and Logic Gates

7 CE 454Ahmed Ezzat XOR Logic Gate: Logical function “Exclusive OR” AB + AB alternatively A’B + AB’ Input A Output 00 0 1 Input B 0 1 1 0 01 11 Input A Output Input B Transistors and Logic Gates

8 CE 454Ahmed Ezzat 8 Transistors and Logic Gates Transistors can be connected together with wires, and create logic functions – these functions are called logic gates In modern computer chips, the transistors and wires are very, very, very small...

9 CE 454Ahmed Ezzat 9 Boolean Algebra – George Boole New type of algebra is needed to describe these binary devices/Gates – Boolean Algebra! Boolean algebra can take on variables and functions that can have only binary values. Functions in boolean algebra can have one or more input variables and yield a result that only depends on these inputs! F(), can be defined as f(A) = 1 if A = 0, and f(A) = 0 if A = 1 –- this is the “NOT” function A boolean function of n variables has only 2 n possible combinations on inputs, as a result it can be described by a table with 2 n rows, each row stating the outcome for specific combination of the inputs –- called a truth table.

10 CE 454Ahmed Ezzat 10 Boolean Algebra M = f(A, B, C): M = ABC + ABC + ABC + ABC 

11 CE 454Ahmed Ezzat 11 Implementation of Boolean Algebra A boolean function can be implemented by logic gates in more than one way. A Generalized Procedure for Generating a Digital Logic Design from a Truth Table: 1. Write down the truth table for the function 2. Provide inverters to generate the complement of each input 3. Draw an AND gate for each term with a 1 in the result column 4. Wire the AND gates to the appropriate inputs 5. Feed the output of all the AND gates into one OR logic gate. The above model uses AND, OR and NOT logic gates, however, we can also use NANDs and NORs logic gates as well

12 CE 454Ahmed Ezzat 12 Implementation of Boolean Algebra

13 CE 454Ahmed Ezzat 13 Implementation of Boolean Algebra Switching Expression  Digital Logic Circuit: Example: M = xy + z’ x y z M

14 CE 454Ahmed Ezzat 14 Circuit Equivalence Typically start with Boolean function, apply laws of Boolean algebra to find simpler but equivalent one.

15 CE 454Ahmed Ezzat 15 Circuit Equivalence Identity Table for Boolean Algebra: Each law has 2 forms that are dual of each other: by interchanging AND and OR, and 0 and 1, either form can be produced from the other. Except DeMorgan’s law, the absorption law, and the AND form of the distributive law, the result is intuitive!

16 CE 454Ahmed Ezzat 16 Circuit Equivalence Alternative Boolean Algebra Symbols for the same Gates:

17 CE 454Ahmed Ezzat 17 Circuit Equivalence

18 CE 454Ahmed Ezzat 18 Circuit Equivalence Same Gate can Compute Different Functions (conventions used): +ve logic is an AND function, and –ve logic is an OR function.

19 CE 454Ahmed Ezzat 19 Circuit Equivalence Working with Switching Algebra F(A,B,C) = A’ + B’ + A’BC = A’ + B’ = (AB)’ F(X,Y,Z,W) = XY + W’XYZ + X’Y = XY + X’Y = Y Logic function = ((A + B’)’ B’)’ … using DeMorgan’s law: = (A + B’) + B = A + 1 = 1 Input A Output Input B

20 CE 454Ahmed Ezzat 20 Integrated Circuits Gates are not manufactured or sold individually, but in units called ICs or chips. IC classes:  SSI: Small Scale Integrated Circuit – 1 to 10 gates  MSI: Medium Scale Integrated Circuit – 10 - 100 gates  LSI: Large Scale Integrated Circuit – 100 – 100,000 gates  VLSI: Very Large Scale Integrated Circuit – > 100,000 gates ICs introduce delay (1 – 10 nsec) due to gate delay and switching time delay. Current state-of-the art is close to 100,000,000 transistor on a chip.

21 CE 454Ahmed Ezzat 21 Combinational Circuits Digital logic that is designed so that the outputs are dependent only upon the current set of inputs is called COMBINATIONAL LOGIC – this is in contrast to SEQUENTIONAL LOGIC where output is a function of input and the current state (i.e., circuits containing memory elements). In the following we will cover few frequently-used combinational circuits:  Multiplexers  Decoders  Comparators  Programmable Logic Arrays (PLA)

22 CE 454Ahmed Ezzat 22 Combinational Circuits Multiplexers: Eight data inputs, and three control inputs. The control lines (A,B,C) select which of the 8 input lines to be “gated” out. Each AND is enabled by a different combination of the control lines.

23 CE 454Ahmed Ezzat 23 Combinational Circuits Decoders: The set of n-inputs are decoded to select exactly one of the 2 n output lines.

24 CE 454Ahmed Ezzat 24 Combinational Circuits Comparators: Compares 2 input words, and produces 1 iff they are equal, otherwise it produces 0.

25 CE 454Ahmed Ezzat 25 Combinational Circuits PLA: This PLA consists of: 12 input- lines and their inverse (24- inputs), 50 AND gates, each can have any subset of the 24 inputs (supplied by the user), and 6 OR gates as output lines. Total # pins = 12 + 6 + power, ground = 20 pins. With appropriate internal connections, you can use PLA to implement multiple separate functions. Custom PLA are more common and cheaper.

26 CE 454Ahmed Ezzat 26 Arithmetic Circuits Shifters: 8-input, 8-output, 1- control line (C) to determine the direction of shift (left/right). Don’t deal with overflow.

27 CE 454Ahmed Ezzat 27 Arithmetic Circuits Half Adders (Integers): 1-bit integer addition logic, with 2-bits input and 2-bits as out (sum, carry). Not suitable by-itself as it does not propagate carry as input to the next bit!

28 CE 454Ahmed Ezzat 28 Arithmetic Circuits Full Adders (Integers): 1-bit integer addition logic, with 3-bits input (including carry-bit from previous stage) and 2-bits as out (sum, carry). Full adder is built out of 2 half adders. This type of adder is called ripple carry adder. Addition do not complete until the carry has rippled to the rightmost bit!

29 CE 454Ahmed Ezzat 29 Arithmetic Circuits Full Adders (Integers): Full Adder A3A3 B3B3 Sum 3 Carry Full Adder A2A2 B2B2 Sum 2 Carry Full Adder A1A1 B1B1 Sum 1 Carry Full Adder A0A0 B0B0 Sum 0 Carry “0”

30 CE 454Ahmed Ezzat 30 Arithmetic Circuits Full Adders (Integers): Consider breaking a 32-bit adder up into a 16-bit lower half and two upper 16-bit halves. The circuit consists of three 16-bit adders. Let the lower half start as usual, feed 0 in one of the two upper halves, and feed 1 in the other. After 16-bit addition times, it will be known what the carry is into the upper half is, so select the correct upper half immediately. This reduces the addition time by factor of 2! Such an adder is called carry select adder. This trick can then be repeated to build each 16-bit adder out of replicated 8-bit adder, etc.

31 CE 454Ahmed Ezzat 31 Arithmetic Circuits Arithmetic Logic Unit (ALU): ALU is the math engine for modern digital computers. Performs 4 simple functions:  A AND B // bitwise AND  A OR B // bitwise OR  NOT B // bitwise NOT  A + B // addition operator Operates on single bits “A” and “B”

32 CE 454Ahmed Ezzat 32 Arithmetic Circuits ALU Block Diagram: Logic Unit (AND, OR, NOT) A B Full Adder 2 to 4 Decoder Output Carry Out Carry In Enable A Enable B Inv A Cntl 1 Cntl 0 Sum A B En OR En AND En NOT En ADD A B

33 CE 454Ahmed Ezzat 33 Arithmetic Circuits Bit Slice ALU: Four Functions (AND, OR, NOT B, ADDITION) for single bits A i and B i Inputs – INV A Inverse of A i – AThe single bit A i – ENAEnable the A input – BThe single bit B i – ENBEnable the B input – FOControl signal 0 – F1Control signal 1 – Carry InCarry-in signal (usually the carry out signal from the previous state) Outputs – OutputResult of ALU computation – Carry OutCarry out signal from full adder circuit

34 CE 454Ahmed Ezzat 34 Arithmetic Circuits Control Signals F0 and F1: What do the control signals F0 and F1 do? Both signals go into the 2 to 4 decoder Between the two signals, one of the four ALU functions is selected to be the ALU’s output F0 Output Function 0 A AND B A + B 1 F1 0 A OR B NOT B 0 01 11

35 CE 454Ahmed Ezzat 35 Arithmetic Circuits How would the ALU subtract two integers? A – B Think about the two’s complement procedure 1. NOT B (take the complement of B) 2. NOT B + 1 (add one to the result of step 1)  2’s complement of B 3. A + (NOT B + 1) (add A to the result of step 2) 4. Ignore any carry out signals

36 CE 454Ahmed Ezzat 36 Arithmetic Circuits How would the ALU multiply or divide two integers? How about a shifter? Multiplication and division can be thought of as “shift and add” or “shift and subtract” procedures

37 CE 454Ahmed Ezzat Clocks Just about like everything else in this world, many digital logic designs “run on the clock” Digital circuit designs that use a clock are called synchronous circuits The clock synchronizes when things happen in the digital circuit

38 CE 454Ahmed Ezzat Clocks Clock Signals: Clocks send out a series of pulses, where the signal alternates between high and low Ideally, a clock signal will look like a square wave High Low Rising Clock EdgeFalling Clock Edge One Clock Cycle

39 CE 454Ahmed Ezzat Clocks Synchronous Digital Circuits: Synchronous digital circuits operation can be thought of as a series of discrete events The clock is used to trigger these discrete events Clock “triggers” can be on: – Rising clock edge – Falling clock edge – Clock low – Clock high

40 CE 454Ahmed Ezzat Clocks Asymmetric Clock: Introducing delay can generate asymmetric clock In (b) events can happen when C1 or when C2 is high for example If more intervals are needed, more clocks can be provided, or the state of the clocks can overlap partially which produces 4 distinct intervals: (C1 AND C2), (C1 AND C2), (C1 AND C2), and (C1 AND C2).  

41 CE 454Ahmed Ezzat 41 Clocks How Might You Use a Clock with ALU to Subtract 2 Integers: 1. Cycle 1: Get the value of B from a register and onto the input lines of the ALU Enable B Select the NOT B function – (store the intermediate results back into a register) 2. Cycle 2: Get the value of B from the intermediate results register and place on the input lines of the ALU Enable B Select the increment function (add with first stage’s carry in = 1) – (store the intermediate results back into a register)

42 CE 454Ahmed Ezzat 42 Clocks How Might You Use a Clock with ALU to Subtract 2 Integers: Cycle 3: Get the values of A and (NOT B + 1) from the appropriate registers and onto the input lines of the ALU Enable both A and B Select the ADD A + B function Store the result in the appropriate register

43 CE 454Ahmed Ezzat 43 Clocks How else Might You Use the ALU to Subtract 2 Integers: 1. Cycle 1: Get the value of “B” from a register and place it onto the input lines of the ALU (make it the “A” value) Enable A Enable INV A Note: You now have “the complement of A” going into the ALU Get the value of “A” from a register and place it onto the input lines of the ALU (make it the “B” value) Configure the first stage of the ALU to have “Carry In” signal set to “1” (equivalent of adding 1 or incrementing) Add A and B inputs – (store the results into a register)

44 CE 454Ahmed Ezzat 44


Download ppt "1 CE 454 Computer Architecture Lecture 5 Ahmed Ezzat The Digital Logic, Ch-3.1, 3.2."

Similar presentations


Ads by Google