1 / 21

CSE 246: Computer Arithmetic Algorithms and Hardware Design

CSE 246: Computer Arithmetic Algorithms and Hardware Design. Lecture 4. Instructor: Prof. Chung-Kuan Cheng. HW 2 Due 1/27/05. 11.2, 11.6, 11.7

juansanders
Download Presentation

CSE 246: Computer Arithmetic Algorithms and Hardware Design

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE 246: Computer Arithmetic Algorithms and Hardware Design Lecture 4 Instructor: Prof. Chung-Kuan Cheng

  2. HW 2 Due 1/27/05 • 11.2, 11.6, 11.7 • Design a number system different from the conventional binary system. Inventing a new number system would be ideal. Show that the number system is better than the binary system in certain aspect/s. Also, design/describe the basic operations such as addition, subtraction, and comparison.

  3. Topics: • Adders • Synchronous v.s. Asynchronous • AND/OR gate v.s. Circuit • Logic angle • Graph angle (Prefix Adder)

  4. 0/0 0/0 1/0 0/0 1/0 A B C 1/1 M0 M1 PS NS PS NS X=0 X=1 A B A A B B B C C B C A Prefix Computation • FSM example: • Given: • initial state S0=A • A sequence of inputs: (0 0 1 1 1 0 1 0 1) • Derive the sequence of outputs Compute N’s: N1=M0 N2=M0 M0 N3=M1 M0 M0 N4=M1 M1 M0 M0 … Input Sequence: 0 0 1 1 … State table

  5. Graph Based Approach • Consider the (g p) chain • break the long paths g3 p3 g2 p2 C4 g1 p1 C1

  6. Graph Based Approach • Generating g32 and p32 g3 p3 g2 p2 g1 p1 C4 g3 p3 g2 p2 C1 g32 p32

  7. Graph Based Approach • Generating g10 and p10 g3 p3 g2 p2 g1 p1 C4 g1 p1 cin cin g10 p10

  8. g3 p3 g2 p2 g32 p32 g1 p1 cin g10 p10 Graph Based Approach • Generating g30 and p30 g32 p32 g10 g30 p10 p30

  9. Boolean Approach g4 + p4 ( g3 + p3 ( g2 + p2 ( g1 + p1 ( g0 + p0 cin ) ) ) ) g4 , p4 g3 , p3 g2 , p2 g1 , p1 g0 , p0 cin g4+p4g3 , p4p3 g2+p2g1 , p2p1 g0 , p0cin g4+p4g3+p4p3(g2+p2g1) , p4p3p2p1 g0 , p0cin g4+p4g3+p4p3(g2+p2g1)+(p4p3p2p1)g0 , (p4p3p2p1) p0cin

  10. Given: n inputs (gi, pi) An operation o Compute: yi= (gi, pi) o … o (g1, p1) ( 1 <= i <= n) Associativity (A o B) o C = A o ( B o C) Prefix Adder a, i=1 aibi , otherwise 1, i=1 ai xor bi , otherwise gi= pi= • (g’’, p’’) o (g’, p’) = (g, p) • g=g’’ + p’’g’ • p=p’’p’

  11. Prefix Adder: Graph Representation • Example: Ripple Carry Adder ai bi (gi , pi) x y xoy xoy

  12. Prefix Adders: Conditional Sum Adder 8 7 6 5 4 3 2 1

  13. Prefix Adders: Conditional Sum Adder • For output yi, there is an alphabetical tree covering inputs (xi, xi-1, …, x1) 8 7 6 5 4 3 2 1 • alphabetical tree: • Binary tree • Edges do not cross

  14. Prefix Adders: Conditional Sum Adder • From input x1, there is a tree covering all outputs (yi, yi-1, …, y1) 8 7 6 5 4 3 2 1 • The nodes in this tree can be reduced to (g, p) o c = g+pc

  15. Prefix Adders: size and depth • Objective: • Minimize # of nodes, sc(n). • Minimize depth, dc(n) • Ripple Carry Adder: • sc(8) = 7 • dc(8) = 7 • total = 14 • Conditional Sum Adder: • sc(8) = 12 • dc(8) = 3 • total = 15

  16. Prefix Adders: size and depth • Theorem:sc(n)+dnc(n) >=sc(n)+dnc(n) >= 2n-2 • dnc(n) means the depth of the last output • Proof: • Alphabetical tree of yn contains n-1 internal nodes. • For each column where the prefix is not ready, at lease one extra node is needed, therefore we need at least n-(dnc(n) +1) extra nodes • sc(n) >=n-1+(n–(dnc(n)+1))=2n-2-dnc(n) • sc(n) + dnc(n) >= 2n-2

  17. Prefix Adders: Brent – Kung Adder 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 • sc(16) = 26 • dc(16) = 6 • total = 32

  18. Carry Skip Adder a11,8 b11,8 a7,4 b7,4 a3,0 b3,0 c12 c8 c4 cin A2 A1 A0 p11,8 p7,4 p3,0 x c12 0 1 0 1 0 1 c8 c4 • If p3,0=p3p2p1p0 = 1, then x = cin

  19. Carry Propagation Paths • A2 <- MUX <- MUX <- cin • A2 <- MUX <- A1 • A2 <- MUX <- MUX <- A0 • c12 <- MUX <- A2 • c12 <- MUX <- MUX <- A1 • c12 <- MUX <- MUX <- MUX <- A0 • c12 <- MUX <- MUX <- MUX <- MUX <- cin

  20. False Path • A1 <- MUX <- A0 <- cin is a false path • If carry is from cin, then block must have p3p2p1p0 = 1 • Since p3,0 = 1, g3,0 must be 0 • The carry is not generated from A0 • The carry needs not to propagate via A0, it will go from the MUX

  21. Label Algorithm • Problem: • Given a digraph, a set of false paths • Derive the longest path of the graph • Algorithm: • Color the edges on each false path a label • The length of the walk of the same labels are accumulated • Otherwise, change to no label

More Related