Study Material For Lecture 3
Study Material For Lecture 3
Study Material For Lecture 3
NUMBER REPRESENTATION
PROF. INDRANIL SENGUPTA
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
Why are Binary Numbers Important?
• We implement circuits using electronic components like transistors.
– A transistor acts like a switch: either conducting (ON) or non-conducting (OFF).
– There are billions of such miniature switches in modern-day VLSI chips.
• A switch can represent two states.
– Binary number system also has two digits, 0 and 1.
– We can follow some convention:
• Open switch represents 0, closed switch represents 1.
• Low voltage represents 0, high voltage represents 1.
• Absence of current represents 0, flow of current represents 1.
• Absence of light represents 0, presence of light represents 1.
bn-1 bn-2 b1 b0
Sign Magnitude
• A problem: Two different representations for zero.
+0: 0 00..000 and -0: 1 00..000
• Basic idea:
– Positive numbers are represented exactly as in sign-magnitude form.
– Negative numbers are represented in 1’s complement form.
• How to compute the 1’s complement of a number?
– Complement every bit of the number (1 to 0, and 0 to 1).
– Most Significant Bit (MSB) will indicate the sign of the number (0: positive, 1:
negative).
d) The sign bit can be copied as many times as required in the beginning to extend
the size of the number (called sign extension).
X = 00101111 (8-bit number, value = +47) X = 10100011 (8-bit number, value = -93)
Sign extend to 32 bits: Sign extend to 32 bits:
00000000 00000000 00000000 00101111 11111111 11111111 11111111 10100011