CH 1
CH 1
CH 1
DESIN
CHAPTER-ONE
BINARY SYSTEM
1
1. Introduction
In today’s world, the term digital has become part of our everyday vocabulary because of the
dramatic way that digital circuit and digital techniques have become so widely used in almost
area of life. Digital Logic is the basis of electronic systems, such as computers and cell phones.
Digital Logic is rooted in binary code, a series of zeroes and ones each having an opposite value.
This system facilitates the design of electronic circuits that convey information, including logic
gates. Digital Logic gate functions include and, or and not. The value system translates input
signals into specific output. Digital Logic facilitates computing, robotics and other electronic
applications.
Digital Logic Design is foundational to the fields of electrical engineering and computer
engineering. Digital Logic designers build complex electronic components that use both
electrical and computational characteristics. These characteristics may involve power, current,
logical function, protocol and user input.
2
1.1.1 Types of Digital Systems:
No state present
• Output = Function(Input)
State present
On the other hand, we have digital system (also called non continuous) which is preferable to
process and communicate effectively than analog. This leads us to design systems that fit the
following block diagram architecture. Also digital system is combination of device designed to
manipulate logical information or physical quantities that are represented by digital form; that is
the quantities can take on only discrete value.
Process
Real world ADC DAC real world
Store
Signal Signal
Communicate
3
Example: Consider a faucet
Digital
Analog
2. Numbering system
A number system is a set of a digital use for mathematical operation such as: counting, adding,
subtracting, dividing and multiplying. The numeric system we use daily is the decimal system,
but this system is not convenient for machines since the information is handled codified in the
shape of on or off bits; this way of codifying takes us to the necessity of knowing the positional
calculation which will allow us to express a number in any base where we need it.
4
A base of a number system or radix defines the range of values that a digit may have.
In the decimal system or base 10, decimal numbers are made of decimal digits those are
ten different values for each digit of a number: "0", "1", "2", "3", "4", "5", "6", "7", "8",
and “9".
In the binary system or base 2, binary numbers are made of binary digits (bits) those can
be only two values for each digit of a number, either a "0" or a "1".
In the octal system or base 8, octal numbers are made of octal digits those can be eight
choices for each digit of a number: "0", "1", "2", "3", "4", "5", "6", and “7".
5
In the hexadecimal system, we allow 16 values for each digit of a number: "0", "1", "2",
"3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", and "F". Where “A” stands for
10, “B” for 11 and so on.
Example: 8A6.55=8x162 + 10x161 + 6x160 + 5x16-1 + 5x16-2
In formal notation -> (8A6.55)16
6
A) .Decimal to Binary
We begin by separating the number into its integer and fractional part. The integer
part is converted using the remainder method, by using a successive division of the
number by the base until a zero is obtained. At each division, the reminder is kept
and then the new number in the base r is obtained by reading the remainder from
the last remainder upwards.
Technique1 for integer part:
Divide the number by the ‘Base’ (=2)
Take the remainder (either 0 or 1) as a coefficient
Take the quotient and repeat the division
Write the result starting from the most to list (like: an an-1…… a3 a2 a1 a0 )
7
B).Binary to Decimal
Technique
• Multiply each bit by 2n, where n is the “weight” or coefficient of the bit
• The weight is the position of the bit, starting from 0 on the right
• Add the results
Example: Convert binary to decimal
C).Decimal to Octal
We begin by separating the number into its integer and fractional part. The integer
part is converted using the remainder method, by using a successive division of the
number by the base until a zero is obtained. At each division, the reminder is kept
and then the new number in the base r is obtained by reading the remainder from
the last remainder upwards.
Technique 1 for integer part:
Divide the number by the ‘Base’ (=8)
Take the remainder as a coefficient
Take the quotient and repeat the division
Write the result starting from the most to list (like: an an-1…… a3 a2 a1 a0 )
8
D).Octal to Decimal
Technique
• Multiply each bit by 8n, where n is the “weight” or coefficient of the bit
• The weight is the position of the bit, starting from 0 on the right
• Add the results
E).Decimal to Hexadecimal
Technique:
9
Example:
F).Hexadecimal to Decimal
Technique
• Multiply each bit by 16 n, where n is the “weight” or coefficient of the bit
• The weight is the position of the bit, starting from 0 on the right
• Add the results
Example:
10
G).Binary to Octal (Hexadecimal)
In order to convert a binary number to octal, we partition the base 2 number into groups
of three starting from the radix point, and pad the outermost groups with 0’s as needed to
form triples. Then, we convert each triple to the octal equivalent
Group the binary digits into three (four) bit groups starting at the radix point and going
both ways, padding with zeros as needed in the fractional part.
Example 2:
11
H).Octal (Hexadecimal) to Binary
• Restate the octal (hexadecimal) as three (four) binary digits starting at the radix point and
going both ways.
Example .1:
Example2
I).Octal to Hexadecimal
Technique:
Convert the given octal number to binary number after that covert the binary to
hexadecimal by grouping in three digits.
12
J).Hexadecimal to Octal
Technique:
Convert the given octal number to binary number after that covert the binary to
hexadecimal by grouping in four digits.
Example:
13
This is best shown in an example of adding two binary numbers …
Binary subtraction
We can also perform subtraction (with borrows in place of carries).
And let as consider:
A B A-B
0 0 0
1 0 1
1 1 0
10 1 1
Binary multiplication
Binary multiplication is much the same as decimal multiplication, except that the
multiplication operations are much simpler…
14
Multiplication of two binary numbers is as following:
There are two types of compliments for each base-r number system. Those are:
In the decimal numbering system, the radix complement is called the ten's complement
and the diminished radix complement the nines' complement.
In binary, the radix complement is called the two's complement and the diminished radix
complement the ones ‘complement.
15
In the octal numbering system, the radix complement is called the eight’s complement
and the diminished radix complement the sevens' complement.
In the hexadecimal numbering system, the radix complement is called the sixteen’s
complement and the diminished radix complement the fifteens' complement.
N=546700 =999999-546700
=453299
r=2
N=1011000
1’s= ( 27 -1)-101100
=1111111-1011000 =0100111
But easily we can get one’s complement by inverting all 0’s to 1’s and vice versa.
7’s= ( 85 -1)-42867
=77777-42867
=34910
16
c).find 15’s complement of E06CB
r=16
N= E06CB
=FFFFF- E06CB
=1F934
N=4568 =10000-4568
=5432
r=2
N=101100
Solution: r’s=rn -N
1’s= 26 -10110
= (6410)-1011000
= 10000002 -101100
=010100
17
But easily we can get 2’s complement from 1’s complement by adding 1.So, first find 1‘s
complement by inverting all 0’s to 1’s and vice versa =010011,after this 2’s complement
become=1’s complement +1
=010011+1
=010100
Example: given numbers M=72532, N=3250, X=1010100 and y=1000011 perform the
subtractions by using r’s complement.
a).M-N
r=10 =96750
=96750+72532
=169282
o The sum produce an end carry so discard it. The result become 69282
b).N-M
r=10 =27468
=27468+03250
18
=30718
So, there is no ends carry; result becomes r’s complement of sum and placing negative sign in
front of it.
=105 -30718
=69282
Answer= -69282
c).x-y
Y=1000011 =27-1000011
r=2 =10000000-1000011
n=7 =0111101
=0111101+1010100
=10010001
o The sum produce an end carry so discard it. The result become 0010001
d).y-x
So, there is no ends carry; result becomes r’s complement of sum and placing negative sign in
front of it.
19
=27 -1101111
=0010001
Answer= -0010001
o The subtraction of two n-digit unsigned number M-N in base r can be alsodone by means
of r-1’s complement as follows:
Add M to the r-1’s complement of N……M+ (rn -1)-N
If M>N, the sum will be produce an end carry, so remove the end carry and then
add the end carry to the sum in order to get the answer of M-N
If M<N, sum doesn’t produce an end carry; the answer becomes the r-1’s
complement of the sum and place negative sign in front of it.
Example: given numbers M=72532, N=3250, X=1010100 and y=1000011 perform the
subtractions by using r-1’s complement.
a).M-N
N=03250 = (105-1)-03250
r=10 =96749
=96749+72532
=169281
o The sum produce an end carry so, discard the end carry and add to the sum. The result
become 69281+1= 69282
b).N-M
N=03250 = (105-1)-72532
r=10 =27467
=27467+03250
=30717
20
So, there is no ends carry; result becomes r’s complement of sum and placing negative sign in
front of it.
=105 -30717
=69282
Answer= -69282
c).x-y
Y=1000011 = (27-1)-1000011
r=2 = (10000000-1)-1000011
n=7 =0111100
=0111100+1010100
=10010000
o The sum produce an end carry so discard it and add to the remain part . The result
become 0010000+1=0010001
d).y-x
r=2 =(10000000-1)-1010100
n=7 =0101011
10’s complement of X+Y
=0101011+1000011
=1101110
So, there is no ends carry; result becomes r’s complement of sum and placing negative sign in
front of it.
= (27-1) -1101110
21
=0010001
Answer= -0010001
In binary number system it is conventional to represent sign with a bit placed in the left
most position (MSP) of the number.
o The convention is to make the sign bit 0 for positive and 1 for negative.
Example: +5=0101
-5=1101
In signed magnitude system, a negative number has the same magnitude bits as the
corresponding positive numbers to the sign bit is 1 for negative rather than 0.
Example: +9=01001
-9=11001
2. Signed Complement System: are used for representing a negative number in either
1’s or 2’s complement, but the 2’s complement is the most common.
Example: assuming the representation of number 9 in binary with 8 bits, we have the following
codes: +9 has signed magnitude representation: 00001001
22
-9 has signed 1’s complement representation: 11110110
4. Binary code
Internally, digital computers operate on binary numbers. When interfacing to humans, digital
processors, e.g. pocket calculators, communication is decimal-based. Input is done in decimal
then converted to binary for internal processing. For output, the result has to be converted
from its internal binary representation to a decimal form. Digital system represents and
manipulates not only binary number but also many other discrete elements of information.
Binary codes are used to translate human symbols to 1’s and 0’s.the most important of the
symbols is the alphabet used for human communications.so every key and character has to
have a uniquely binary code. The minimum number bit requires to uniquely identify all the
keys on the keyboard must be meet the following condition:
There are different types of binary codes such as: BCD code, Gray code and ASCII code
23
Example:
• The position weights of the BCD code are 8, 4, 2, 1. Other codes (shown in Table below)
use position weights of 8, 4, -2, -1 and 2, 4, 2, 1.
• An example of a non-weighted code is the excess-3 code where digit codes are obtained
from their binary equivalent after adding 3. Thus the code of a decimal 0 is 0011, that of
6 is 1001, etc.
• Also there are over 8,000 ways that you can chose 10 elements from the 16 binary
numbers of 4 bits. A few are useful:
24
Used to encode numbers for seven-segment displays.
Easier to read
25
Not a number system.
Only one bit changes from one decimal digit to the next
A-Z 26 codes
0-9 9 codes
26
5. Binary storage, registers and logic
Binary Data Storage
The discrete elements of information in digital computer must have a physical existence
in some information storage medium
When discrete elements of information are represented in binary form, the information
storage must contain binary storage elements for storing individual bits.
Binary cells is advices that passes 2 stable states and is capable of storing 1 bit
information store individual bits of data.
Binary logic
Deals with binary variables and logical operations.
Binary variable are designed by letters such as A, B, C, X, Y, Z, etc. each variable
having only two possible values v1 or 0.
There are also three basic logical operations.
1).AND: represented by dot (.) or the absence of operator.
Truth table of AND gate:
A B F=AB
0 0 0
0 1 0
1 0 0
1 1 1
27
A F=A’
0 1
1 0
10
28