CSE140: Components and Design Techniques for Digital Systems. Decoders, adders, comparators, multipliers and other ALU elements. Tajana Simunic Rosing

Similar documents
CSE140: Components and Design Techniques for Digital Systems. Logic minimization algorithm summary. Instructor: Mohsen Imani UC San Diego

Adders, subtractors comparators, multipliers and other ALU elements

Adders, subtractors comparators, multipliers and other ALU elements

CSE 140 Lecture 11 Standard Combinational Modules. CK Cheng and Diba Mirza CSE Dept. UC San Diego

Hardware Design I Chap. 4 Representative combinational logic

CS 140 Lecture 14 Standard Combinational Modules

Chapter 4. Combinational: Circuits with logic gates whose outputs depend on the present combination of the inputs. elements. Dr.

DIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

CSEE 3827: Fundamentals of Computer Systems. Combinational Circuits

Chapter 5 Arithmetic Circuits

Combinational Logic. By : Ali Mustafa

Overview. Arithmetic circuits. Binary half adder. Binary full adder. Last lecture PLDs ROMs Tristates Design examples

CMPUT 329. Circuits for binary addition

Midterm Exam Two is scheduled on April 8 in class. On March 27 I will help you prepare Midterm Exam Two.

ECE 545 Digital System Design with VHDL Lecture 1. Digital Logic Refresher Part A Combinational Logic Building Blocks

Class Website:

ARITHMETIC COMBINATIONAL MODULES AND NETWORKS

Arithmetic Circuits-2

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

Digital System Design Combinational Logic. Assoc. Prof. Pradondet Nilagupta

Logic. Combinational. inputs. outputs. the result. system can

EECS150. Arithmetic Circuits

Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C.

Carry Look Ahead Adders

Combinational Logic. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C.

Combinational Logic. Mantıksal Tasarım BBM231. section instructor: Ufuk Çelikcan

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

14:332:231 DIGITAL LOGIC DESIGN

COMBINATIONAL LOGIC FUNCTIONS

3. Combinational Circuit Design

IT T35 Digital system desigm y - ii /s - iii

Floating Point Representation and Digital Logic. Lecture 11 CS301

CSE 140L Spring 2010 Lab 1 Assignment Due beginning of the class on 14 th April

MODULAR CIRCUITS CHAPTER 7

CMPEN 411 VLSI Digital Circuits Spring Lecture 19: Adder Design

Design of Sequential Circuits

Systems I: Computer Organization and Architecture

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

CMSC 313 Lecture 18 Midterm Exam returned Assign Homework 3 Circuits for Addition Digital Logic Components Programmable Logic Arrays

Logic Design Combinational Circuits. Digital Computer Design

Design of Combinational Logic

Logic and Computer Design Fundamentals. Chapter 5 Arithmetic Functions and Circuits

Binary addition by hand. Adding two bits

Digital Integrated Circuits A Design Perspective. Arithmetic Circuits. Jan M. Rabaey Anantha Chandrakasan Borivoje Nikolic.

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Digital Integrated Circuits A Design Perspective. Arithmetic Circuits. Jan M. Rabaey Anantha Chandrakasan Borivoje Nikolic.

CprE 281: Digital Logic

Arithmetic Circuits-2

Sample Test Paper - I

UNIT II COMBINATIONAL CIRCUITS:

VLSI Design. [Adapted from Rabaey s Digital Integrated Circuits, 2002, J. Rabaey et al.] ECE 4121 VLSI DEsign.1

Number representation

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

CHAPTER1: Digital Logic Circuits Combination Circuits

COSC3330 Computer Architecture Lecture 2. Combinational Logic

ELCT201: DIGITAL LOGIC DESIGN

Numbers and Arithmetic

PG - TRB UNIT-X- DIGITAL ELECTRONICS. POLYTECHNIC-TRB MATERIALS

Combinational Logic Design Combinational Functions and Circuits

211: Computer Architecture Summer 2016

Cs302 Quiz for MID TERM Exam Solved

CMSC 313 Lecture 18 Midterm Exam returned Assign Homework 3 Circuits for Addition Digital Logic Components Programmable Logic Arrays

