circuito digital - aula2

33
___________________________________ UESPI – UNIVERSDADE ESTADUAL DO PIAUÍ Bacharelado em Ciências da Computação CIRCUITO DIGITAL Notação Binários Negativos Multiplicação de binários Sistemas de Numeração (conversão) Decimais fracionários Octal Hexadecimal Tarcísio Franco Jaime

Upload: tarcisioti

Post on 22-Jun-2015

1.816 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Circuito Digital - Aula2

___________________________________UESPI – UNIVERSDADE ESTADUAL DO PIAUÍBacharelado em Ciências da Computação

CIRCUITO DIGITAL

Notação Binários NegativosMultiplicação de bináriosSistemas de Numeração (conversão)

– Decimais fracionários– Octal– Hexadecimal

Tarcísio Franco Jaime

Page 2: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Notação Binários Negativos

Maioria dos computadores digitais faz a subtração através da representação de números negativos

ex.: 8 – 6 , pode ser representado por 8 + (-6) Para representar o número binário negativo

basta determinar o complemento de 2 Manter no complemento de 2 o mesmo número

de bits do outro número, eliminando o bit de excesso.

Page 3: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Notação Binários Negativos

• Complemento de 2

– 1ª : Faz o complemento de 1 : troca-se cada bit pelo seu inverso.

Ex.: 1010 => 0101

– 2ª : Soma-se 1 ao complemento de 1

Ex.: 0101 + 1 = 0110

• Conversão inversa: é a passagem do complemento de 2 para a notação binária padrão. Para fazer a conversão inversa basta aplicar novamente o complemento de 2.

Page 4: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Notação Binários Negativos

1) Determine o complemento de 2 do número -10010110

2) Qual o equivalente positivo do número 01102 , aqui representado em complemento de 2?

Page 5: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Notação Binários Negativos

1) Determine o complemento de 2 do número -10010110

R= 011010102

2) Qual o equivalente positivo do número 01102 , aqui representado em complemento de 2?

R= 10102

Page 6: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Utilização do Complemento de 2 em Operações Aritméticas

• Pode-se usar em soma de números positivos e negativos

• Aplica-se o complemento de 2 no número negativo e assim soma com o número positivo

• Desconsidera o estouro do número de bits no resultado

Ex.: 11010111 – 100101 => 11010111+ (-100101)

=> comp. 1 de 00100101 = 11011010

=> comp. 2= 11011010 +1 = 11011011

=> 11010111+11011011= 110110010

.: 10101011 – 1000100 = 101100111

Page 7: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Utilização do Complemento de 2 em Operações Aritméticas

Ex.: 6 – 9

=> 6 = 0110 .:. 9 = 1001

=> comp. 1 de 1001 = 0110

=> comp. 2 de 0110 = 0110 + 1 = 0111

=> 0110 + 0111 = 1101

* obs.: não hourve carry, quando o minuendo é menor que o subtraendo a resposta é negativa, já estando em comp. 2. Para deixar a resposta normal basta aplicar o comp. 2 na resposta e aplicar o sinal negativo.

=> comp.2 de 1101 = 0010 +1 = 0011 => -0011

.: 1100-1111= (-0011) :: Fazer em decimal !

Page 8: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Utilização do Complemento de 2 em Operações Aritméticas

1) efetue subtrações, utilizando o complemento de 2:

a) 10101011 – 1000100

b) 10011 – 100101

Page 9: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Utilização do Complemento de 2 em Operações Aritméticas

1) efetue subtrações, utilizando o complemento de 2:

a) 10101011 – 1000100

= 101100111

b) 10011 – 100101

= -10010

Page 10: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Multiplicação no Sistema Binário

Mesmo procedimento do sistema decimal, sabendo que:

0 x 0 = 0

0 x 1 = 0

1 x 0 = 0

1 x 1 = 1 11010 x 10=110100 11010 x 11=1001110

Page 11: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Conversão de Números Binários Fracionários em Decimal

• Funcionamento do decimal:

– 10,5 =>1x101 + 0x100 + 5x10-1

• Funcionamento do binário:

– 101,101=> 1x22+0x21+1x20+1x2-1+0x2-2 + 1x2-3

101 100 10-1

1 0 5

22 21 20

1 0 1

2-1 2-2 2-3

1 0 1

Page 12: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Conversão de Números Decimal Fracionários em Binários

• Transforma separadamente a parte inteira do número e a parte fracionária

– 8,375 => 8 + 0,375

– 8|_2_

0 4 | 2

0 2 |_2_

0 1

=> 8 = 10002

