15
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 2 Module 12 Number Systems

Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

  • Upload
    others

  • View
    21

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

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 2 Module 12

Number Systems

Page 2: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Digits = powers of 10

… 100, 10, 1, 1/10, 1/100, 1/1000 …

… 102, 101, 100, 10-1, 10-2, 10-3 …

Ex: (36.25)10 = 3*10 + 6*1 + 2*1/10 + 5* 1/100

Bits = powers of 2

… 8, 4, 2, 1, 1/2, 1/4, 1/8 …

… 23, 22, 21, 20, 2-1, 2-2, 2-3 …

Ex: (100100.01)2 = 1*32 + 1*4 + 1*1/4

Digits vs. bits

Number Systems 2

Page 3: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Binary to decimal

add powers that have a 1

(101001)2 = 32 + 8 + 1

(0.1001)2 = 1/2 + 1/16

(10110.1011)2 = ?

16 + 4 + 2 + 1/2 + 1/8 + 1/16

= 22.6875

Number Systems 3

Page 4: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Decimal to binary

Left of decimal point

Repeatedly divide integer part by 2 until you

get 0

Read remainders bottom to up

22 = (?)2

22

11 R 0

5 R 1

2 R 1

1 R 0

0 R 1

(10110)2

Number Systems 4

Page 5: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Decimal to binary

Right of decimal point

Repeatedly multiply fractional part by 2 until

you get 1

Read integer portion top to bottom

0.8125 = (?)2

0.8125

1.6250

1.25

0.5

1.0

(0.1101)2

Number Systems 5

Page 6: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Decimal to binary

What if there are both left and right of the decimal

point?

Do them separately and combine

22.8125 = (?)2

22

11 R 05 R 12 R 11 R 00 R 1

0.8125

1.62501.250.51.0

(10110.1101)2

up down

Number Systems 6

Page 7: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Exercises

3.25 = (?)2

0.0101 = (?)10

0.3 = (?)2

114.25 = (?)2

1010001.01101 = (?)10

0101.0101 = (?)10

1010.0101 = (?)10

Number Systems 7

Page 8: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Hexadecimal base

Hex digits = powers of 16

… 256, 16, 1, 1/16, 1/256 …

… 162, 161, 160, 16-1, 16-2 …

use digits 0-9, A-F A=10, B=11, C=12, D=13, E=14, F=15

Often preceded by 0x

Also with a base explicitly written (24.4)16

Ex: (24.4)16 = 2*16 + 4*1 + 4*1/16

Number Systems 8

Page 9: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Hexadecimal base

Hex (hexadecimal)

Hex digit is a group of 4 bits

Memorize this table!!

dec. hex binary

0 0 0000

1 1 0001

2 2 0010

3 3 0011

4 4 0100

5 5 0101

6 6 0110

7 7 0111

8 8 1000

9 9 1001

10 A 1010

11 B 1011

12 C 1100

13 D 1101

14 E 1110

15 F 1111Number Systems 9

Page 10: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Hex (hexadecimal)

Group from decimal point outward

Pad with zeros to get groups of 4

(1101101001010.101001)2

(0001 1011 0100 1010 . 1010 0100)2

1 B 4 A . A 4

(1101101001010.101001)2 = (1B4A.A4)16

Binary to Hex

Number Systems 10

Page 11: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Octal digits = powers of 8

… 64, 8, 1, 1/8, 1/64 …

… 82, 81, 80, 8-1, 8-2 …

use digits 0-7

sometimes preceded by 0

Also with a base explicitly written(24.4)8

Ex: (44.2)8 = 4*8 + 4*1 + 2*1/8

Octal base

Number Systems 11

Page 12: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Octal

Octal digits are groups of 3 bits

Pad with zeros

dec. octal binary

0 0 000

1 1 001

2 2 010

3 3 011

4 4 100

5 5 101

6 6 110

7 7 111

Octal base

Number Systems 12

Page 13: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

Octal

Group from decimal point outward

Pad with zeros to get groups of 3

(1101101001010.101001)2

(001 101 101 001 010 . 101 001)2

1 5 5 1 2 . 5 1

(1101101001010.101001)2 = (15512.51) 8

Binary to Octal

Number Systems 13

Page 14: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

What about other conversions such as:

Octal Hex

Decimal Hex

Use other conversions you already know

Octal Binary Hex

Decimal Binary Hex

Other conversions

Number Systems 14

Page 15: Digital Circuits and Digital Systems MOOC · 2017-08-04 · Hexadecimal base Hex (hexadecimal) Hex digit is a group of 4 bits Memorize this table!! dec. hex binary 0 0 0000 1 1 0001

End of Week 2: Module 12

Thank You

Number Systems 15