Chapter 6.1
Chapter 6.1
1
Binary Arithmetic
1) Binary Addition (+)
2) Binary Subtraction (-)
3) Binary Multiplication (x)
4) Binary Division (/)
1) Binary Addition (+)
The four basic rules for adding binary digits (bits) are as follows
0+0= 0
0+1= 1
1+0= 1
1 + 1 = 10 (with a carry of 1)
2
2) Binary Subtraction (-)
• The four basic rules for subtracting binary digits (bits) are as
follows :
0-0=0
1-1=0
1-0=1
10 - 1 = 1 -> 0-1 with a borrow of 1
• Example :
3
3) Binary Multiplication (x)
• The four basic rules for multiplying binary digits (bits) are as follows
:
0x0=0
0x1=0
1x0=0
1x1=1
• Example :
4
4) Binary Division (/)
• Division in binary = Division in decimal
• Example :
a) 110 / 11
Signed Number
• Signed binary number consist of sign and magnitude information.
• Sign Bit = left most bit in signed binary number.
= indicate number is positive (0) or negative (1).
• a) Sign-Magnitude form
• For example :
• +25 (8-bit signed number) = 00011001
• -25 (8-bit signed number) = 10011001
a) Addition
7
Negative number with magnitude larger than positive number
0001 0000 16
+ 1110 1000 + -24
1111 1000 - 8
Discard carry
Subtraction
The sign of a positive or negative binary number is changed by taking its 2’s
complement.
Example :
8-3 = 8+(-3) = 5
0000 1000 (+8)
+ 1111 1101 (2’s complement of -3)
1 0000 0101 (Difference (+5)
8
Multiplication
The numbers in multiplication are the multiplicand and
multiplier
Example : 8 (Multiplicand)
X 3 (Multiplier)
24 (Product)
Two basic methods for multiplication
A) Direct Addition.
Add the multiplicand a number of times equal to the
multiplier
B) Partial Product (If multiplier is a large number)
The multiplicand is multiplied by each multiplier digit
beginning with the least significant digit.
If the signs are the same, the product is positive
9
Basic Adder
S
A S Sum
Half adder
Input bits Output bits Logic
B Cout
Carry
Symbol
Cout = AB
Output carry is 1 only when A and B are 1s.
S =A + B
A B Cout S
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
13
B. FULL ADDER
The full adder adds 3 one bit numbers, where two can be referred to as
operands and one can be referred to as bit carried in.
It produces 2-bit output and these can be referred to as output carry and
sum.
The full-adder has three inputs and two outputs.
The first two inputs are A and B and the third input is an input carry as C-
IN.
When a full-adder logic is designed, you string eight of them together to
create a byte-wide adder and cascade the carry bit from one adder to the
next.
A full adder is a digital circuit that performs addition.
Full adders are implemented with logic gates in hardware.
A full adder adds three one-bit binary numbers, two operands and a carry
bit. The adder outputs two numbers, a sum and a carry bit.
14
The Boolean expression for a full adder is as follows.
For the CARRY-OUT (Cout) bit: CARRY-OUT = A AND B ORCin(A
XOR B) = A.B + Cin(A ⊕ B)
Accepts two input bits and an input carry and generates a sum
output and an output carry.
S
A S Sum
Full adder
B Logic
Cout Output Carry
Input Carry Cin Symbol
. A B Cin Cout
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0 Full adder
1 0 0 0 1 Truth Table
1 0 1 1 0
1 1 0 1 0
15
1 1 1 1 1
Comparators
Compares two n-bit binary values to determine which
one is larger.
Inputs : 2 single-bit inputs (X and Y).
Outputs : 3 lines: X>Y, X=Y, X<Y.
16
Basic comparator operation. Equality
17
Example
18
Decoders
A decoder is a combinational circuit that converts binary information
from n input lines to a maximum of 2n unique output lines.
Function – detect the presence of a specified combination of bits
(code) on its inputs and to indicate the presence of that code by a
specified output level.
Decoder has n input lines to handle n bits and from one to 2n output
lines to indicate the presence of one or more n-bit combinations.
Output is 1 if its label matches input
19
Encoders
• Encoder does the opposite from decoder
• Encoder accepts an active level on one of its inputs representing a
digit, such as a decimal or octal digit and converts it to a coded output,
such as BCD or binary.
• An encoder is a device, circuit, software program, algorithm or person
that converts information from one format or code to another.
• The purpose of encoder is standardization, speed, secrecy, security, or
saving space by shrinking size. If a device output code has fewer bits
than the input code has, the device is usually called an encoder.
• Encoder can also be devised to encode various symbols and alphabetic
characters.
Decimal-to-BCD encoder
20
Multiplexer
Multiplexer means many to one.
MUX is a combinational circuit which is often used when the
information from many sources must be transmitted over long
distances and it is less expensive to multiplex data onto a single wire
for transmission.
Multiplexer can be considered as multi-position or rotary switch as
n – inputs and one output.
The switch position is controlled by the selector lines. The select
inputs decide which input is connected to the output.
A list of popular applications is given below.
1. Data routing 2. Data bussing
3. Switch setting comparator 4. Multiplexer as a function generator
5. Parallel to serial converter 6. Cable TV signal distribution
7. Telephone network 8. Sharing printer /resources
21
Demultiplexer
Demultiplexer has a single input and n output lines.
Demultiplexer can be visualized as reverse multi-position
switch.
The select lines permit input data from single line to be
switched to any one of the many output lines.
Applications of Demultiplexers
1.Data demultiplexing 2.Clock demultiplexing
3.Memory addressing 4.Four phase clock generator
5.Function generation using DMUX 6.Switch encoding
7.Serial to parallel converter
22
Multiplexers is called Data Selectors
A demultiplexer is also called a data distributor.
23
24