1 Short adders. t total_ripple8 = t first + 6*t middle + t last = 4t p + 6*2t p + 2t p = 18t p

ECE/CS 250 Computer Architecture

COE 202: Digital Logic Design Combinational Circuits Part 2. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

ECE/CS 552: Introduction To Computer Architecture 1. Instructor:Mikko H Lipasti. Fall 2010 University i of Wisconsin-Madison

9. Datapath Design. Jacob Abraham. Department of Electrical and Computer Engineering The University of Texas at Austin VLSI Design Fall 2017

Combina-onal Logic Chapter 4. Topics. Combina-on Circuit 10/13/10. EECE 256 Dr. Sidney Fels Steven Oldridge

Section 3: Combinational Logic Design. Department of Electrical Engineering, University of Waterloo. Combinational Logic

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

EECS150 - Digital Design Lecture 10 - Combinational Logic Circuits Part 1

Digital Logic & Computer Design CS Professor Dan Moldovan Spring Copyright 2007 Elsevier 2-<101>

CMSC 313 Lecture 17. Focus Groups. Announcement: in-class lab Thu 10/30 Homework 3 Questions Circuits for Addition Midterm Exam returned

Fundamentals of Digital Design

Unit 3 Session - 9 Data-Processing Circuits

Lecture 7: Logic design. Combinational logic circuits

ISSN (PRINT): , (ONLINE): , VOLUME-4, ISSUE-10,

Computer Science. 19. Combinational Circuits. Computer Science COMPUTER SCIENCE. Section 6.1.

Numbers & Arithmetic. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See: P&H Chapter , 3.2, C.5 C.

Combinational Logic Design Arithmetic Functions and Circuits

Unit II Chapter 4:- Digital Logic Contents 4.1 Introduction... 4

Binary addition (1-bit) P Q Y = P + Q Comments Carry = Carry = Carry = Carry = 1 P Q

Hakim Weatherspoon CS 3410 Computer Science Cornell University

ECE 2300 Digital Logic & Computer Organization

Every time has a value associated with it, not just some times. A variable can take on any value within a range

EECS150 - Digital Design Lecture 24 - Arithmetic Blocks, Part 2 + Shifters

Chapter 03: Computer Arithmetic. Lesson 03: Arithmetic Operations Adder and Subtractor circuits Design

CSE477 VLSI Digital Circuits Fall Lecture 20: Adder Design

ECE 545 Digital System Design with VHDL Lecture 1A. Digital Logic Refresher Part A Combinational Logic Building Blocks

Chapter 4: Designing Combinational Systems Uchechukwu Ofoegbu

COMBINATIONAL LOGIC CIRCUITS. Dr. Mudathir A. Fagiri

Total Time = 90 Minutes, Total Marks = 50. Total /50 /10 /18

Digital Logic & Computer Design CS Professor Dan Moldovan Spring 2010

Arithmetic Circuits-2

Numbers and Arithmetic

ELEN Electronique numérique

Function of Combinational Logic ENT263

CPE100: Digital Logic Design I

Lecture 2 Review on Digital Logic (Part 1)

CSE 140 Midterm 3 version A Tajana Simunic Rosing Spring 2015

Transcription:

CSE4: Components and Design Techniques for Digital Systems Decoders, adders, comparators, multipliers and other ALU elements Tajana Simunic Rosing

Mux, Demux Encoder, Decoder 2

Transmission Gate: Mux/Tristate building block nmos are on when gate= pass s poorly from source to drain pmos are on when gate= pass s poorly from source to drain Transmission gate is a better switch passes both and well When EN =, the switch is ON: EN = and A is connected to B When EN =, the switch is OFF: A is not connected to B A EN EN B

shared bus Floating: Z, Tristate Buffer and Tristate Busses Floating, high impedance, open, high Z Disconnected Floating nodes are used in tristate busses many different drivers, but only one is active at once Tristate Bus processor to bus from bus en Tristate Buffer video en2 E to bus from bus A Y Ethernet en3 to bus E A Y Z Z from bus memory to bus from bus en4

