systems i logic design i
play

Systems I Logic Design I Topics Topics Digital logic Logic gates - PowerPoint PPT Presentation

Systems I Logic Design I Topics Topics Digital logic Logic gates Simple combinational logic circuits A Simple C statement.. C = A + B; A + B; C = What pieces of hardware do you think you might need? pieces of hardware do


  1. Systems I Logic Design I Topics Topics  Digital logic  Logic gates  Simple combinational logic circuits

  2. A Simple C statement….. C = A + B; A + B; C = What pieces of hardware do you think you might need? pieces of hardware do you think you might need? What  Storage - for values A, B, C  Computation logic - to compute +  A way to tell the computer to retrieve the values from storage, add them together, and put the result back in storage  This could be accomplished with a single command (instruction) or with multiple of them. 2

  3. Overview of Logic Design Fundamental Hardware Requirements Fundamental Hardware Requirements  Communication  How to get values from one place to another  Computation  Storage Bits are Our Friends Bits are Our Friends  Everything expressed in terms of values 0 and 1  Communication  Low or high voltage on wire  Computation  Compute Boolean functions  Storage  Store bits of information 3

  4. Digital Signals 0 1 0 Voltage Time  Use voltage thresholds to extract discrete values from continuous signal  Simplest version: 1-bit signal  Either high range (1) or low range (0)  With guard range between them  Not strongly affected by noise or low quality circuit elements  Can make circuits simple, small, and fast 4

  5. Computing with Logic Gates And Or Not a a a out out out b b out = a && b out = a || b out = ! a  Logic gates constructed from transistors  Outputs are Boolean functions of inputs  Respond continuously to changes in inputs  With some, small delay Falling Delay Rising Delay a && b b Voltage a Time 5

  6. Truth Tables And Or Not a a a out out out b b out = a && b out = a || b out = ! a a b out a b out a out a b out a b out a out 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 0 1 1 1 0 1 0 0 1 0 1 1 0 0 1 0 1 1 1 1 1 1 1 1 1 1 1 1 1 6

  7. What about this? a a a b b b c c c out out out a a a b b b c c c out out out 0 0 0 0 0 0 1 0 0 0 0 0 0 1 a 0 0 0 0 1 1 0 b 0 0 0 0 1 1 0 out c 0 0 1 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1 1 1 0 0 0 1 1 1 1 0 1 1 0 0 0 0 1 1 1 0 0 0 0 1 out = !((a && b) || c) 1 1 0 0 1 1 0 1 1 0 0 1 1 0 out = ~(a*b + c) 1 1 1 1 0 0 0 1 1 1 1 0 0 0 1 1 1 1 1 1 0 1 1 1 1 1 1 0 7

  8. Combinational Circuits Acyclic Network Primary Primary Inputs Outputs Acyclic Network of Logic Gates Acyclic Network of Logic Gates  Continously responds to changes on primary inputs  Primary outputs become (after some delay) Boolean functions of primary inputs 8

  9. Bit Equality Bit equal a HCL Expression eq bool eq = (a&&b)||(!a&&!b) b  Generate 1 if a and b are equal Hardware Control Language (HCL) Hardware Control Language (HCL)  Very simple hardware description language  Boolean operations have syntax similar to C logical operations  We ʼ ll use it to describe control logic for processors 9

  10. Hardware Control Language  Very simple hardware description language  Can only express limited aspects of hardware operation  Parts we want to explore and modify Data Types Data Types  bool : Boolean  a , b , c , …  int : words  A , B , C , …  Does not specify word size---bytes, 32-bit words, … Statements Statements  bool a = bool-expr ;  int A = int-expr ; 10

  11. HCL Operations  Classify by type of value returned Boolean Expressions Boolean Expressions  Logic Operations  a && b , a || b , !a  Word Comparisons  A == B , A != B , A < B , A <= B , A >= B , A > B  Set Membership  A in { B, C, D } » Same as A == B || A == C || A == D Word Expressions Word Expressions  Case expressions  [ a : A; b : B; c : C ]  Evaluate test expressions a , b , c , … in sequence  Return word expression A , B , C , … for first successful test 11

  12. Word Equality Word-Level Representation b 31 eq 31 B Eq Bit equal = a 31 A b 30 eq 30 Bit equal a 30 HCL Representation bool Eq = (A == B) Eq b 1 eq 1 Bit equal  32-bit word size a 1 b 0 eq 0  HCL representation Bit equal  Equality operation a 0  Generates Boolean value 12

  13. Bit-Level Multiplexor s Bit MUX HCL Expression bool out = (s&&a)||(!s&&b) b out a  Control signal s  Data signals a and b  Output a when s=1, b when s=0 13

  14. Word Multiplexor Word-Level Representation s s B b 31 Out MUX out 31 A a 31 HCL Representation int Out = [ b 30 s : A; out 30 1 : B; a 30 ];  Select input word A or B depending on control signal s  HCL representation  Case expression  Series of test : value pairs b 0  Output value for first successful out 0 test a 0 14

  15. HCL Word-Level Examples Minimum of 3 Words  Find minimum of three int Min3 = [ input words A < B && A < C : A; C  HCL case expression Min3 B B < A && B < C : B; MIN3 A 1 : C;  Final case guarantees ]; match  How would you build this? 4-Way Multiplexor s1 s0  Select one of 4 inputs int Out4 = [ based on two control D0 !s1&&!s0: D0; bits D1 Out4 MUX4 !s1 : D1; D2  HCL case expression !s0 : D2; D3 1 : D3;  Simplify tests by ]; assuming sequential matching 15

  16. Simple computations are just combinational logic circuits One Bit Adder A B Sum = A*B + A*C in + B*C in C out = A^B^Cin C out + C in = A*B*C in + A*B*C in + A*B*C in + A*B*C in Sum How do you do subtract? Four Bit Adder How do you do multiply? A 3 B 3 A 2 B 2 A 1 B 1 A 0 B 0 0 Sum 4 + + + + Sum 3 Sum 2 Sum 1 Sum 0 16

  17. Arithmetic Logic Unit 0 1 2 3 Y Y Y Y A A A A A A A A X + Y X - Y X & Y X ^ Y L L L L U U U U X X X X B B B B OF OF OF OF ZF ZF ZF ZF SF SF SF SF  Combinational logic  Continuously responding to inputs  Control signal selects function computed  Corresponding to 4 arithmetic/logical operations in Y86  Also computes values for condition codes  OF = overflow flag, ZF = Zero Flag, SF = Sign Flag 17

  18. Arithmetic Logic Unit <s1,s0> = 00 <s1,s0> = 01 < s 1,s0> = 10 <s1,s0> = 11 Y Y Y Y A A A A A A A A X + Y X - Y X & Y X ^ Y L L L L U U U U X X X X B B B B OF OF OF OF ZF ZF ZF ZF SF SF SF SF int Out = [ !s1&&!s0: X+Y; !s1&&s0: Y-Y; s1&&!s0: X&Y; 1 : X^Y; ]; 18

  19. Summary Today Today  Basic logic elements  Combinational logic circuits  Truth tables, gates  Aggregating logic elements  Multiplexors, ALUs, etc. Next Time Next Time  Circuits that remember 19

Recommend


More recommend