Page 13: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Conversão de Números Decimal Fracionários em Binários

• 0,375

Page 14: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Sistema Octal de Numeração

• Existem 8 algarismos (0,1,2,3,4,5,6,7)

• Atualmente pouco utilizada no campo da eletrônica digital.

DECIMAL OCTAL

0 0

1 1

2 2

3 3

4 4

5 5

6 6

7 7

8 10

9 11

10 12

Page 15: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Conversão do Sistema Octal para Decimal

• Utiliza o conceito já visto anteriormente:

– 1448 = 1x82 + 4x81 + 4x80 = 10010

• 778 = 7x81 + 7x80 = 56 + 7 = 6310

Page 16: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Conversão do Sistema Decimal para Octal

• Processo análogo à conversão decimal/binária.

• Usa-se a base 8 para efetuar as divisões.

Page 17: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Conversão do Sistema Octal para Binário

• Cada algaristmo em octal corresponde diretamente em binário, não ultrapassando o número de bits do sistema octal, 23 = 8.

Page 18: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Conversão do Sistema Binário para Octal

• É só aplicar o processo inverso ao qual foi usado na conversão de octal para binário.

– 1º passo: separar em grupos de 3 bits. Lembrando que sempre começar da direita para esquerda.

– 2º passo: transformar cada grupo de 3 bits em octal. Caso o último grupo não esteja completo, complete com zero(s).

– 3º passo: depois é só unir os bits na ordem que foram transformados.

Page 19: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Conversão do Sistema Binário para Octal

• Ex.:

Page 20: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Conversão do Sistema Binário para Octal

Transforme os números binários em octais:

1) 101112 =

2) 110101012 =

3) 10001100112 =

Page 21: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Conversão do Sistema Binário para Octal

Transforme os números binários em octais:

1) 101112 = 278

2) 110101012 = 3258

3) 10001100112 = 10638

Page 22: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Sistema Hexadecimal

• Esse sistema possui 16 algarismos:

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

• Observar que o algarismo A representa a quantidade 10, B representa a quantidade 11 e até F representando quantidade 15.

• Bastante utilizado em mapeamento de memória em sistemas digitais.

Page 23: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Hexadecimal para Decimal

• Segue o padrão de conversão dos anteriores, mas apenas mudando a base para 16.

Ex.:

Page 24: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Hexadecimal para Decimal

Converta os números de hexadecimal para decimal:

1) 1C316

2)1FC916

Page 25: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Hexadecimal para Decimal

Converta os números de hexadecimal para decimal:

1) 1C316

=1x162 + Cx161 + 3x160

=1x256 + 12x16 + 3x1 = 45110

2)1FC916

= 1x163 + Fx162 + Cx161 + 9x160

=1x4096 + 15x256 + 12x16 + 9x1 = 813710

Page 26: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Decimal para Hexadecimal

• Mesma técnica anterior: divisão sucessiva pela base 16:

Ex.:

Page 27: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Decimal para Hexadecimal

1) Converta 13410 para o sistema hexadecimal.

Page 28: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Hexadecimal para binário

• Parecido com o octal só que agora precisa de 4 bits para representar um hexadecimal:

C13 16 => (C=12) 1 3

1100 0001 0011

=> C13 16 = 1100000100112

Page 29: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Hexadecimal para binário

Converta para binário:

1) 1ED 16

2) 6CF9 16

Converter para octal:

3) 3A716

Page 30: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Hexadecimal para binário

Converta para binário:

1) 1ED 16

1=0001; E=1110; D=1101

.: 1111011012

2) 6CF9 16

6=0110; C=1100; F=111; 9=1001

.: 1101100111110012

Page 31: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

Hexadecimal para binário

Converter para octal:

3) 3A716

=0011101001112

=16478

Page 32: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

EXERCÍCIOS

1) Converta para decimal os seguintes binários:

a)11000101 =197(10)

b)1010000=214(10)

2) Quantos bits são necessários para representar cada um dos decimais abaixo?

a) 512 = 10

b) 12 = 4

c) 17 = 5

Page 33: Circuito Digital - Aula2

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

UESPI

–UNIVE

RSIDA

DE ES

TADU

AL DO

PIAU

I - CI

RCUIT

O DIGI

TAL

Prof.

Tar

císio

Fran

coPr

of. T

arcís

io Fr

anco

EXERCÍCIOS

3) Converta em decimais os seguintes binários:

a)1000,0001 = 8,0625(10)

b)1100,1101 = 12,8125(10)

4) Transforme os octais em binários:

a) 477

b) 1523

5) Porque o número 1387 não pode ser octal?