2: Multiplexer or Mux Selects between one of N inputs to connect to output log 2 N-bit select input control input Example: 2: Mux D D S Y Logic gates Tristates Pass gates Y D D S D S Y S D D Y S Y D D D S D Y = D S + D S D Y

2: mux: Z = A'I + AI Multiplexers 4: mux: Z = A'B'I + A'BI + AB'I 2 + ABI 3 8: mux: Z = A'B'C'I + A'B'CI + A'BC'I 2 + A'BCI 3 + AB'C'I 4 + AB'CI 5 + ABC'I 6 + ABCI 7 In general: Z = 2 n -(m k I k ) k= in minterm shorthand form for a 2 n : Mux I I 2: mux A Z I I I2 I3 4: mux A B Z I I I2 I3 I4 I5 I6 I7 8: mux A B C Z 6

Logic using Multiplexers Example of 2: mux implementation Y = AB A B Y A Y A B B Y

Logic using Multiplexers This multiplexer implements the same functionality for Y as the truth table A. Yes B. No A B Y Y = AB GND Vdd A B Y

Mux as general-purpose logic Example: Z(A,B,C) = AC + BC' + A'B C I I I2 I3 2 3 4: mux Z A B 9

Cascading muxes I I C 2: mux I Z I C 2: mux Z A B A Function Z(A,B,C) implemented by 2: Muxes above is: A. A B C +ABC+BC B. (A +AC)B+B C C. A B +B C+BC D. A +AC+BC E. None of the above

Mux example: Logical function unit C C C2 Function Comments always A + B logical OR (A B)' logical NAND A xor B logical xor A xnor B logical xnor A B logical AND (A + B)' logical NOR always 2 3 8: MUX 4 5 6 7 S2 S S F C C C2

Multiplexer En D D D 2 D 3 2 3 y What is the output of the mux if En=, S= 2, D[3:]=A 6? A. B. C.Z D.X E.None of the above S S Selects between one of N inputs to connect to the output. log 2 N-bit select input control input

Demultiplexers (opposite of Mux) En y i = x if i = (S n-,.., S ) & En = y i = otherwise x y 2 n- -y S(n-,) Control Input 3

Decoder N inputs, 2 N outputs One-hot outputs: only one output HIGH at a time when enable signal is (EN=) EN A A 2:4 Decoder Y 3 Y 2 Y Y A A Y 3 Y 2 Y Y

Decoder: logic equations & implementation Decoders/demultiplexers control inputs (called selects (S)) represent binary index of output to which the input is connected data input usually called enable or G in equations-> :2 Decoder: O = G S O = G S A A EN 2:4 Decoder: O = G S S O = G S S O2 = G S S O3 = G S S Y 3 Y 2 Y Y 3:8 Decoder: O = G S2 S S O = G S2 S S O2 = G S2 S S O3 = G S2 S S O4 = G S2 S S O5 = G S2 S S O6 = G S2 S S O7 = G S2 S S

Logic Using Decoders OR minterms EN A B 2:4 Decoder Minterm AB AB AB AB EN 2 3 3:8 DEC 4 5 6 7 S2 S S A'B'C' A'B'C A'BC' A'BC AB'C' AB'C ABC' ABC Y = AB + AB = A B Y A B C

F(A,B,C) = M(,2,4) Another example 7

Example as general-purpose logic F = A'BC'D + A'B'CD + ABCD F2 = ABC'D' + ABC F3 = (A' + B' + C' + D') Enable 4:6 DEC A'B'C'D' A'B'C'D 2 A'B'CD' 3 A'B'CD 4 A'BC'D' 5 A'BC'D 6 A'BCD' 7 A'BCD 8 AB'C'D' 9 AB'C'D AB'CD' AB'CD 2 ABC'D' 3 ABC'D 4 ABCD' 5 ABCD A B C D

Decoder Applications Decoder converts a binary address to the assertion of the addressed device 2 3 4 5 6 7 I I I 2 2 E (enable) 2 3 4 5 6 7 y y.. y 7 n to 2 n decoder function: y i = if E= & (I 2, I, I ) = i y i = otherwise n inputs n= 3 2 n outputs 2 3 = 8 9

