Hardware Description Language Aula 9 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.
Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.
Transcript of Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.
![Page 1: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/1.jpg)
Hardware Description Language
Aula 8 –Verilog HDL
Prof. Afonso Ferreira Miguel, MSc
![Page 2: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/2.jpg)
Estrutura Geral
![Page 3: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/3.jpg)
Estrutura Geral
![Page 4: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/4.jpg)
Sinais x Operações em Verilog
![Page 5: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/5.jpg)
Sinais em Verilog
Em Verilog, sinais (nós) podem ser de 3 tipos básicos:
• wire ou tri;• wand ou triand;• wor ou trior.
![Page 6: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/6.jpg)
Tipos de informações em Verilog
Vetoresunidirecionais
Vetoresbidirecionais
Sinais simples(wire)
![Page 7: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/7.jpg)
Especificação de vetores
![Page 8: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/8.jpg)
Definição dos sinais
![Page 9: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/9.jpg)
Definição dos sinais
![Page 10: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/10.jpg)
Saídas registradas
![Page 11: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/11.jpg)
Saídas registradas
![Page 12: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/12.jpg)
Primitivas predefinidas
![Page 13: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/13.jpg)
Primitivas predefinidas
Label
Primitiva
![Page 14: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/14.jpg)
• Exercício 7Implementar uma memória ROM com um pino que
controle a saída (OE) para TRISTATE. Utilize os mesmos dados armazenados do slide anterior.
![Page 15: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/15.jpg)
• Exercício 8Implementar uma memória RAM com 3 bits de endereço e
4 bits de dados. Esta memória fica sempre habilitada (não tem CE) e escreverá um dado quando wr for para 1.
Completar
Clique aqui para fazer download do arquivo fonte
![Page 16: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/16.jpg)
Paralelismo de processos
Arquitetura
Processo 1
Processo 2
Processo 3
Processo 4
Processo 5
![Page 17: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/17.jpg)
Paralelismo de processos
Alterando A, os processos P1 e P2 são executados em paralelo
![Page 18: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/18.jpg)
Paralelismo de processos
Alterando B, os processos P1 e P3 são executados em paralelo
![Page 19: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/19.jpg)
Paralelismo de processos
Alterando C, apenas o processo P2 é executado
![Page 20: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/20.jpg)
Comunicação entre processos
Processo P1
Processo P2
Processo P3
![Page 21: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/21.jpg)
Comunicação entre processos
Processo P1
Processo P2
Processo P3
![Page 22: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/22.jpg)
Comunicação entre processos
Evento em A
Evento em D
Evento em E
![Page 23: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/23.jpg)
Comunicação entre processos
![Page 24: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/24.jpg)
Comunicação entre processos
Evento em D
![Page 25: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/25.jpg)
Comunicação entre processos
![Page 26: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/26.jpg)
• Exercício 4Modifique o exercício 4 para que utilize dois
processos (proc1 e proc2) para controlar as funções do latch e da saída respectivamente. Utilize um signal (s) para comunicar dados entre os processos.
![Page 27: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/27.jpg)
Evitar processos desnecessários
![Page 28: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/28.jpg)
Outros atributosarray type or objects of the array type
![Page 29: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/29.jpg)
Outros atributosSignals attributes
![Page 30: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/30.jpg)
ContadoresContador Simples (UP – 3 bits - MOD 8)
Tipo inteiro, unsigned ou signed
![Page 31: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/31.jpg)
ContadoresContador Simples (UP – 3 bits - MOD 8)
O valor contado é incrementado e armazenado em uma variável do processo.
![Page 32: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/32.jpg)
ContadoresContador Simples (UP – 3 bits - MOD 8)
Neste exemplo, a ação de incremento é sensível a rampa ascendente.
![Page 33: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/33.jpg)
ContadoresContador com Reset (UP – 3 bits - MOD 8)
A variável de contagem é zerada ao receber um sinal de reset.
![Page 34: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/34.jpg)
ContadoresContador com Reset + Load (UP – 3 bits - MOD 8)
A entrada é carregada quando load vai para 1.
![Page 35: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/35.jpg)
ContadoresContador UP/DOWN – 3 bits - MOD 8
A variável de contagem é incrementada ou decrementada em função da entrada up_down.
![Page 36: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/36.jpg)
• Exercício 5– Implementar em AHDL um contador MOD5
decrescente que realize a contagem (6, 5, 4, 3, 2, 6, 5, ...).
![Page 37: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/37.jpg)
VHDL• Máquinas de estado de MOORE
e0/0 e1/11
0
1
0
Definição dos estados
![Page 38: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/38.jpg)
VHDL• Máquinas de estado de MOORE
e0/0 e1/11
0
1
0
Definição das transições
![Page 39: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/39.jpg)
VHDL• Máquinas de estado
e0/0 e1/11
0
1
0
Definição dos valores de saída
![Page 40: Hardware Description Language Aula 8 –Verilog HDL Prof. Afonso Ferreira Miguel, MSc.](https://reader036.fdocuments.in/reader036/viewer/2022081422/552fc182497959413d8f4504/html5/thumbnails/40.jpg)
• Exercício 6– Implementar em VHDL uma máquina de estado de
MOORE com 4 bits de entrada (+ o clock) e 1 bit de saída. O bit de saída inicialmente deve apresentar o valor ZERO, e deve ir para UM quando receber na entrada o valor 15. Caso ele receba a seqüência 7, 4, 3 a máquina deve voltar ao seu estado inicial ZERO.