binary numeration system , Slides of Verilog and VHDL

computer technology is based on electronic curcuits

Typology: Slides

2016/2017

Uploaded on 12/08/2017

fouad-albhlwan
fouad-albhlwan 🇸🇾

1 document

1 / 34

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
0
BINARY NUMERATION SYSTEM
0
.1
Jean-Pierre Deschamps
University Rovira i Virgili, Tarragona, Spain
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22

Partial preview of the text

Download binary numeration system and more Slides Verilog and VHDL in PDF only on Docsity!

BINARY NUMERATION SYSTEM

Jean-Pierre Deschamps University Rovira i Virgili, Tarragona, Spain

0.

1. Computer information representationp

p A computer receives, stores, processes, transmits

data.

Data^ types

:^ numbers characters

sounds^ (audio)

pictures

Data^ types

:^ numbers,

characters,

sounds^ (audio),

pictures

(video), etc.Data encoding: strings of

zeroes and ones

.

Computer technology is based on electronic circuits able to process vectors of 0’s and 1’s (theso-called^ digital electronic circuits

). For that reason all data are encoded by strings of 0’s and 1’s.

This type of information encoding is called

binary encoding system.

0.

2.1 Decimal system

y

-^ Uses ten

digits :

0, 1, 2, 3, 4, 5, 6, 7, 8, 9,^ ,^ ,^ ,^

,^ ,^ ,^ ,^ ,

-^ Positional

system^ :^ a weight is associated to every digit position so that position is relevant.

(weights)^

2 1 1010

(^010)

Example:^

(weights)^

2 1 1010

010 653 = 6·

2 1 + 5·10^ + 3·

0 6 hundreds, 5 tens, 3 units

0.

2.2 Binary system

y^ y

-^ Uses two digits (binary digits,

bits ):^ 0, 1

-^ Positional

system.

Example:^

(weights)^

3 2 2 2

1 02 2

-^ To compute the decimal representation, add up the weights corresponding to the1’s of the binary representation:

(^ )^

3 2

1 0 (1101)^ = 1·2^2

3 2 + 1·2^ + 0·

1 0 + 1·2^ = 8 + 4 + 0 + 1 = 13

0.

Exercise

( solution

) Compute the decimal representation of the following binary number: (101001)

2

(^

) 1 0

weights^

5 2 2 4 3 2

2 2 2 1 0 2

(101001)^2

4 3 + 1·2^ + 0·

2 1 + 0·2^ + 1·

0.

2.2 Binary system: representation range •^ Pure binary system:

non-negative number

representation.

-^ With^

y^ y^ n^ n bits:^^2 distinct values.

p^

g

-^ Representation range:

n^ 0 to 2- 1

EXAMPLE:^

Binary^

Decimal^

Binary^

Decimal

n = 4 bits16 different combinationsfrom 0 to 15 = 2

4 -

0000

0

1000

8

0001

1

1001

9

0010

2

1010

10

0011

3

1011

11

0011

3

1011

11

0100

4

1100

12

0101

5

1101

13

0110

6

1110

14

0110

6

1110

14

0111

7

1111

15 8

0.

2.3 Hexadecimal system

y

BINARY^

HEXA 0 0 0

0 0 0 0 0

1 1

-^ Uses sixteen dígits:

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F

3 A^

9 F

0 0 1

0 2 0 0 1

1 3 0 1 0

0 4 0 1 0

1 5

-^ Positional

,^ ,^ ,^ ,^ system

,^ ,^ ,^ ,^ ,

,^ ,^ ,^ ,

,^ ,

3 A^

9 F

(weights)^

3 2 16 16

1 016 16

0 1 0

1 5 0 1 1

0 6 0 1 1

1 7 1 0 0

0 8

-^ To compute the decimal representation, add up the digitsmultiplied by the corresponding weights:

1 0 0

1 9 1 0 1

0 A 1 0 1

1 B 1 1 0

0 C

(3A9F)^16 = 3·

3 2 + 10·^

0 = 15007^10

1 1 0

0 C 1 1 0

1 D 1 1 1

0 E 1 1 1

1 F

3. Base conversion (HEXADECIMAL to BINARY)

0.

(^

)