Tree of Decoders En Implement a 6-2 6 decoder with 3-2 3 decoders. En y I 2, I, I D y 7 I 5, I 4, I 3 I 2, I, I D y 8 y 5 y 56 I 2, I, I D7 y 63 2

Encoder En I 3 8 inputs 3 outputs I 7 2 4 5 6 7 A 2 y y y 2 At most one I i =. (y n-,.., y ) = i if I i = & En = (y n-,.., y ) = otherwise. A = if En = and one i s.t. I i = A = otherwise.

Encoder: Logic Diagram En En y y I I 3 I 5 I 7 En I 2 I 3 I 6 I 7 En y 2 I 4 I 5 I 6 I 7 I I.. I 6 I 7 A 22

Decoder, Encoder, Mux, Demux Processors P Data Mux Arbiter Memory Bank Address Data P2 Address 2 Address k Pk Demux Mux Data k Address n n-m Decoder Decoder: Decode the address to assert the addressed device Mux: Select the inputs according to the index addressed by the control signals m 2 m 23

Adders 24

-Bit & Multi-bit Adders Half Adder A B Full Adder A B Types of multi-bit adders Ripple-carry (slow) Carry-lookahead (faster) C out + A B S C out S = A B C out = AB S C in C out + S A B C out C in S C out Symbol A B N N + S N C in S = A B C in C out = AB + AC in + BC in

Ripple-Carry Adder Chain -bit adders together Carry ripples through entire chain Disadvantage: slow @ A @ B @NCin @ @ A B late arriving signal @ @N+ @ Cout @N+2 two gate delays to compute Cout A 3 B 3 A 3 B 3 A B A B C out + C + 3 C 29 C + C + C in S 3 S 3 Ripple-carry adder delay S S t ripple = Nt FA where t FA is the delay of a full adder

Carry-lookahead adders Adder with propagate (P) and generate (G) outputs: Evaluate Sum and Ci+ Sum = Ai xor Bi xor Ci Ci+ = Ai Bi + Ai Ci + Bi Ci = Ai Bi + Ci (Ai xor Bi) = Gi + Ci Pi Ai Bi Ci Pi @ gate delay Si @ 2 gate delays Gi @ gate delay increasingly complex logic for carries C P G C P P G P G C @ 3 C2 @ 3 C P P P2 G P P2 G P2 G2 C3 @ 3 C P P P2 P3 G P P2 P3 G P2 P3 G2 P3 G3 C4 @ 3 27

