COA (1)

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 55

21CSS201T C - COMPUTER ORGANIZATION AND ARCHITECTURE

UNIT-1 Number System


The technique to represent and work with numbers is called number system.
● Binary
● Decimal
● Octal
● Hexadecimal
Decimal Number System
● Decimal number system is a base 10 number system having 10 digits from 0 to 9.
● This means that any numerical quantity can be represented using these 10 digits.
● Decimal number system is also a positional value system.
Binary Number System

The easiest way to vary instructions through electric signals is two-state system – on and
off.

On is represented as 1 and off as 0, though 0 is not actually no signal but signal at a lower
voltage.

The number system having just these two digits – 0 and 1 – is called binary number
system.

Each binary digit is also called a bit. Binary number system is also positional value
system, where each digit has a value expressed in powers of 2, as displayed here
In any binary number, the rightmost digit is called least significant bit (LSB) and leftmost digit is
called most significant bit (MSB).

Decimal Equivalent of : 110011


Memory
Computer memory is measured in terms of how many bits it can store. Here is a chart for memory
capacity conversion.

1 byte (B) = 8 bits


1 Kilobytes (KB) = 1024 bytes
1 Megabyte (MB) = 1024 KB
1 Gigabyte (GB) = 1024 MB
1 Terabyte (TB) = 1024 GB
1 Exabyte (EB) = 1024 PB
1 Zettabyte = 1024 EB
1 Yottabyte (YB) = 1024 ZB
Octal Number System
Octal number system has eight digits – 0, 1, 2, 3, 4, 5, 6 and 7. Octal number system is also a positional
value system with where each digit has its value expressed in powers of 8, as shown here −

Decimal Equivalent of : 6458 ->


Hexadecimal Number System
Octal number system has 16 symbols – 0 to 9 and A to F where A is equal to 10,
B is equal to 11 and so on till F. Hexadecimal number system is also a positional
value system with where each digit has its value expressed in powers of 16, as
shown here −

35AB16 equivalent to: ?


ASCII
Besides numerical data, computer must be able to handle alphabets, punctuation marks, mathematical
operators, special symbols, etc. that form the complete character set of English language.

The most widely used alphanumeric code is American Standard Code for Information Interchange
(ASCII).

ASCII is a 7-bit code that has 128 (27) possible codes.

Unicode
Conversion
Decimal to Binary
Decimal numbers can be converted to binary by repeated division of the number by 2
while recording the remainder. Let’s take an example to see how this happens.
Decimal to Octal

Decimal numbers can be converted to octal by repeated division of the number by 8 while recording the

remainder. 47310 = 7318


Decimal to Hexadecimal

Decimal numbers can be converted to octal by repeated division of the


number by 16 while recording the remainder.

42310 = 1A716
Binary to Octal and Vice Versa

To convert a binary number to octal number, these steps are followed −

Starting from the least significant bit, make groups of three bits.
If there are one or two bits less in making the groups, 0s can be added after the most significant bit
Convert each group into its equivalent octal number
Binary to Hexadecimal

To convert a binary number to hexadecimal number, these steps are followed −

Starting from the least significant bit, make groups of four bits.
If there are one or two bits less in making the groups, 0s can be added after the most
significant bit.
Convert each group into its equivalent octal number.
CODES
The reflected binary code or Gray code is an ordering of the binary numeral system such that two successive
values differ in only one bit (binary digit).

Gray code is not weighted that means it does not depends on positional value of digit.

Gray code also known as reflected binary code, because the first (n/2) values compare with those of the last (n/2)
values, but in reverse order.

Constructing an n-bit Gray code

n-bit Gray code can be generated recursively using reflect and prefix method which is explained as following below.

Generate code for n=1: 0 and 1 code.


Take previous code in sequence: 0 and 1.
Add reversed codes in the following list: 0, 1, 1 and 0.
Now add prefix 0 for original previous code and prefix 1 for new generated code: 00, 01, 11, and 10.

