UNIT 8 Computer Circuitry: Layers of bstraction 1 oolean Logic & Truth Tables Computer circuitry works based on oolean logic: operations on true (1) and false (0) values. ( ND ) (Ruby: && ) 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 1 ( OR) (Ruby: ) (NOT ) (Ruby:!) 0 1 1 0 2 1
Gates gate is an electronic device that implements a logical function. (Images from Wikipedia) Circuit diagram: bstract Diagram: ND OR NOT 3 Properties Commutative: a b = b a ssociative: Distributive: a b = b a a b c = (a b) c = a (b c) a b c = (a b) c = a (b c) a (b c) = (a b) (a c) Identity: a 1 = a a 0 = a Idempotence: a a = a a a = a Complementation: a a = 0 a a = 1 Double Negation: a = a 4 2
Equivalence Q = ( ) (( C) (C )) C Q 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 http://www.allaboutcircuits.com/vol_4/chpt_7/6.html 5 Equivalence Q = ( ) (( C) (C )) C Q 0 0 0 0 0 0 1 0 0 1 0 0 0 1 1 1 1 0 0 0 1 0 1 0 1 1 0 1 1 1 1 1 Q = ( C) http://www.allaboutcircuits.com/vol_4/chpt_7/6.html 6 3
More gates nand nor xor 0 0 1 1 0 0 1 1 0 1 1 0 1 0 1 1 1 0 0 0 nand ( not and ): nand = not ( and ) nor ( not or ): nor = not ( or ) xor ( exclusive or ): xor = ( and not ) or ( and not ) ( ) ( ) 7 DeMorgan s Law Nand: ( ) = if!((x > 15) && (x < 110)) then... is logically equivalent to if (x <= 15) (x >= 110) then... Nor: ( ) = if!((x < 15) (x > 110)) then... is logically equivalent to if (x >= 15) && (x <= 110) then... 8 4
Logical Function Using Gates 3-bit odd parity checker F = ( x y z) ( x y z) (x y z) (x y z) x y z F 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 9 Logical Function Using Gates 3-bit odd parity checker F = ( x y z) ( x y z) (x y z) (x y z) x y z F 0 0 0 0 0 0 1 1 0 1 0 1 0 1 1 0 1 0 0 1 1 0 1 0 1 1 0 0 1 1 1 1 x y F = x y z z F 10 5
Full dder C out C in S C in C out S 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1 11 Full dder C out C in S C in C out S 0 0 0 0 0 0 0 1 0 1 0 1 0 0 1 0 1 1 1 0 1 0 0 0 1 1 0 1 1 0 1 1 0 1 0 1 1 1 1 1 S = C in C out = (( ) C) ( ) 12 6
Full dder (F) C out 1-bit Full dder C in S 13 nother Full dder (F) http://students.cs.tamu.edu/wanglei/csce350/handout/lab6.html C out 1-bit Full dder C in S 14 7
8-bit Full dder 7 7 2 2 1 1 0 0 C out 1-bit Full dder... 1-bit Full dder 1-bit Full dder 1-bit Full dder C in S 7 S 2 S 1 S 0 8 8 C out 8-bit F 8 S C in 15 Multiplexer (MUX) multiplexer chooses between a set of inputs. F D 1 D 2 D 3 D 4 MUX F 0 0 D 1 0 1 D 2 1 0 D 3 1 1 D 4 http://www.cise.ufl.edu/~mssz/comporg/cdintro.html 16 8
rithmetic Logic Unit (LU) OP 1 OP 0 Carry In & OP OP 0 OP 1 F 0 0 0 1 1 0 1 1 + http://cs-alb-pc3.massey.ac.nz/notes/59304/l4.html 17 Flip Flop flip flop is a sequential circuit that is able to maintain (save) a state. Example: D (Data) Flip-Flop sets output Q to input D when clock turns on. (Images from Wikipedia) Clock Clock S=Set Q to 1, R=Reset Q to 0 18 9
Registers register is just a set of edgetriggered flip-flops. Registers are triggered by a clock signal. D 0 D 1 D 2 D 3 Reg. Q 0 Q 1 Q 2 Q 3 Clock Clock http://cpuville.com/register.htm 19 Central Processing Unit (CPU) CPU contains: rithmetic Logic Unit to perform computation Registers to hold information Instruction register (current instruction being executed) Program counter (to hold location of next instruction in memory) ccumulator (to hold computation result from LU) Data register(s) (to hold other important data for future use) Control unit to regulate flow of information and operations that are performed at each instruction step 20 10
sample CPU http://cpuville.com/main.htm 21 Computer http://cse.iitkgp.ac.in/pds/notes/intro.html 22 11
bstraction We can use layers of abstraction to hide details of the computer design. We can work in any layer, not needing to know how the lower layers work or how the current layer fits into the larger system. -> transistors -> gates -> circuits (adders, multiplexors, flip-flops) -> central processing units (LU, registers, control) -> computer 23 12