coen 212: digital systems design i lecture 7: common ...msoleyma/coen212/coen212_2020/lectuโฆย ยท...
TRANSCRIPT
![Page 1: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/1.jpg)
Slide 1
Department of Electrical & Computer Engineering
COEN 212:DIGITAL SYSTEMS DESIGN I
Lecture 7: Common Combinational Logic Circuits(Adders and Multipliers)
Instructor: Dr. Reza Soleymani, Office: EV-5.125, Telephone: 848-2424 ext.: 4103.
![Page 2: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/2.jpg)
Slide 2
Department of Electrical & Computer Engineering
Lecture 7: Objectives of this lecture
โข In this lecture, we talk about: โ Adders.โ Subtractors.โ Multipliers and,โ Magnitude Comaparators.
โข In the next lecture, we will talk about:โ Decoders, Encoders, Multiplexers
![Page 3: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/3.jpg)
Slide 3
Department of Electrical & Computer Engineering
Lecture 7: Reading for this lecture
โข Digital Design by M. Morris R. Mano and Michael D. Ciletti, 6th Edition, Pearson, 2018:โ Chapter 4 (4.5 to 4.8)
![Page 4: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/4.jpg)
Slide 4
Department of Electrical & Computer Engineering
Lecture 7:Binary Adders
โข Binary numbers are added bit by bit. โข To add two bits, we need a Full Adder.โข It takes in two bits and a carry and outputs a sum and a carry:
โข A full adder can be implemented either directly or using two half adder. A half adder has two inputs and two outputs.
Full Adder: Half Adder:
![Page 5: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/5.jpg)
Slide 5
Department of Electrical & Computer EngineeringLecture 7:Addition: HA
โข Truth table for a half adder is:
โข So: ๐๐ = ๐ด๐ดโฒ๐ต๐ต + ๐ด๐ด๐ต๐ตโฒ = ๐ด๐ดโจ๐ต๐ต
๐ถ๐ถ = ๐ด๐ด๐ต๐ตโข The implementation is:
๐ด๐ด ๐ต๐ต ๐ถ๐ถ ๐๐0 0 0 00 1 0 11 0 0 11 1 1 0
![Page 6: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/6.jpg)
Slide 6
Department of Electrical & Computer EngineeringLecture 7:Addition: HA
โข Half adder can also be implemented using XOR:
โข Implementing a FA using two HAโs:
![Page 7: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/7.jpg)
Slide 7
Department of Electrical & Computer EngineeringLecture 7:Addition: FA implementation uisng HAโs
โข Half adder can also be implemented using XOR:
๐๐๐๐ = ๐ด๐ด๐๐โจ๐ต๐ต๐๐โจ๐ถ๐ถ๐๐โข Also, : ๐ถ๐ถ๐๐+1 = ๐ด๐ด๐๐๐ต๐ต๐๐ + ๐ด๐ด๐๐๐ถ๐ถ๐๐ + ๐ต๐ต๐๐๐ถ๐ถ๐๐
= ๐ด๐ด๐๐ ๐ต๐ต๐๐ + ๐ถ๐ถ๐๐ + ๐ต๐ต๐๐ ๐ด๐ด๐๐ + ๐ถ๐ถ๐๐
= ๐ด๐ด๐๐ ๐ต๐ต๐๐ + ๐ต๐ต๐๐โฒ๐ถ๐ถ๐๐ + ๐ต๐ต๐๐ ๐ด๐ด๐๐ + ๐ด๐ด๐๐โฒ๐ถ๐ถ๐๐
= ๐ถ๐ถ๐๐ ๐ด๐ด๐๐๐ต๐ต๐๐โฒ + ๐ด๐ด๐๐โฒ๐ต๐ต๐๐ + ๐ด๐ด๐๐๐ต๐ต๐๐
= ๐ถ๐ถ๐๐ ๐ด๐ด๐๐โจ๐ต๐ต๐๐ + ๐ด๐ด๐๐๐ต๐ต๐๐
![Page 8: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/8.jpg)
Slide 8
Department of Electrical & Computer EngineeringLecture 7:Addition: FA direct implementation
โข Truth Table of FA: K-map of S
๐๐ = ๐ฅ๐ฅโฒ๐ฆ๐ฆโฒ๐ง๐ง + ๐ฅ๐ฅโฒ๐ฆ๐ฆ๐ง๐ง๐ง + ๐ฅ๐ฅ๐ฆ๐ฆโฒ๐ง๐ง๐ง + ๐ฅ๐ฅ๐ฆ๐ฆ๐ง๐ง
K-map of C
๐ถ๐ถ = ๐ฅ๐ฅ๐ฆ๐ฆ + ๐ฅ๐ฅ๐ง๐ง + ๐ฆ๐ฆ๐ง๐ง
๐ฑ๐ฑ ๐ฒ๐ฒ ๐ณ๐ณ ๐๐ ๐๐
0 0 0 0 00 0 1 0 10 1 0 0 10 1 1 1 01 0 0 0 11 0 1 1 01 1 0 1 01 1 1 1 1
![Page 9: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/9.jpg)
Slide 9
Department of Electrical & Computer EngineeringLecture 7:Addition: FA direct implementation
โข The implementation for ๐๐
๐๐ = ๐ฅ๐ฅโฒ๐ฆ๐ฆโฒ๐ง๐ง + ๐ฅ๐ฅโฒ๐ฆ๐ฆ๐ง๐ง๐ง + ๐ฅ๐ฅ๐ฆ๐ฆโฒ๐ง๐ง๐ง + ๐ฅ๐ฅ๐ฆ๐ฆ๐ง๐ง
โข The implementation for ๐ถ๐ถ
๐ถ๐ถ = ๐ฅ๐ฅ๐ฆ๐ฆ + ๐ฅ๐ฅ๐ง๐ง + ๐ฆ๐ฆ๐ง๐ง
![Page 10: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/10.jpg)
Slide 10
Department of Electrical & Computer EngineeringLecture 7:Binary adders/carry propagationโข Four-bit adder: Delay 2m = 2 ร 4 = 8
โข Carry Lookahead
![Page 11: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/11.jpg)
Slide 11
Department of Electrical & Computer EngineeringLecture 7:Binary adders/carry Lookaheadโข Note that ๐บ๐บ๐๐ generates a carry when both the inputs ๐ด๐ด๐๐ and ๐ต๐ต๐๐
are 1 regardless of the value of ๐ถ๐ถ๐๐. โข ๐บ๐บ๐๐ is called a carry generator.โข ๐๐๐๐ decides whether a carry will propagate from stage ๐๐ to
stage ๐๐ + 1. It is called a carry propagator.โข Note that ๐๐๐๐ and ๐บ๐บ๐๐ are generated from ๐ด๐ด๐๐ and ๐ต๐ต๐๐ in one gate
delay. โข Now, letโs consider the example of 4-bit adder.โข ๐ถ๐ถ0 = the input carryโข ๐ถ๐ถ1 = ๐บ๐บ0 + ๐๐0๐ถ๐ถ0โข ๐ถ๐ถ2 = ๐บ๐บ1 + ๐๐1๐ถ๐ถ1 = ๐บ๐บ1 + ๐๐1 ๐บ๐บ0 + ๐๐0๐ถ๐ถ0 = ๐บ๐บ1 + ๐๐1๐บ๐บ0 + ๐๐1๐๐0๐ถ๐ถ0โข ๐ถ๐ถ3 = ๐บ๐บ2 + ๐๐2๐ถ๐ถ2 = ๐บ๐บ2 + ๐๐2๐บ๐บ1 + ๐๐2๐๐1๐บ๐บ0 + ๐๐2๐๐1๐๐0๐ถ๐ถ0
![Page 12: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/12.jpg)
Slide 12
Department of Electrical & Computer EngineeringLecture 7:Binary adders/carry Lookahead
โข carry lookahead generator:
![Page 13: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/13.jpg)
Slide 13
Department of Electrical & Computer EngineeringLecture 7:Binary adders/carry Lookahead
โข carry lookahead generator:
![Page 14: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/14.jpg)
Slide 14
Department of Electrical & Computer Engineering
Lecture 7:Subtraction:
โข Adder/Subtractor:
โข When ๐๐ = 0, we get ๐ด๐ด+๐ต๐ต.โข When ๐๐ = 1, we get A-B.โข V=1 flags an overflow.
![Page 15: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/15.jpg)
Slide 15
Department of Electrical & Computer Engineering
Lecture 7:Subtraction: Example
โข Example: 8-bit adder.โข Numbers are from -127 to +127 (from 11111111 to 01111111).โข The result may fall out of range.โข Example: Adding +60 and +70 = 130 > 127
+60 00111100 +70 01000110
+130 10000010 โ -2
โข Subtraction +70 from -60-60 11000100-70 10111010-130 1 01111110 โ +1
sign bit
overflow
![Page 16: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/16.jpg)
Slide 16
Department of Electrical & Computer Engineering
Lecture 7:BCD Adder
โข Adding two decimal digits and a carry, we get a number between 0 and 19.
![Page 17: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/17.jpg)
Slide 17
Department of Electrical & Computer Engineering
Lecture 7:BCD Adder
โข ๐ถ๐ถ = 1 whenever ๐พ๐พ = 1 or ๐๐8 = 1.โข ๐ถ๐ถ = 0 when ๐๐8 = 1 and both ๐๐4 and ๐๐2 are zero. โข So,
๐ถ๐ถ = ๐พ๐พ + ๐๐8 ๐๐2 + ๐๐4 = ๐พ๐พ + ๐๐8๐๐4 + ๐๐8๐๐2โข When ๐ถ๐ถ = 1, we need to add 6 (0110) to ๐๐8๐๐4๐๐2๐๐1 to get
๐๐8๐๐4๐๐2๐๐1.
![Page 18: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/18.jpg)
Slide 18
Department of Electrical & Computer Engineering
Lecture 7:Binary multiplication
โข ๐ถ๐ถ = 1 whenever ๐พ๐พ = 1 or ๐๐8 = 1.
โข 2-by-2 multiplier:
multiplying ๐ต๐ต1๐ต๐ต0 by ๐ด๐ด1and shifting the result
multiplying ๐ต๐ต1๐ต๐ต0 by ๐ด๐ด0
![Page 19: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/19.jpg)
Slide 19
Department of Electrical & Computer Engineering
Lecture 7:Binary multiplication
โข Example: 4-bit by 3-bit multiplier
๐ต๐ต3 ๐ต๐ต2 ๐ต๐ต1 ๐ต๐ต0
๐ด๐ด2 ๐ด๐ด1 ๐ด๐ด0
๐ด๐ด0๐ต๐ต3 ๐ด๐ด0๐ต๐ต2 ๐ด๐ด0๐ต๐ต1 ๐ด๐ด0๐ต๐ต0
๐ด๐ด1๐ต๐ต3 ๐ด๐ด1๐ต๐ต2 ๐ด๐ด1๐ต๐ต1 ๐ด๐ด1๐ต๐ต0
๐ด๐ด2๐ต๐ต3 ๐ด๐ด2๐ต๐ต2 ๐ด๐ด2๐ต๐ต1 ๐ด๐ด2๐ต๐ต0
๐ถ๐ถ6 ๐ถ๐ถ5 ๐ถ๐ถ4 ๐ถ๐ถ3 ๐ถ๐ถ2 ๐ถ๐ถ1 ๐ถ๐ถ0
![Page 20: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/20.jpg)
Slide 20
Department of Electrical & Computer Engineering
Lecture 7:Magnitude Comparator
โข It compares two numbers ๐ด๐ด = ๐ด๐ด3๐ด๐ด2๐ด๐ด1๐ด๐ด0 and ๐ต๐ต = ๐ต๐ต3๐ต๐ต2๐ต๐ต1๐ต๐ต0 and decides whether ๐ด๐ด = ๐ต๐ต,๐ด๐ด > ๐ต๐ต or ๐ด๐ด < ๐ต๐ต.
โข ๐ด๐ด = ๐ต๐ต if and only if ๐ด๐ด3 = ๐ต๐ต3,๐ด๐ด2 = ๐ต๐ต2,๐ด๐ด1 = ๐ต๐ต1,๐ด๐ด0 = ๐ต๐ต0.โข ๐ด๐ด3 = ๐ต๐ต3 if ๐๐3 = ๐ด๐ด3๐ต๐ต3 + ๐ด๐ด3โฒ ๐ต๐ต3โฒ .โข Similarly ๐๐๐๐ = ๐ด๐ด๐๐๐ต๐ต๐๐ + ๐ด๐ด๐๐โฒ๐ต๐ต๐๐โฒ , ๐๐ = 0, 1, 2, 3 shows ๐ด๐ด๐๐ = ๐ต๐ต๐๐.โข So: ๐ด๐ด = ๐ต๐ต = ๐๐3๐๐2๐๐1๐๐0.โข Case of: ๐ด๐ด > ๐ต๐ต: ๐ด๐ด > ๐ต๐ตโข If ๐ด๐ด3 is equal to 1 and ๐ต๐ต3 = 0. So, if ๐ด๐ด3๐ต๐ต3โฒ = 1, then ๐ด๐ด > ๐ต๐ต. โข If ๐ด๐ด3 = ๐ต๐ต3, i.e., if ๐๐3 = 1 and ๐ด๐ด2 = 1 and ๐ต๐ต2 = 0, i.e., if ๐๐3๐ด๐ด2๐ต๐ต2โฒ = 1.โข if ๐๐3๐๐2๐ด๐ด1๐ต๐ต1โฒ = 1 or ๐๐3๐๐2๐๐1๐ด๐ด0๐ต๐ต0โฒ = 1.
๐ด๐ด > ๐ต๐ต = ๐ด๐ด3๐ต๐ต3โฒ + ๐๐3๐ด๐ด2๐ต๐ต2โฒ + ๐๐3๐๐2๐ด๐ด1๐ต๐ต1โฒ + ๐๐3๐๐2๐๐1๐ด๐ด0๐ต๐ต0โฒ
and๐ด๐ด < ๐ต๐ต = ๐ด๐ด3โฒ ๐ต๐ต3 + ๐๐3๐ด๐ด2โฒ ๐ต๐ต2 + ๐๐3๐๐2๐ด๐ด1โฒ ๐ต๐ต1 + ๐๐3๐๐2๐๐1๐ด๐ด0โฒ ๐ต๐ต0
![Page 21: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/21.jpg)
Slide 21
Department of Electrical & Computer Engineering
Lecture 7:Magnitude Comparator
โข 4-bit Magnitude Comparator:
![Page 22: COEN 212: DIGITAL SYSTEMS DESIGN I Lecture 7: Common ...msoleyma/COEN212/COEN212_2020/Lectuโฆย ยท Lecture 7: Binary adders/carry Lookahead โข Note that ๐บ๐บ ๐๐ generates](https://reader036.vdocuments.net/reader036/viewer/2022081607/5ed81810cba89e334c673c06/html5/thumbnails/22.jpg)
Slide 22
Department of Electrical & Computer Engineering
Lecture 7:Knowledge Check
โข Question 1: To add two 8-bit numbers, the number of Half-Adders needed is:
โข a) 8, b) 15, c) 16, d) 17โข Question 2: If the gate delay is 10 ns (nano seconds), what
would be the delay in adding two 8 bit numbers using carry look ahead?
โข a) 40 ns, b) 160 ns, c) 80 ns, d) 20 ns
โข Question 3: