1 / 14

Multiplicação e Divisão Serial Conceitos básicos

Multiplicação e Divisão Serial Conceitos básicos. Moraes/Ney - 07/novembro/2007. Representações de Inteiros - 4 formas. -8. -Exemplo para 4 bits - * polarização = 2 (n-1) =8. BIAS*. +7. -7. 0. 2’s. -1. +1. +0. +6. -6. 1’s. -0. +1. -2. +2. +0. SM. -7.

orinda
Download Presentation

Multiplicação e Divisão Serial Conceitos básicos

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Multiplicação e Divisão Serial Conceitos básicos Moraes/Ney - 07/novembro/2007

  2. Representações de Inteiros - 4 formas -8 -Exemplo para 4 bits - * polarização = 2(n-1) =8 BIAS* +7 -7 0 2’s -1 +1 +0 +6 -6 1’s -0 +1 -2 +2 +0 SM -7 • Bias tem distribuição uniforme com relação a binários puros; • Complemento de 2 facilita soma; • Complemento de1 facilita complementação; • SM é fácil de entender e separa sinal de valor; +2 -1 +1 +5 +2 -6 0000 -5 -3 1111 0001 +3 -2 +3 0010 1110 -5 +3 1101 0011 Configuração Binária +4 -4 -3 -4 1100 0100 +4 +4 +4 -4 1011 0101 -3 1010 -4 +5 0110 -5 +5 +3 +5 1001 -2 0111 1000 +6 -3 -5 -1 +6 +7 -0 -6 +6 -6 +7 +2 -2 -7 -7 +7 -8 +1 -1 +0

  3. Solução para a*b: somas sucessivas n passos Inicialmente, P=0, A=a, B=b. Cada passo, duas partes: soma carregada em P; P & A deslocado um bit para a direita. Multiplicação serial Deslocamento Vai-um P A n n + B n

  4. 0 0 0 1 0 1 1 1 0 1 1 0 0 0 0 1 0 1 1 1 0 1 0 0 0 1 1 1 1 1 1 0 1 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 0 1 0 0 0 0 0 1 1 1 1 0 0 1 0 0 0 0 0 1 1 1 0 Multiplicação A*B A = 11011 (27) B = 00101 (5) 135  100 00111 P A 0 0 0 0 0 0 1 1 0 1 1 passo 1 2 3 4 5

  5. Multiplicação A*B A = 00110 (6) B = 01100 (12) 72  0100 1000 P A passo 1 2 3 4 5

  6. Divisão serial • Solução para a/b: subtrações sucessivas, n passos • Cada passo, quatro partes: 1) desloca P&A p/ esq 1 bit; 2) P<- P-B; 3) If (passo 2<0), A0=0 else A0 =1; 4) If (passo 2<0), restaura P fazendo P<-P+B. Deslocamento n+1 P A n+1 n - + n+1 n+1 B 0 Controle 1 n

  7. 0 0 0 0 0 1 1 0 1 1 0 Divisão A/B 1) desloca P&A p/ esq 1 bit; 2) P  P-B; 3) If (P<0), A0=0 else A0 =1; 4) If (P<0), restaura P fazendo P  P+B A = 11011 (27) B = 00101 (5) P (conterá o resto) A (conterá a divisão) 0 0 0 0 0 0 1 1 0 1 1 passo 1 0 0 0 0 0 1 1 0 1 1 0 2 3 4 5

  8. 0 0 0 0 1 1 0 1 1 0 0 Divisão A/B 1) desloca P&A p/ esq 1 bit; 2) P  P-B; 3) If (P<0), A0=0 else A0 =1; 4) If (P<0), restaura P fazendo P  P+B A = 11011 (27) B = 00101 (5) P (conterá o resto) A (conterá a divisão) 0 0 0 0 0 0 1 1 0 1 1 passo 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 2 0 0 0 0 1 1 0 1 1 0 0 3 4 5

  9. 0 0 0 0 0 1 1 1 0 0 1 Divisão A/B 1) desloca P&A p/ esq 1 bit; 2) P  P-B; 3) If (P<0), A0=0 else A0 =1; 4) If (P<0), restaura P fazendo P  P+B A = 11011 (27) B = 00101 (5) P (conterá o resto) A (conterá a divisão) 0 0 0 0 0 0 1 1 0 1 1 passo 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 2 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 0 3 0 0 0 1 1 0 1 1 0 0 0 4 5 00110 - 00101 = 001

  10. 0 0 0 0 1 1 1 0 0 1 0 Divisão A/B 1) desloca P&A p/ esq 1 bit; 2) P  P-B; 3) If (P<0), A0=0 else A0 =1; 4) If (P<0), restaura P fazendo P  P+B A = 11011 (27) B = 00101 (5) P (conterá o resto) A (conterá a divisão) 0 0 0 0 0 0 1 1 0 1 1 passo 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 2 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 0 3 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 1 4 0 0 0 0 1 1 1 0 0 1 0 5

  11. 0 0 0 0 1 0 0 0 1 0 1 Resto = 2 resultado=5 Divisão A/B 1) desloca P&A p/ esq 1 bit; 2) P P-B; 3) If (P<0), A0=0 else A0 =1; 4) If (P<0), restaura P fazendo P  P+B A = 11011 (27) B = 00101 (5) P (conterá o resto) A (conterá a divisão) 0 0 0 0 0 0 1 1 0 1 1 passo 1 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 2 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 1 1 0 1 1 0 0 3 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 1 4 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 1 1 1 0 0 1 0 5 0 0 0 1 1 1 0 0 1 0 0

  12. entity divide is generic(N: integer := 16); port( divisor: in std_logic_vector( (N-1) downto 0); dividendo: in std_logic_vector( (N-1) downto 0); clock,start : in std_logic; endop : out std_logic; divisao : out std_logic_vector( N-1 downto 0); resto : out std_logic_vector( N-1 downto 0)); end; architecture rtl of divide is type State_type is (inicializa, desloca, calc, fim); signal EA: State_type; signal regP : std_logic_vector( N*2 downto 0); signal regB : std_logic_vector( N downto 0); signal diferenca : std_logic_vector( N downto 0); signal itershift: std_logic_vector( N downto 0); begin VHDL INICIALIZAÇÕES atribuição regP(0)<='1'; regP( N*2 downto N) <= diferenca; regP <= regP( N*2-1 downto 0) & regP(N*2); regP( N*2 downto N) <= (others=>'0'); regP( N-1 downto 0) <= divisor; regB( N ) <= '0'; regB( N-1 downto 0) <= dividendo; rotação

  13. Integração ao MIPS – bloco de controle

  14. end_div start_mult_div Lo data result end_mult start_mult_div HI ce rw bw x“000000” & data OP1 Memória de Dados RA ALU RALU MDR outalu CY2 D_address walu RB wmdr OP2 CY2 ce/rw DIV MULT RA RB IMED comparador salta CY2 RB Integração ao MIPS – bloco de dados

More Related