1 / 19

Aula 10 – Exp 8: Implementação de Máquinas de Estado

www.decom.fee.unicamp.br/~cardoso. Aula 10 – Exp 8: Implementação de Máquinas de Estado. Fabbryccio Cardoso Dalton S. Arantes DECOM-FEEC-UNICAMP. Exemplo1: identificar seq 1000. Estado 1. Estado 10. Estado 100. Exemplo1: identificar seq 1000. I n Out Next.

halil
Download Presentation

Aula 10 – Exp 8: Implementação de Máquinas de Estado

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. www.decom.fee.unicamp.br/~cardoso Aula 10 – Exp 8: Implementação de Máquinas de Estado Fabbryccio Cardoso Dalton S. Arantes DECOM-FEEC-UNICAMP

  2. Exemplo1: identificar seq1000 Estado 1 Estado 10 Estado 100

  3. Exemplo1: identificar seq1000 I n Out Next 1 0 1 1 0 1 Estado 1 0 0 2 0 0 3 1 0 1 0 0 2 0 0 3 0 1 0 1 0 1 Estado 10 Estado 100

  4. Help (rightclick in Mcode)

  5. Modelo

  6. Script em linguagem M (1/3) function [dout, estado] = seq1000( din, vin ) persistent next, next = xl_state(0, {xlUnsigned, 2, 0}); atual = next; dout = 0; estado = atual; ifvin == 1 .......................... Switch ..... end

  7. Script (2/3) switch(atual) case 0; if din == 1 next = 1; end case 1; if din == 0 next = 2; end case 2; if din == 0 next = 3; else next = 1; end

  8. Script (3/3) Estado 1 Estado 10 Estado 100 case 3; if din == 0 next = 0; dout = 1; else next = 1; end end

  9. Experimento • Identificar a seguinte seqüência de pressionamento de botões: UpDownUpDown. • Entradas: Botões Up e Down. • Saída: Led_0 para indicar identificação de sequência. • Saídas: Led_2 e Led_3 para indicar o estado atual. • Implementar a lógica de “debouncing” do Experimento 7 usando o bloco Mcode. • Utilizar dois registradores (regU e regD) internos e um único contador interno.

  10. Modelo 10 ns AJ15 {'ac4'} {'ah4'} {'aa6'} {'ag3'} {'aa5'} {'ac3'}

  11. Máquina de Estados

  12. Saída do Debouncer

  13. Saída da Máquina de Estado

  14. Implementação Debouncer 1/2 function [Uout, Dout, regU_D] = debouncer(Uin, Din) persistentcounter, counter = xl_state(0, {xlUnsigned,27,0}); persistentregU, regU = xl_state(0, {xlUnsigned,1,0}); persistentregD, regD = xl_state(0, {xlUnsigned,1,0}); constante = xfix({xlUnsigned,27,0},100e6-1); Uout = 0; Dout = 0;

  15. Implementação Debouncer 2/2 ifUin == 1 regU = 1; end if Din == 1 regD = 1; end regU_D = xl_or(regU, regD); ifregU == 1 | regD == 1 ……………………………. end

  16. Implementação Máquina de Estados function [dout, estado] = seqUDUD(Uin, Din) persistentnext, next = xl_state(0, {xlUnsigned,2,0}); persistentreg_dout, reg_dout = xl_state(0, {xlUnsigned, 1, 0}); atual = next; estado = atual; ifUin == 1 | Din == 1 ............................................ end dout = reg_dout;

  17. Exemplo 2 Implementar passo a passo oscilador 0-1 de período 1 segundo.

  18. Exercício Parte 1 Repetir o exemplo do modelo “exemplo1.mdl” para identificar a seqüência binária 0011.

  19. Avaliação Realização do experimento: 5,0 pontos. Fontes do experimento e do exercício: 5,0 ponto.

More Related