Mudanças entre as edições de "DI2022802 2021 1 AULA16"

De MediaWiki do Campus São José
Ir para navegação Ir para pesquisar
Linha 115: Linha 115:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 +
==Parte 2 - Simulador==
 +
 +
# O que é o ModelSIM?
 +
# Para que serve o ModelSIM?
 +
# O que é o ''Jumpstart'' que aparece na primeira vez que se executa o ModelSIM?
 +
# O que é um ''testbench''?
 +
# O que eu devo fazer para rodar um simulação? Onde devo clicar?
 +
# O que é ''Wave''? Esse termo é utiliza pra quê?
 +
# O que é "passo da simulação"?
 +
# O que é "tempo de simulação"?
 +
# Tente simular o seguinte código VHDL abaixo. É importante estabelecer um passo de simulação na ordem 100 ps. Perceba também que, quando ele atinge a contagem de 15 ele para de contar. Tente resolver esse problema alterando o range e/ou mudando a forma com que as informações são enviadas para o saída.
 +
<syntaxhighlight lang=vhdl>
 +
library ieee;
 +
use ieee.std_logic_1164.all;
 +
use ieee.std_logic_arith.all;
 +
 +
entity CONTADOR is
 +
port(
 +
CLK: in  std_logic;
 +
    RESET: in  std_logic;
 +
ENABLE: in  std_logic;
 +
Q: out std_logic_vector (3 downto 0)
 +
);
 +
end CONTADOR;
 +
 +
architecture CONTADOR_arq of CONTADOR is
 +
begin
 +
process(CLK,RESET)
 +
variable X: integer range 0 to 15;
 +
begin
 +
if (RESET = '1') then
 +
X := 0;
 +
 +
