0% found this document useful (0 votes)
28 views52 pages

Unit 11

Uploaded by

adandekar
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)
28 views52 pages

Unit 11

Uploaded by

adandekar
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/ 52

St.

Vincent Pallotti College of


Engineering &

Technology
Digital Circuits & Computer
Architecture
 By
Mr. Aashish R. Dandekar
CSE(Data Science)
Session-2023-24
Unit I [8Hrs]

 Number system and codes: Binary, octal, hexadecimal and decimal


Number systems and their inter conversion, BCD numbers.

 (8421-2421),gray code, excess–3 code, cyclic code, code conversion,


ASCII, EBCDIC codes. 1's and 2's complement
CODING
FUNDAMENTALS

• Computers (processor chips) are digital in


nature and don't understand "words" as
humans know them.
• Instructions for what a chip has to do are
built in binary number systems.
CODING
FUNDAMENTALS
• Binary gives two logical choices: 1 and 0

• It can represent on and off, true and false


• Within computer information is stored in
the binary form i.e. with the help of 0 and 1
CODING
FUNDAMENTALS

• A single binary digit is called a 'bit'.

• The number of bits in the data


sequences processed by a given
computer is called its word size
WHAT IS CODING

• Coding a process of
is representing or non-
instructions
numeric in binary. dataand
numeric
• By coding each digit, character or
symbol is represented with group of
bits know as byte.
• e.g. 9 is represented as 1001.
CODE
SCHEME
• A binary coding scheme is a method
used for representing all of the digits,
letters, special characters, and control
characters available to a digital
computer using groups of 0s and 1s.
• The two coding schemes in widest
use are American Standard Code for
Interchange Information
(ASCII) and Extended
Coded Decimal Interchange Code Binary
CODE
SCHEME
• Here are some examples of how the
characters A, 7, and $ would be represented in
ASCII and EBCIDIC:
ASCII EBCIDIC
A 01000001 11000001
7 00110111 11110111
$ 00100100 01011011
CODE
SCHEME
• Method of coding digits, characters and
symbols into binary digits is called Code
Scheme e.g. BCD, ASCII, EBCDIC etc.
• Most commonly used code is BCD (Binary
Coded Decimal)
DIFFERENCE BETWEEN
CODING & CONVERSION

• In coding each digit of given number is


converted to binary equivalent rather than
converting entire decimal number
• E.g. 15 converted to binary is 1111
15 coded to binary is 0001 0101
( 1) ( 5 )
• Coding of number is faster than
conversion
• However coding requires more bits as
compared to conversion
DIFFERENCE BETWEEN
CODING & CONVERSION

• Coding of number is faster than


conversion
• Conversion requires an algorithm
involving successive division
• Where as; encoding is by straight-
forward table look up
• BCD representation is more suitable
in the simple devices like calculators,
BINARY
CODED
DECIMAL
• BCD uses 6 bits to represent a symbol
• It can represent 64 ( 26 ) different
characters with
• BCD (Binary Coded Decimal) is
simply the 4-bit binary code
representation of a decimal digit.
• Left most 2 bits are Zone Positions and
other 4 are numeric position
BINARY CODED DECIMAL

CHAR BCD CODE OCTAL


ZONE DIGIT Equivalent

A 11 0001 61
B 11 0010 62
Z 01 1001 31
1 00 0001 01
2 00 0010 02
9 00 1001 11
BCD (continued)

• BCD – 8421 representation of digits


0 to 9 are
0 0000 5 0101
1 0001 6 0110
2 0010 7 0111
3 0011 8 1000
4 0100 9 1001
BCD CODING SCHEME
(Example 1)
• Show the Binary digits used to record the word
BASE in BCD
B = 11 0010 in BCD Binary Notation A = 11
0001 in BCD Binary Notation S = 01 0010 in
BCD Binary Notation E = 11 0101 in BCD
Binary Notation
BCD CODING SCHEME
(Example 1) Contd..
• So the Binary Digits

11 0010 11 0001 01 0010 11 0101


B A S E
will record the word BASE in BCD
TYPES OF CODES

• Codes can be broadly classified as:


– Weighted Codes
– Alphanumeric Codes
– Self Complementing Codes
– Cyclic, Reflected or Gray Codes
– Error Detecting & Correcting Codes
WEIGHTED CODES

