The document discusses number systems and codes used in computer organization and architecture, emphasizing the binary number system as the primary form understood by computers. It explains data representation units such as bits, bytes, and words, and details the conversion processes between different number systems including decimal, binary, octal, and hexadecimal. Additionally, it covers integer representation, signed and unsigned integers, and floating-point number representation, highlighting the importance of normalized forms for unique representation.
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 ratings0% found this document useful (0 votes)
13 views18 pages
Chapter 2
The document discusses number systems and codes used in computer organization and architecture, emphasizing the binary number system as the primary form understood by computers. It explains data representation units such as bits, bytes, and words, and details the conversion processes between different number systems including decimal, binary, octal, and hexadecimal. Additionally, it covers integer representation, signed and unsigned integers, and floating-point number representation, highlighting the importance of normalized forms for unique representation.
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/ 18
Computer organization and
architecture
Chapter 2:
Number Systems and Codes
Number system and computer code We enter the data into a computer or review the output data from a computer using the letter of alphabet, various special symbols, and the numerals in the form of decimal number system. But since computer is an electronic device, which understands electrical flow (signal), there is no letter, symbol or number inside the computer. Computer works only with binary numbers Units of Data Representation units arranged from the smallest to the largest, the units are called bit, byte, and word. These units are based on the binary number system. 1. BIT: only two possible states 0 or 1; 2. BYTE: known as the basic “unit of data representation” in a computer system. The commonly used byte contains 8 bits (1byte=8bits) 3. Nibble: Group of 4 continuous bits. 4. Word consists of 32 bits, which is equal to 4 bytes (1word=32bits) We say that a computer is an 8-bit, a 16 bit, a 32 bit or a 64 bit computer to indicate that the amount of data it can process at a time. The larger the word length a computer has the more powerful and faster it is. number system is a set of codes which are given to distinct values or quantities. Using those assigned codes (symbols), we will 'count’. The symbols are called digits. Generally, a number system is characterized by: A. Its base (radix) :-is the number of digits that are included in the number system. B. Its digits. Generally, number system can be categorized in to two: 1. Non-positional number system 2. positional number system Non- positional vs positional number systems In early days, human beings counted on fingers. When ten fingers were not adequate, stones, or sticks were used to indicate values. This method of counting uses an additive approach or the non – positional number system. symbols such as I for 1, II for 2, III for 3, etc are used. Each symbol represents the same value regardless of its position in the number. difficult to perform arithmetic with such a number system, positional number systems were developed. In a positional number system, there are only a few symbols called digits, symbols represent different values depending on the position they occupy in the number. various number systems • There are various positional number systems – the decimal, binary, octal, hexadecimal. A. The Decimal Number System:- The number system that we use in our day – to – day life. It is base ten. have ten different digits or symbols (0,1,2,3,4,5,6,7,8,9). Example integer part:- (8762)10 = (8*) + (7* ) + (6* ) + (2* ) fractional part:- (0.475)10= (4* ) + (7* ) + (5* ) various number systems ……cont’d B. Binary number system The most popular form which is understood by the computer. Its radix is 2. It uses two digits i.e. 0 & 1. Sometimes it is also called base-two system. Example: 1011,100,1,0.11 etc Why Binary representation is used in computers? Computer circuits are designed on the basis of two bits 0 & 1. The digital electronic circuits have only two possible states. Due to this feature of electronic circuits, a computer can understand information composed of only 0s and 1s i.e. all the internal operations/manipulations are performed in binary form. The binary system simplifies the design of the circuits, reduces the cost and improves the reliability. Every operation that can be done in decimal system can also be done in binary. various number systems ……cont’d
Octal and hexa decimal number system reading assignment
Converting From One Number System to Another A. Conversion of decimal numbers into any other number systems A decimal number might have two parts: integral and fractional part For the integer part, the following procedure is followed: 1. Divide the integral part by the base of the target number system and note the remainder. 2. Divide the quotient of the previous division by the target base and note the remainder. 3. Repeat step 2 till the quotient becomes 0. 4. Arrange the remainders in an order starting with the last division. 5. The number obtained in step 4 is the integer part of the desired number For the fraction part, the following procedures are followed: 6. Multiply the fraction part by the base of the system and note the integer part. 7. Multiply the fraction part of the previous result by the base and note the integer part. 8. Repeat step 2 till the fraction part of the result is zero or till the required accuracy 9. Arrange the integer parts in the order starting with first multiplication. 10. The number obtained in step 4 is the fraction part of the desired number. Example1 integer part Decimal to Binary Decimal to Octal Decimal to Hexadecimal 2510 =? 2 95210 =? 8 42810 = ?16 Q R Q R Q R 25 952 428 12 1190 26 6 3 1 14 7 0 1 0 1 3 1 0 71 6 ` 1 0 1 1 =1 10 12 =1 A C 16 = 110012 =16708
Example 2 fractional part (0.68)10 = (?)2
Fractional part conversion - Process Product Decimal part Integer part 0.68 × 2 1.36 .36 1 MSD 0.36 × 2 0.72 .72 0 0.72 × 2 1.44 .44 1 º (10101)2 0.44 × 2 0.88 .88 0 0.88 × 2 1.76 .76 1 LSD B. Conversion of other systems into decimal number system
Integer Part Conversion
1. Determine the positional value of each digit. 2. Multiply the positional value by the digits in the corresponding columns. 3. Sum the products obtained in step 2. The total is the equivalent value in decimal. Fractional Part Conversion 1. For converting a fraction of binary system into decimal the following steps should be followed: 2. Multiply each digit of binary from left to right by , , and .... respectively. 3. Simplify the arithmetic expression and add them together to find the required fraction of decimal system. 4. Now by combining both the converted parts we can find the decimal equivalent of the binary number. example Example 1. Convert binary (11101101.10101)2 to decimal form. Solution Integer part – 11101101 Fractional part – 10101 Conversion of integer part : 1×27 + 1×26 + 1×25 + 0×24 + 1×23 + 1×22 + 0×21 + 1×20 1×128 + 1×64 + 1×32 + 0×16 + 1×8 + 1×4 + 0×2 + 1×1 128 + 64 + 32 + 0 + 8 + 4 + 0 + 1 (237)10 Conversion of fractional part: Starting from left to right each bit is multiplied by 2–1, 2–2, 2–3, 2–4...... we find 1 0 1 0 1 ———––––––––– 1×2–1 + 0×2–2 + 1×2–3 + 0×2–4 + 1×2–5 .50 + 0 + .125 + 0 + .03125 = (.65625)10 By combining both the resultant values we get the final decimal equivalent value (237.65625)10 • Other Base to Other Base?????????????? Integer Representation Computers use a fixed number of bits to represent an integer. The commonly-used bit-lengths for integers are 8-bit, 16-bit, 32-bit or 64-bit. Besides bit-lengths, there are two representation schemes for integers: Unsigned Integers: can represent zero and positive integers. Signed Integers: can represent zero, positive and negative integers. Three representation schemes had been proposed for signed integers: a) Sign-Magnitude representation b) 1's Complement representation c) 2's Complement representation n-bit Sign Integers in Sign-Magnitude Representation the sign bit is set to ‘1’ if negative and cleared to ‘0’ if positive: example Suppose that n=8bit 6 00000110 or -6 10000110 (2’s??) +13 00001101 + +13 00001101 19 00010011 +7 10010011 ( = -19) n-bit Sign Integers in 1's Complement Representation
can be found by reversing the bits
Example: Example 1: Suppose that n=8 and the binary representation 1 000 0001B. Sign bit is 1 ⇒ negative Absolute value is the complement of 000 0001B, i.e., 111 1110B = 126D n-bit Sign Integers in 2's Complement Representation The 2s complement representation can be found by reversing the bits (into 1s complement) and then adding 1== 1s complement + 1. Example; what is the 2’s complement of example 1??? Floating-Point Number Representation How to represent very large numbers and very tiny numbers in computer??? A floating-point number can represent a very large (1.23×10^88) or a very small (1.23×10^-88) value. In digital computers, floating-point number consist of three parts: a sign bit, an exponent part (representing the exponent on a power of 2), and a fractional part called a significand (mantissa). in the form of F×r^E. Decimal numbers use radix of 10 (F×10^E); while binary numbers use radix of 2 (F×2^E). Normalized Floating Representation • It has been noted that a number may have more than one floating point representations. • In order to have unique representation of non-zero numbers a normalized floating point representation is used. • A normalized form is used for storing a floating-point number in memory. • A normalized form is a floating-point representation where the leftmost bit of the significand will always be a 1. • Example: Internal representation of (10.25)10 • (10.25)10 = (1010.01) 2 (Un-normalized form) = (1010.01) 2 x . = (101.001) 2 x . . : = (0.101001) 2 x (Normalized form) = (0.0101001) 2 x (Un-normalized form) Thank you