Therefore, Gray code 0 and 1 are for Binary number 0 and 1 respectively. Gray codes: 00. 01, 11, and 10 are for
Binary numbers: 00, 01, 10, and 11 respectively.
Binary Coded Decimal (BCD) code
● In this code each decimal digit is represented by a 4-bit binary number.
● BCD is a way to express each of the decimal digits with a binary code.
● In the BCD, with four bits we can represent sixteen numbers (0000 to 1111).
● But in BCD code only first ten of these are used (0000 to 1001).
● The remaining six code combinations i.e. 1010 to 1111 are invalid in BCD.
Advantages of BCD Codes
It is very similar to decimal system.
We need to remember binary equivalent of decimal numbers 0 to 9 only.

Disadvantages of BCD Codes


The addition and subtraction of BCD have different rules.
The BCD arithmetic is little more complicated.
BCD needs more number of bits than binary to represent the decimal number. So BCD is less
efficient than binary.
Convert (123)10 in BCD
From the truth table above,
1 -> 0001
2 -> 0010
3 -> 0011
thus, BCD becomes -> 0001 0010 0011
Excess-3 code

● The Excess-3 code is also called as XS-3 code.


● It is non-weighted code used to express decimal numbers.
● The Excess-3 code words are derived from the 8421 BCD code words adding (0011)2
or (3)10 to each code word in 8421. The excess-3 codes are obtained as follows:
ASCII Code

● The ASCII stands for American Standard Code for Information Interchange.
● The ASCII code is an alphanumeric code used for data communication in digital
computers.
● The ASCII is a 7-bit code capable of representing 2 7 or 128 number of different
characters.
● The ASCII code is made up of a three-bit group, which is followed by a four-bit code.
ASCII Code
• American Standard Code for Information
Interchange
• ASCII is a 7-bit code, frequently used with an 8 th bit
for error detection (more about that in a bit).
Character ASCII (bin) ASCII (hex) Decimal Octal
A 1000001 41 65 101
B 1000010 42 66 102
C 1000011 43 67 103

Z
a

1

Digit Binary Gray Code
Gray Code
• 0 0000 0000
Gray code is not a number system.
• It is an alternate way to represent four 1 0001 0001
bit data 2 0010 0011
• Only one bit changes from one decimal digit to the next 3 0011 0010
• Useful for reducing errors in communication.
4 0100 0110
• Can be scaled to larger numbers.
5 0101 0111
Binary Gray
4 bit binary number can be written as B3, B2, B1, B0 6 0110 0101
4 bit gray number can be written as G3, G2, G1, G0 7 0111 0100
G3=B3 8 1000 1100
G2=B3+B2 9 1001 1101
G1=B2+B1
10 1010 1111
G0=B1+B0
11 1011 1110
Gray Binary
B3=G3 12 1100 1010
B2=G3+G2 13 1101 1011
B1=B2+G1 14 1110 1001
B0=B1+G0 15 1111 1000
Binary Addition

0 0 0

0 0 1

1 0 1

1 1 0 with carry 1
1 1 1 1 with carry 1

• If a computer is accomplished in handling 5-bit


numbers like -1101 where the minus is a sign bit
and remaining digits are magnitude bits then this 5-
bit number can be represented like 11101. Here in
this digit, the first digit ‘1’ specifies the negative sign
as well as remaining 4 digits are the magnitude of
the numbers.
Binary subtraction
• A parity bit is a check bit, which is added to a block of data for error detection
purposes. It is used to validate the integrity of the data. The value of the parity bit
is assigned either 0 or 1 that makes the number of 1s in the message block either
even or odd depending upon the type of parity. Parity check is suitable for single
bit error detection only.
• The two types of parity checking are
• Even Parity − Here the total number of bits in the message is made even.
• Odd Parity − Here the total number of bits in the message is made odd.
Error Detection by Adding Parity Bit
• Sender’s End − While creating a frame, the sender counts the number of 1s in it and adds
the parity bit in following way

• In case of even parity − If number of 1s is even, parity bit value is 0. If number of 1s is odd,
parity bit value is 1.