• Inweighted code, weightsare assigned


to the Bits according to their position.
• The decimalvalue of code is the
algebraic
sum of weights of those columns in which
a 1 appears.

N= W(i) b(i)
Where: N is the Decimal Number
W(i) are weights assigned to
Bits
b(i) are Bits, either 0 or 1
EXAMPLES OF
WEIGHTED CODES
• 8421 is a weighted code where
weights are 8,4,2,1
• Decimal number represented by 1001
is
8x1 + 4x0 + 2x0 + 1x1 = 9

• 8421 is also called Natural Binary coded


Decimal system because weights used in
8421 are natural weights used in binary
number representation
EXAMPLES OF
WEIGHTED CODES
Decimal Weights Weights
Digit 8 4 2 1 2 4 2 1
0 0 0 0 0 0 0 0 0
1 0 0 0 1 0 0 0 1
5 0 1 0 1 1 0 1 1
8 1 0 0 0 1 1 1 0
9 1 0 0 1 1 1 1 1
MORE EXAMPLES….

__
• 8 4 2 1 where weights are 8, 4, -2, -1.
This indicates that weights can be
negative also

• Decimal equivalent of 1001 will be


8x1 + 4x0 - 2x0 - 1x1 = 8 + 0 – 0 - 1 = 7
MORE EXAMPLES….

• Other examples can be 2421 and 5211


etc.

1001 in 2421 will be 2x1+4x0+2x0+1x1


=3

1001 in 5211 will be 5x1+2x0+1x0+1x1


=6
ALPHANUMERIC CODES

• Codes used to store alpha numeric data


are called alphanumeric codes
• Characters coded with these codes can be
– Letters A-Z or a-z
– Digits 0-9
– Special characers +,-,*,/,$ etc.
• e.g ASCII , EBCDIC
.
Alphanumeric Codes
• Apart from numeric data, a computer system may process
some alphanumeric data just like the employees’ names,
address as well as some special characters. An Alphanumeric
data generally consist of sequence of characters where a
character is any one of the following:-
• Letters or alphabets
• Digits 0-9
• Special characters(+,-,π)
• In the computer system, each character is stored in some
code form depending upon the coding scheme. The
character may take 6, 7, or 8 bits. There are number of codes
which are used for some specific application i.e. ASCII Code,
EBCDIC Code, UNIT Code, etc.
VARIOUS DECIMAL CODES
Importance of Codes

1. The code refers to encryption system.


2.Computer and other digital circuits process data in
binary format.

3. Various binary codes are used to represent data.

4.The interpretation of data is only possible if the code in


which the information is available is known.
ASCII CODES

• The name stands for “American


Standard Code for
Information Interchange”.
• These are available as ASCII7 Bit
and ASCII 8 bit codes
• ASCII 7
– 7 bits are used to code each character
– 128 character codes are available
• 52 for alphabets
• 10 for digits
• 66 for special characters
The 2421 code
 The 2421 code, also known as the Aiken code, is a weighted,
self-complementing binary-coded decimal (BCD) code that
represents decimal numbers 0 to 9 using four bits.

 The code assigns the weights 2, 4, 2, and 1 to the four bits from
left to right, so the total weight is 9.

 For example, the 2421 code for the decimal number 5137 is
1011 0001 0011 1101
ASCII CODES
• ASCII 8
– 8 bits are used to code each character
– First 128 characters are same as in 7 bits standard
– 256 character codes are available for printable and non-
printable characters

• In ASCII codes, each character has unique value assigned to


it and code has binary equivalent of that value.
E.g. A ≡ 65 ≡ 1000001
a ≡ 97 ≡
1100001
0 ≡ 48 ≡ 0110000
ASCII

CHAR ASCII CODE Hexadecimal


ZONE DIGIT Equivalent

A 0100 0001 41
B 0100 0010 42
Z 0101 1010 5A
1 0011 0001 31
2 0011 0010 32
9 0011 1001 39
Extended ASCII

• There are an additional 128 characters that were


adopted by IBM for use in their PCs. It’s popular and
is used in applications other than PCs  unofficia
standard.
– The extended ASCII characters are represented by an 8-bi
code series from 80h-FFh
EBCDIC CODES

