Digital Logic Design
Digital Logic Design
BINARY CODES
• In the coding, when numbers, letters or words are represented by a specific
group of symbols, it is said that the number, letter or word is being encoded.
• The group of symbols is called as a code.
• The digital data is represented, stored and transmitted as group of binary bits.
• This group is also called as binary code.
• The binary code is represented by the number as well as alphanumeric letter
• Binary codes are suitable for the computer applications.
• Binary codes are suitable for the digital communications.
• Binary codes make the analysis and designing of digital circuits if we use the
binary codes.
• Since only 0 & 1 are being used, implementation becomes easy.
• .
3
BINARY CODES
• The codes are broadly categorized into following four categories.
• Weighted Codes
• Non-Weighted Codes
• Binary Coded Decimal Code
• Alphanumeric Codes
• Error Detecting Codes
• Error Correcting Codes
4
BINARY CODES
• Digital systems use signals that have two distinct values and circuit elements
that have two stable states.
• There is a direct analogy among binary signals, binary circuit elements, and
binary digits.
• A binary number of n digits, for example, may be represented by n binary
circuit elements, each having an output signal equivalent to 0 or 1.
• Digital systems represent and manipulate not only binary numbers, but also
many other discrete elements of information.
• Any discrete element of information that is distinct among a group of quantities
can be represented with a binary code (i.e., a pattern of 0’s and 1’s).
• The codes must be in binary because, in today’s technology, only circuits that
represent and manipulate patterns of 0’s and 1’s can be manufactured
economically for use in computers.
5
BINARY CODES
• However, it must be realized that binary codes merely change the symbols,
not the meaning of the elements of information that they represent.
• If we inspect the bits of a computer at random, we will find that most of the
time they represent some type of coded information rather than binary
numbers.
• An n‐bit binary code is a group of n bits that assumes up to 2n distinct
combinations of 1’s and 0’s, with each combination representing one element
of the set that is being coded.
• A set of four elements can be coded with two bits, with each element assigned
one of the following bit combinations: 00, 01, 10, 11.
• A set of eight elements requires a three‐bit code and a set of 16 elements
requires a four‐bit code.
6
BINARY CODES
• The bit combination of an n‐bit code is determined from the count in binary
from 0 to 2n - 1.
• Each element must be assigned a unique binary bit combination, and no two
elements can have the same value; otherwise, the code assignment will be
ambiguous.
• Although the minimum number of bits required to code 2n distinct quantities is
n, there is no maximum number of bits that may be used for a binary code.
• For example, the 10 decimal digits can be coded with 10 bits, and each
decimal digit can be assigned a bit combination of nine 0’s and a 1.
• In this particular binary code, the digit 6 is assigned the bit combination
0001000000.
7
1 7
19
1 7
20
Decimal Arithmetic
• The representation of signed decimal numbers in BCD is similar to the
representation of signed numbers in binary.
• We can use either the familiar signed‐magnitude system or the
signed‐complement system.
• The sign of a decimal number is usually represented with four bits to conform
to the four‐bit code of the decimal digits.
• It is customary to designate a plus with four 0’s and a minus with the BCD
equivalent of 9, which is 1001.
• The signed‐magnitude system is seldom used in computers.
• The signed‐complement system can be either the 9’s or the 10’s complement,
but the 10’s complement is the one most often used.
• To obtain the 10’s complement of a BCD number, we first take the 9’s
complement and then add 1 to the least significant digit.
21
Decimal Arithmetic
• The 9’s complement is calculated from the subtraction of each digit from 9.
• The procedures developed for the signed‐2’s‐complement system in the
previous section also apply to the signed‐10’s‐complement system for decimal
numbers.
• Addition is done by summing all digits, including the sign digit, and discarding
the end carry.
• This operation assumes that all negative numbers are in 10’s‐complement
form.
• Consider the addition (+375) + (-240) = +135, done in the signed‐complement
system:
•
22
Decimal Arithmetic
• The 9 in the leftmost position of the second number represents a minus, and
9760 is the 10’s complement of 0240.
• The two numbers are added and the end carry is discarded to obtain +135.
• Of course, the decimal numbers inside the computer, including the sign digits,
must be in BCD.
• The addition is done with BCD digits as described previously.
• The subtraction of decimal numbers, either unsigned or in the
signed‐10’s‐complement system, is the same as in the binary case:
• Take the 10’s complement of the subtrahend and add it to the minuend.
• Many computers have special hardware to perform arithmetic calculations
directly with decimal numbers in BCD.
23