Shankar Balachandran* Associate Professor, CSE Department Indian Institute of Technology Madras
*Currently a Visiting Professor at IIT Bombay
Digital Circuits and Systems
Spring 2015 Week 9 Module 48
Number Representation
Systems Number Representation Shankar Balachandran* Associate - - PowerPoint PPT Presentation
Spring 2015 Week 9 Module 48 Digital Circuits and Systems Number Representation Shankar Balachandran* Associate Professor, CSE Department Indian Institute of Technology Madras *Currently a Visiting Professor at IIT Bombay Positional Number
Shankar Balachandran* Associate Professor, CSE Department Indian Institute of Technology Madras
*Currently a Visiting Professor at IIT Bombay
Number Representation
Number Representation 2
Value of a number is determined by a weighted sum of its digits Weighting is implicit and is determined for each digit by the position
Let the number have n digits to the left of the radix point and m digits
1 n m i i iR
1 1 2 10
n digits m digits
Number Representation 3
1.
2.
3.
4.
Number Representation 4
Use MSB as a sign bit as follows,
MSB = 0 for positive integers MSB = 1 for negative integers
Other bits encode magnitude of integer. Range of representation with n bits is: The range is symmetric around 0. There are two representations for 0, i.e., 0000 and 1000.
Examples:
1 1
n n
Assume a 4-bit representation, 5 = 0101
3 = = 1111 0011
Convert the following sign magnitude numbers to a 6-bit representation. 0101 = 1010 = 000101 100010 S Magnitude (n-1 bits) n bits
Number Representation 5
Positive integers are represented “as is”. Negative integers are
5 = 0101 -5 = 1010
All positive integers have MSB=0; negative integers have MSB=1 Range of representation with n bits is: The range is symmetric around 0. There are two representations for 0, i.e., 0000 and 1111.
Examples:
1 1
n n
Assume a 5-bit representation, 01110 = 10111 = 15 = 16 =
Convert the following signed numbers to a 8-bit representation. 01011 = 10111 = 00001011 11110111 14
01111 not with 5 bits not with 5 bits
Number Representation 6
Positive integers are represented “as is”. Negative integers are
(Shortcut: bit-wise complement of the integer and add 1).
Example: 5 = 0101 -5 = 0000 – 0101 = 1011
All positive integers have MSB=0; negative integers have MSB=1 Range of representation with n bits is: The range is asymmetric around 0. There is only one representation for 0, i.e., 0000.
Examples:
1 1
n n
Assume a 5-bit representation, 01110 = 10111 = 15 = 16 =
Convert the following signed numbers to a 8-bit representation. 01011 = 10111 = 00001011 11110111 14
01111 not with 5 bits 10000
Number Representation 7
Integer representations are biased by B. A signed integer X is represented by the binary number X+B Range of representation with n bits is: Usually, B=2n-1 -2n-1 ≤ X < 2n-1 There is only one representation for 0, i.e., binary representation for
Examples: B X B
n
2 Assume a 5-bit representation and B = 24, 10001 = 01100 = 00000 = 0 = 15 = 17 – 24 = 1 12 – 24 = -4 0 – 24 = -16 0 + 24 = 10000 15 + 24 = 11111
Number Representation 8
Number Representation 9
Number Representation 10
Number Representation 11
Number Representation 12