5. Cambios de base (BINARY to HEXADECIMAL) • HEXADECIMAL to BINARY: 1 hexadecimal

digit^ →^4

bits binary^

•^ HEXADECIMAL

to BINARY: 1 hexadecimal digit

→^ 4 bits. hexadecimal

A^

binary^

-^ BINARY to HEXADECIMAL: 4 bits

→^ 1 hexadecimal digit (starting from the four

i ht^ t bit )

binary^

rightmost bits)

hexadecimal

B^ A^

0.

Exercise

( solution

)^110110101001100

?6D4C

BINARY^

HEXA 0 0 0

0 0 0 0 0

1 1

Compute the hexadecimal representation:^110110101001100

= ?6D4C^2

0 0 1

0 2 0 0 1

1 3 0 1 0

0 4 0 1 0

1 5

5F2C^ = ?0101111100101100^16

2

0 1 1

0 6 0 1 1

1 7 1 0 0

0 8

Compute the binary representation:^ 0101 1111 0010 11000101 1111 0010 11000101 1111 0010 1100 0101 1111 0010 1100

1 0 0

1 9 1 0 1

0 A 1 0 1

1 B 1 1 0

0 C 1 1 0

1 D 1 1 1

0 E 1 1 1

1 F

0.

4. Base conversion (DECIMAL to BINARY)

(^

)

(^5) • Divide the decimal number by 2. Divide the obtained quotient by 2. Keep dividingthe obtained quotients by 2 until the obtained quotient is equal to 1.the obtained quotients by 2 until the obtained quotient is equal to 1.• The base 2 number consists of the last quotient 1 and the set of previously obtainedremainders.^ Example:

^18 (10^ =? 10010

(2 (^

=^ · 2 + 18 = 9·2 + 09 = 4·2 + 14 = 2·2 + 0 2 1 2 + 02 = 1·2 + 0^

18 (10^ = 10010

(2^10010 (

0.

Exercise

( solution

) (^

) 43 =^ binary number? (^

43 = 21·2 + 121 = 10·2 + 110 =^ 5 ·2 + 010 =^ 5 2 + 05 =^ 2 · 2 + 12 =^ 1 · 2 + 0

43 = 101011(^

0.

6.^ Sum and difference of binary numbers6. Sum and difference of binary numbersSum^ of 2 bits:0 + 0 = 00 + 1 = 1

Difference

of 2 bits: 0 - 0 = 0 1 0 = 1

0 + 1 = 11 + 0 = 11 + 1 =^^10

(current step bit: 0,^ carry^ to the next step: 1 )

1 - 0 = 11 - 1 = 00 - 1 =^^11 (current step bit: 1

borrow to the next step: 1) 1 0 1 0 01 0 1 0 0 1 0 1 = A1 0 1 = A

carry^ to the next step: 1 )

bo^ o^ to t e

e t step:^ )

Sum^ example

:^

Difference

example :

1 1 11 1 1^ →→^ carrycarry 1 0 1 0 01 0 1 0 0 1 0 1 =1 0 1 = AA ++ 1 1 0 10 1 0 1 10 1 1 11 = B= B

1 0 1 0 01 0 1 0 0 1 0 1 = A1 0 1 = A-- 1 1 0 10 1 0 1 10 1 1 1 = B

1 = B

1 1 11 1 1^ →→^ carrycarry

→→^ borrowborrow 0 1 0 0 1 1 1 00 1 0 0 1 1 1 0

0.

Exercise

( solution

) 1 01 0 0 1 1 0 1 1 =0 1 1 0 1 1 = A

(^ ) A

1 01 0 0 1 1 0 0 1 =0 1 1 0 0 1 = A

A

- -^ 1 0 11 0 1 0

0 00 11 11 = B= B

0 0 1 0 0 1 10 0 1 0 0 1 1

→→^ carrycarry 1 1 1 0 1 1 1 01 1 1 0 1 1 1 0

++^ 1 0 11 0 1 0

0 00 11 11 = B= B

1 BB

11 0 0 1^11

→→^ borrowborrow

SUMMARY

0.

^ Computer information representation. ^ Numeration systems (decimal, binary, hexadecimal). ^ Pure binary system and representation range. ^ Base conversion.S^

d diff^

f bi^

b

^ Sum and difference of binary numbers.