• In case of odd parity − If number of 1s is odd, parity bit value is 0. If number of 1s is even,
parity bit value is 1.
• Receiver’s End − On receiving a frame, the receiver counts the number of 1s in it. In case of
even parity check, if the count of 1s is even, the frame is accepted, otherwise it is rejected. In
case of odd parity check, if the count of 1s is odd, the frame is accepted, otherwise it is rejected.
Example
• Suppose that a sender wants to send the data 1001101 using even parity check method. It will
add the parity bit as shown below.
• The receiver will decide whether error has occurred by counting whether the total number of 1s is
even. When the above frame is received, three cases may occur namely, no error, single bit error
detection and failure to detect multiple bits error. This is illustrated as follows
• Even Parity Check: Total number of 1’s in the given data bit should be even. So if the total number of
1’s in the data bit is odd then a single 1 will be appended to make total number of 1’s even else 0 will
be appended(if total number of 1’s are already even). Hence, if any error occurs, the parity check
circuit will detect it at the receiver’s end
Mess
• Odd Parity Check: In odd parity system, if the total age P(Odd) P(Even)
(XYZ)
number of 1’s in the given binary string (or data bits) are
000 1 0
even then 1 is appended to make the total count of 1’s as
odd else 0 is appended. 001 0 1

• The receiver knows that whether sender is an odd parity 010 0 1


generator or even parity generator. Suppose if sender is 011 1 0
an odd parity generator then there must be an odd
100 0 1
number of 1’s in received binary string.
101 1 0
• If an error occurs to a single bit that is either bit is
110 1 0
changed to 1 to 0 or 0 to 1, received binary bit will have
an even number of 1’s which will indicate an error. 111 0 1
Binary multiplication
Binary multiplication
Example

1 1 0 1 11 1
Example
Binary Division
Binary Division
Binary Division
BCD Addition

Input :
A = 0111 B = 1000
Output :
Y = 1 0101

Explanation: We are adding A(=7) and B(=8).


The value of binary sum will be 1111(=15).
But, the BCD sum will be 1 0101,
where 1 is 0001 in binary and 5 is 0101 in binary. Input :
A = 0101 B = 1001
Output :
Y = 1 0100

Explanation: We are adding A(=5) and B(=9).


The value of binary sum will be 1110(=14).
But, the BCD sum will be 1 0100,
where 1 is 0001 in binary and 4 is 0100 in binary.
Logic gates
● Building block of digital circuits.
● Make decisions based on a combination of digital signals coming from its
inputs.
● Logic gates are based on Boolean algebra.
● False represents 0, and true represents 1.
● Seven basic logic gates: AND, OR, XOR, NOT, NAND, NOR, and XNOR.
NOT gate

● Also called as the inverter gate.


● Has only one input.
● It just inverts the input.

Input 1 Result
1 0
0 1
AND gate

● If both the inputs are true, the result is true else the result is false.

Input 1 Input 2 Result


1 1 1
1 0 0
0 1 0
0 0 0
NAND gate

● AND gate followed by an inverter.


● The output is false if both inputs are true.

Input 1 Input 2 Result


1 1 0
1 0 1
0 1 1
0 0 1
OR gate

● If any one of the input is true, the result is true else the result is false.

Input 1 Input 2 Result


1 1 1
1 0 1
0 1 1
0 0 0
NOR gate

● NOR gate followed by an inverter.


● The output is true if both inputs are false.

Input 1 Input 2 Result


1 1 0
1 0 0
0 1 0
0 0 1
XOR gate (eXclusive OR)

● If either one of the input is true, the result is true else the result is false.
● If both the inputs are same, the result is false.

Input 1 Input 2 Result


1 1 0
1 0 1
0 1 1
0 0 0
eXclusive NOR (XNOR) gate

● XOR gate followed by an inverter.


● The output is true if both inputs are same.

Input 1 Input 2 Result


1 1 1
1 0 0
0 1 0
0 0 1

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy