0% found this document useful (0 votes)
4 views

ProgrammableDevices 1

This document discusses the design of an adder circuit. It describes how a multi-bit adder can be built by connecting multiple single-bit full adder circuits. It also explains that adding numbers in a fixed-bit system can cause overflow errors if the result is too large to represent within the available bits.

Uploaded by

DOOAMADAA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

ProgrammableDevices 1

This document discusses the design of an adder circuit. It describes how a multi-bit adder can be built by connecting multiple single-bit full adder circuits. It also explains that adding numbers in a fixed-bit system can cause overflow errors if the result is too large to represent within the available bits.

Uploaded by

DOOAMADAA
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Electrical Engineering 1

Lecture 1: The Adder Circuit


Overview
· So far we have assumed sensors produce 1-bit yes/no outputs
· Many sensors will produce an output that is a binary number
· We will look at circuits that perform arithmetic on binary
numbers
Addition
· “Normal” base 10 addition
· Columns represent 1s, 10s, 100s, etc.
· Add columns together to get answer
· If answer in one column becomes greater than 9, we
generate a carry into the next column
100s 10s 1s

105 234
+213 +167
318 401
11
Binary Addition
· Columns represent 1s, 2s, 4s, 8s etc.
· Add columns together to get answer
· If answer in one column becomes greater than 1, we
generate a carry into the next column

8s 4s 2s 1s

1010 0001
+0001 +0011
1011 0100
11
Design of Adder Circuit
· As a simple example, let’s look at a 4-bit adder
· One input number is called A, one called B
· Device has 8 inputs, 4 outputs
· Too many inputs for K-map if we solve in one go
· Real adders would be likely to use many more than 4 bits

A3 A2 A1 A0 0001
+ B3 B2 B1 B0 +0011
Q3 Q 2 Q 1 Q 0 0100
11
Iterative Design of Adder Circuit
· An iterative design consists of many copies of simple
circuit
· We only need to design a 1-bit adder
· Then connect four copies

A3 A2 A1 A0 0001
+ B3 B2 B1 B0 +0011
Q3 Q 2 Q 1 Q 0 0100
11
The 1-bit Adder Circuit
· The 1-bit adder has
 Inputs: A, B, CIN
 Outputs Q, COUT

Zoom in on a
single bit position
A3 A2 A1 A0
+ B3 B2 B1 B0
Q3 Q 2 Q 1 Q 0
COUT CIN
The 1-bit Adder Circuit
· The 1-bit adder has 0+0+0=0, carry 0
 Inputs: A, B, CIN 0+0+1=1, carry 0
0+1+1=0, carry 1
 Outputs Q, COUT 1+1+1=1, carry 1
· Q=1 when odd number of inputs is 1
· COUT=1 when majority of inputs is 1
Inputs Outputs
A B CIN Q COUT
A3 A2 A1 A0 0 0 0 0 0
+ B3 B2 B1 B0 0 0 1 1 0
0 1 0 1 0
Q3 Q 2 Q 1 Q 0 0 1 1 0 1
COUT CIN 1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
The 1-bit Adder Circuit
· The COUT output

𝐴.𝐵 Inputs Outputs


AB A B CIN Q COUT
CIN 00 01 11 10
0 0 0 0 0
0 0 0 1 0
0 0 1 1 0
0 1 0 1 0
1 0 1 1 1 0 1 1 0 1
𝐴 .𝐶 𝐼𝑁 1 0 0 1 0
𝐵 . 𝐶 𝐼𝑁 1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
The 1-bit Adder Circuit
· The COUT output

· The Q output

Inputs Outputs
AB A B CIN Q COUT
CIN 00 01 11 10
0 1
0 0 0 0 0
0 0 1
0 0 1 1 0
0 1 0 1 0
1 1 0 1 0 0 1 1 0 1
1 0 0 1 0
1 0 1 0 1
1 1 0 0 1
1 1 1 1 1
The Full Adder Circuit
· The COUT output

· The Q output

A Q=SUM
B
CIN
COUT

· This circuit is called the full adder


· (“Full” because it takes account of carry inputs)
The Parallel Adder
· To make an n-bit adder, chain n full adders together
· COUT from one stage feeds CIN for the next

B 3 A3 B 2 A2 B 1 A1 B 0 A0
CIN=0
B A CIN B A CIN B A CIN B A CIN
Full Adder Full Adder Full Adder Full Adder
COUT SUM COUT SUM COUT SUM COUT SUM

Q3 Q2 Q1 Q0
The Parallel Adder
0001 A
+0011 B
0100 Q
00 1 1 CIN/COUT

B 3 A3 B 2 A2 B 1 A1 B 0 A0
0 0 0 0 1 0 1 1 CIN=0
B A CIN B A CIN B A CIN B A CIN
Full Adder Full Adder Full Adder Full Adder
0 1 1
COUT SUM COUT SUM COUT SUM COUT SUM
0 0 1 0 0
Q3 Q2 Q1 Q0
Arithmetic with a fixed number of bits
· When we build an arithmetic circuit, we have to choose a
fixed number of bits and stick with it
· Imposes a limit on the size of numbers that can be
represented
· e.g. 4-bits can represent 24=16 different numbers
Binary Numbering Schemes
· Different number schemes are possible
· The one we have been using so far is called “unsigned
binary” or “pure binary”
· Later on we’ll see some different schemes where some of
the available bit patterns are used for negative numbers
The Pure Binary Numbering Scheme
· Unsigned binary/Pure binary:
· (1111)2 is interpreted as 1×8 + 1×4 + 1×2 + 1×1 = (15)10
· (0001)2 is interpreted as 0×8 + 0×4 + 0×2 + 1×1 = (1)10
· 4-bits can represent all numbers from 0 to 15
· What happens when we run out of bits?
· What is result of 15+1 in a 4-bit adder?
Number Pure binary representation Number Pure binary representation
0 0000 8 1000
1 0001 9 1001
2 0010 10 1010
3 0011 11 1011
4 0100 12 1100
5 0101 13 1101
6 0110 14 1110
7 0111 15 1111
Adder Overflow
· What is result of 15+1 in a 4-bit adder?
0001 A
+1111 B
0000 Q
1 1 1 1 CIN/COUT
B 3 A3 B 2 A2 B 1 A1 B 0 A0
1 0 1 0 1 0 1 1 CIN=0
B A CIN B A CIN B A CIN B A CIN
Full Adder Full Adder Full Adder Full Adder
1 1 1
COUT SUM COUT SUM COUT SUM COUT SUM
1 0 0 0 0
Q3 Q2 Q1 Q0
Adder Overflow
· What is result of 15+1 in a 4-bit adder?
· 15+1 = 0
· The adder has overflowed
· Answer can’t be represented in 4-bits
· How do we detect this? Look at final COUT
B 3 A3 B 2 A2 B 1 A1 B 0 A0
1 0 1 0 1 0 1 1 CIN=0
B A CIN B A CIN B A CIN B A CIN
Full Adder Full Adder Full Adder Full Adder
COUT SUM COUT SUM COUT SUM COUT SUM
1 0 0 0 0
Q3 Q2 Q1 Q0
Adder Overflow
· What is result of 15+1 in a 4-bit adder?
· 15+1 = 0
· The adder has overflowed.
· Answer can’t be represented in 4-bits
· How do we detect this? Look at final COUT
B 3 A3 B 2 A2 B 1 A1 B 0 A0
CIN=0
0verflow status flag:
B A CIN B A CIN B A C B A CIN
0 means result is OKIN
Full Adder
1 Full
meansAdder
resultFull
isAdder
wrong Full Adder
COUT SUM COUT SUM COUT SUM COUT SUM
1
Q3 Q2 Q1 Q0
Summary
· Most useful systems require arithmetic
· Fundamental circuit is adder
· Adder is repeated copies of 1-bit full-adder
· Fixed size of circuit means that overflow can occur:
 Answer is too big to represent in available bits

· Adder circuits can output a status bit that shows whether


the answer is reliable or not

You might also like