Carry-Lookahead Adder Example: 4-bit blocks (G 3: and P 3: ) : Generally: G 3: = G 3 + P 3 (G 2 + P 2 (G + P G ) P 3: = P 3 P 2 P P Step : Compute G i and P i for all columns Step 2: Compute G and P for k-bit blocks Step 3: C in propagates through each k-bit propagate/generate block G i:j = G i + P i (G i- + P i- (G i-2 + P i-2 G j ) P i:j = P i P i- P i-2 P j C i = G i:j + P i:j C i-

Adders: CLA vs. Ripple You are designing a 64-bit adder. To get the best performance, would you design: A. A 64-bit ripple-carry adder B. A 64-bit carry-lookahead adder C. 8-bit sections of carry-lookahead with ripple carry connecting them D. 32-bit sections of ripple-carry connected with carrylookahead 29

Subtractors 3

2s complement If N is a positive number, then the negative of N (its 2s complement or N* ) is bit-wise complement plus 7* is -7 : -> + = (-7) -7* is 7: -> + = ( 7) 4 3 2 + + +2 +3 5 6 7 8 +4 +5 +6 +7 3

Subtraction If you are using 4 bit number, what is the result of the following equation in 2s complement: y = 4-7 A. B. C. D. E. None of the above 32

Detecting Overflow: Method Assuming 4-bit two s complement numbers, one can detect overflow by detecting when the two numbers sign bits are the same but are different from the result s sign bit If the two numbers sign bits are different, overflow is impossible Adding a positive and negative can t exceed the largest magnitude positive or negative Simple circuit overflow = a3 b3 s3 + a3b3s3 sign bits + + + overflow (a) overflow (b) no overflow (c) If the numbers sign bits have the same value, which differs from the result s sign bit, overflow has occurred. 33

Detecting Overflow: Method 2 Detect a difference between carry-in to sign bit and carry-out from it Yields a simpler circuit: overflow = c3 xor c4 = c3 c4 + c3 c4 + + + overflow (a) overflow (b) no overflow (c) If the carry into the sign bit column differs from the carry out of that column, overflow has occurred. 34

Subtractor Symbol A B N N - Y N Implementation A B N N N + Y N

Adder/subtractor A3 B3B3' A2 B2B2' A BB' A BB' Sel Sel Sel Sel A B A B A B A B Cout Cin Cout Cin Cout Cin Cout Cin Sel Sum Sum Sum Sum S3 S2 S S Overflow In this schematic addition occurs when Sel signal is: A. True B. False 36

More ALU Components 37

Comparator: Equality Symbol Implementation A 3 B 3 A 4 = B 4 A 2 B 2 A Equal Equal B A B

Comparator: Less Than A N B N - N [N-] A < B 5-<39>

Shifters Logical shifter: shifts value to left or right and fills empty spaces with s Ex: >> 2 = Ex: << 2 = Arithmetic shifter: same as logical shifter, but on right shift, fills empty spaces with the old most significant bit Ex: >>> 2 = Ex: <<< 2 = Rotator: rotates bits in a circle, such that bits shifted off one end are shifted into the other end Ex: ROR 2 = Ex: ROL 2 =

General Shifter Design A 3 A 2 A A shamt : 2 S : Y 3 shamt : 2 S : Y 2 4 4 A 3: >> Y 3: S : Y S : Y

Multiplication of positive binary numbers Generalized representation of multiplication by hand For demo see: http://courses.cs.vt.edu/~cs4/buildingblocks/multiply..html 42

pp4 pp3 pp2 pp Multiplier design array of AND gates Multiplier Array Style a3 a2 a a b b b2 + (5-bit) b3 + (6-bit) A * P B + (7-bit) Block symbol p7..p 43

Division of positive binary numbers Repeated subtraction Set quotient to Repeat while dividend >= divisor Subtract divisor from dividend Add to quotient When dividend < divisor: Reminder = dividend Quotient is correct Example: Dividend: ; Divisor: Dividend Quotient - + - + For demo see: http://courses.cs.vt.edu/~cs4/buildingblocks/binary.divide.html 44

ALU: Arithmetic Logic Unit 46

Designing an Arithmetic Logic Unit ALUop 3 A N Zero B N ALU N CarryOut Result Overflow ALU Control Lines (ALUop) Function And Or Add Subtract Set-on-less-than 47

A One Bit ALU This -bit ALU performs AND, OR, and ADD + - 4-2 - 6 48

-bit ALU A 32-bit ALU 32-bit ALU 49

Subtract We d like to implement a means of doing A-B (subtract) but with only minor changes to our hardware. How?. Provide an option to use bitwise NOT A 2. Provide an option to use bitwise NOT B 3. Provide an option to use bitwise A XOR B 4. Provide an option to use instead of the first CarryIn 5. Provide an option to use instead of the first CarryIn Selection A Choices alone B Both and 2 C Both 3 and 4 D Both 2 and 5 E None of the above 5

Full 32-bit ALU what signals accomplish ADD? Binvert CIn Oper A 2 B 2 C 2 D 2 E NONE OF THE ABOVE sign bit (adder output from bit 3) 5

Full 32-bit ALU what signals accomplish OR? Binvert CIn Oper A B C D E NONE OF THE ABOVE sign bit (adder output from bit 3) 52

Full 32-bit ALU Little more intense can you get this? what signals accomplish SUB? Binvert CIn Oper A 2 B 2 C 2 D 2 E NONE OF THE ABOVE sign bit (adder output from bit 3) 53

Zero Extend 2 3 Arithmetic Logic Unit Example 2 A N N N B N F 2 A N ALU N Y B N 3 F F 2: Function A & B A B A + B Not used A & ~B A ~B C out + [N-] S A - B Not used N N N N 2 F : Y N

ALU Design Example 3 S2 S S Function B-A A-B A+B A xor B A or B A and B 55