• Name stands for “Extended Binary-Coded


Decimal Interchange Code”

• It is a 8 bit code in which unique 8 bits are


assigned to each character to be stored

• Example
code for A is 1100 0001
code for a is 1000 0001
code for 0 is 1111 0000
EBCDIC

CHAR EBCDIC CODE Hexadecimal


ZONE DIGIT Equivalent

A 1100 0001 C1
B 1100 0010 C2
Z 1110 1001 E9
1 1111 0001 F1
2 1111 0010 F2
9 1111 1001 F9
Extend
ed
ASCII
Excess-3 (XS-3)
Code
• A self-complimenting code need
not necessarily be weighted. E.g Excess-3
• In this code, 3 is added to individual
digit before converting it to BCD.
• Excess-3 code for 42 is:
4 2
3 3
(+)
7 5
011 0101
Cyclic Code

• Cyclic Code are those in which codes


of two consecutive numbers differ only
at 1 bit position.
• Hamming Distance is number of bits
change from 0 to 1 or from 1 to 0
between two equal length binary
sequence.
0001 1110
0010 1111
(2 bit (1 bit
changed) changed)
Cyclic Code

• Code is known as Cyclic Code if the


Hamming Distance between two
successive code groups is 1.

• Gray Code is example of cyclic code


Binary to Gray
Conversion
• Write First Binary bit as gray bit
• Add consecutive binary bits to get gray bits,
neglect carry if any.

+ + + + + +

B3 B2 B1 1 0 0 1
B0

G3 G2 G1 1 1 0 1
G0
Gray to Binary Conversion

• Write First Gray bit as binary bit


• Add consecutive binary and Gray bits to get
binary bits, neglect carry if any.

+ + + + + +

G3 G2 G1 1 1 0 1
G0

B3 B2 B1 1 0 0 1
B0
Error Detecting &
Correcting Codes
• Binary data is transferred from one
point to another through wires or
through radio waves
• During transfer some of the bit
may change due to noise signal
(Any unwanted Signal).
• This change in bit during transfer is
called Error
Error Detecting & Correcting
Codes
• Error detecting and correcting codes are used
to detect and correct these errors
• Parity bits are used in these error
detecting and correcting codes
• The code ensures that the HAMMING
DISTANCE between any two codes in the set of
codes is a preassigned minimum
Error Detecting
Codes
• In these codes parity bits are added
horizontally as well as vertically along with
block of data, at the sending end

• These bits are transmitted along with data

• If single error occurs during transmission there


will be simultaneous parity failure horizontally
as well as vertically. This will fix the error
position
Limitations of Error Detecting
Codes

• There are following Limitations


– In error detecting codes by adding a
single parity bit one can detect a
single error in the code
– position of error is not detected so
error cannot be corrected
Limitations of Error Detecting
Codes
• There are following Limitations
– Only odd errors can be detected. In case of even
error there will be no parity failure and errors
cannot be detected
NEED FOR NEW
ENCODING SYSTEM
• Limitations of ASCII and EBCDIC
– No single encoding system supports all languages
– Different encoding systems conflicts

• The issues are resolved in the UNICODE


encoding system
FEATURES OF
UNICODE
 Provides a consistent way of encoding the multilingual plaint
text
 Define codes for characters used in all major languages of
the world
 Define codes for special characters, mathematical, technical,
currency symbols as well as diacritics
FEATURES OF
UNICODE (cont…)
• Capacity to encode million of characters
• Consistent with ASCII Codes

• ENCODING FORMATS:
• Unicode Transformation Format – 8
• UTF – 16
• UTF – 32
UNICODE @ INDIA

• It is because of UNICODE that Indian Languages


are showing their presence on Internet
• The latest is the addition of Indian
Currency Symbol in UNICODE
UNICODE

• The Indian rupee sign is the currency sign


used for the Indian rupee, the official currency of
India.
• The design was presented to the public by the
government of India on 15 July 2010.
UNICODE

• On 10 August 2010 the Unicode Consortium UTC


accepted the proposed code position U+20B9 for
Indian rupee sign.
• Symbol was created by D Udaya Kumar
POSSIBLE LOCATION
ON KEYBOARD

You might also like