elsif (CLK'event and CLK='1') then
 +
if (ENABLE = '1') then
 +
X := X + 1;
 +
end if;
 +
end if;
 +
 +
Q <= conv_std_logic_vector(X, 4);
 +
 +
end process;
 +
end CONTADOR_arq;
 +
</syntaxhighlight>
 +
# Tente simular o seguinte código:
 +
<syntaxhighlight lang=vhdl>
 +
library ieee;
 +
use ieee.std_logic_1164.all;
 +
 +
ENTITY mux4x1 is
 +
    port(i0, i1, i2, i3: in bit;
 +
        a0, a1: in bit;
 +
        y: out bit);
 +
END mux4x1;
 +
 +
ARCHITECTURE teste of mux4x1 is
 +
BEGIN
 +
    y <= i0 when a1='0' and a0='0' else
 +
        i1 when a1='0' and a0='1' else
 +
        i2 when a1='1' and a0='0' else
 +
        i3;
 +
END teste;           
 +
</syntaxhighlight>
  
  

Edição das 13h11min de 6 de setembro de 2021

Lista de Exercícios para AT2

Parte 1 - VHDL

  1. O que significa CPLD, FPGA e VHDL?
  2. Quais as principais vantagens no uso do VHDL?
  3. Quais as etapas de um ciclo de projeto de sistemas em VHDL?
  4. Qual a diferença entre uma Entidade (entity) e uma Arquitetura (architecture)?
  5. O que são os Ports?
  6. Que tipo de pinos (ports) existem e onde são aplicados?
  7. O que é uma Descrição comportamental?
  8. O que é uma Descrição por fluxo de dados?
  9. O que é uma Descrição estrutural?
  10. Quais são as regras para a formação dos Identificadores?
  11. O que é uma constante?
  12. Qual a diferença de Sinais e de Variáveis?
  13. Quais os tipos de dados disponíveis em VHDL?
  14. Projetar e simular:
    1. Biestável tipo JK com clock e borda de subida, com descrição comportamental.
    2. Idem, com Preset e Clear assíncronos
  15. Realizar o projeto de um contador síncrono, com uma sequência pré-definida em VHDL e simular.
  16. Comentar os exemplos:
Exemplo 1
 
library ieee;
use ieee.std_logic_1164.all;

entity FF_D is
	port
	(
		D	: in  std_logic;
		clk	: in  std_logic;
		Q	: out std_logic
	);
end FF_D;

architecture Ex1 of FF_D is
begin
-- Update the register output on the clock's rising edge
process (clk)
begin
	if (rising_edge(clk)) then
		Q <= D;
	end if;
end process;
end Ex1;
Exemplo 2
 
library ieee;
use ieee.std_logic_1164.all;
 
ENTITY ff_jk is
    port(j,k,clk: in bit;
         q: out bit);
END ff_jk;
 
ARCHITECTURE teste of ff_jk is
BEGIN

process(clk)
variable temp : bit :='0';
begin
	if( falling_edge(clk) ) then
		if (j='1' and k='0') then
			temp:='1';
		elsif (j='0' and k='1') then
			temp:='0';
		elsif (j='1' and k='1') then
			temp:= not temp;
		else
			temp:=temp;
		end if;
		q<=temp;
	end if;
end process;
END teste;
Exemplo 3
 
library ieee;
use ieee.std_logic_1164.all; 
use ieee.std_logic_arith.all;

entity CONTADOR is
port(
	CLK:	in  std_logic;
    	RESET:	in  std_logic;
	ENABLE:	in  std_logic;
	Q:	out std_logic_vector (3 downto 0)
);
end CONTADOR;

architecture CONTADOR_arq of CONTADOR is 
begin
	process(CLK,RESET)
		variable X: integer range 0 to 15;
	begin
		if (RESET = '1') then
			X := 0;

		elsif (CLK'event and CLK='1') then
			if (ENABLE = '1') then
				X := X + 1;
			end if;
		end if;

		Q <= conv_std_logic_vector(X, 4);

	end process;
end CONTADOR_arq;

Parte 2 - Simulador

  1. O que é o ModelSIM?
  2. Para que serve o ModelSIM?
  3. O que é o Jumpstart que aparece na primeira vez que se executa o ModelSIM?
  4. O que é um testbench?
  5. O que eu devo fazer para rodar um simulação? Onde devo clicar?
  6. O que é Wave? Esse termo é utiliza pra quê?
  7. O que é "passo da simulação"?
  8. O que é "tempo de simulação"?
  9. Tente simular o seguinte código VHDL abaixo. É importante estabelecer um passo de simulação na ordem 100 ps. Perceba também que, quando ele atinge a contagem de 15 ele para de contar. Tente resolver esse problema alterando o range e/ou mudando a forma com que as informações são enviadas para o saída.
library ieee;
use ieee.std_logic_1164.all; 
use ieee.std_logic_arith.all;

entity CONTADOR is
port(
	CLK:	in  std_logic;
    	RESET:	in  std_logic;
	ENABLE:	in  std_logic;
	Q:	out std_logic_vector (3 downto 0)
);
end CONTADOR;

architecture CONTADOR_arq of CONTADOR is 
begin
	process(CLK,RESET)
		variable X: integer range 0 to 15;
	begin
		if (RESET = '1') then
			X := 0;

		elsif (CLK'event and CLK='1') then
			if (ENABLE = '1') then
				X := X + 1;
			end if;
		end if;

		Q <= conv_std_logic_vector(X, 4);

	end process;
end CONTADOR_arq;
  1. Tente simular o seguinte código:
library ieee;
use ieee.std_logic_1164.all;
 
ENTITY mux4x1 is
    port(i0, i1, i2, i3: in bit;
         a0, a1: in bit;
         y: out bit);
END mux4x1;
 
ARCHITECTURE teste of mux4x1 is
BEGIN
    y <= i0 when a1='0' and a0='0' else
         i1 when a1='0' and a0='1' else
         i2 when a1='1' and a0='0' else
         i3;
END teste;



Icone voltar.png Icone menu.png Icone prox.png