--- lang: pt-br tags: ELE-21 --- # Projeto VHDL – Segundo bimestre ## EAI-21-2019 Alunos do curso de Engenharia Eletrônica: - [name=Lucas Barioni Toma] - [name=Michel Marcos Sena Farias] Professor: - [name=Duarte Lopes de Oliveira] --- ## Descrição do problema Para uma Máquina de Estados Finito Síncrona modelo Moore que tem uma entrada `X` e uma saída `Z` e reconhece todas as sequencias de três ou mais 1's consecutivos ou três ou mais zeros consecutivos, e a saída é `Z=1`. Para outros casos a saída é `Z=0`. Pede-se: - [x] a) `1.0` Faça o Grafo de Transição de Estados - [x] b) `4.0` Descrição em VHDL comportamental do item (a). - [x] c) `5.0` Faça a simulação do VHDL obtido em (b) e sintetize e faça simulação pós-layout no dispositivo da ALTERA, e mostre a simulação, tempo de latência, número de LUTs e Flip-Flops e RTL (Register Transfer Level) view --- ## Solução - a) Grafo de Transição de Estados da MEFS modelo Moore: ![](https://i.imgur.com/AIUgvpK.png) - b) Descrição em VHDL comportamental da MEFS do `item a`: ```vhdl library ieee; use ieee.std_logic_1164.all; entity sequence_detector is port ( x: in bit; clk: in bit; z: out bit ); end; architecture moore_machine of sequence_detector is type states is (a, b, c, d, e, f, g); signal current_st: states := a; signal next_st: states := a; begin update_current_st: process(clk) begin if (clk'event and clk='1') then current_st <= next_st; end if; end process update_current_st; update_next_st: process(current_st, x) begin case current_st is when a => z <= '0'; if (x='1') then next_st <= b; else next_st <= e; end if; when b => z <= '0'; if (x='1') then next_st <= c; else next_st <= e; end if; when c => z <= '0'; if (x='1') then next_st <= d; else next_st <= e; end if; when d => z <= '1'; if (x='1') then next_st <= d; else next_st <= e; end if; when e => z <= '0'; if (x='0') then next_st <= f; else next_st <= b; end if; when f => z <= '0'; if (x='0') then next_st <= g; else next_st <= b; end if; when g => z <= '1'; if (x='0') then next_st <= g; else next_st <= b; end if; end case; end process update_next_st; end; ``` - c) Simulação preeliminar do VHDL, síntese e simulação pós-layout: - Simulação preeliminar do VHDL: O circuito se comportou conforme especificado: - Transições testadas, cobrindo todos os casos: $$A \rightarrow B \rightarrow C \rightarrow D \rightarrow E \rightarrow F \rightarrow G \rightarrow B \rightarrow E \rightarrow B \rightarrow C \rightarrow E \rightarrow F \rightarrow B$$ $$A \rightarrow E$$ - `A` indo inicialmente para `B`: ![](https://i.imgur.com/YGkzigI.png =x200) - `A` indo inicialmenet para `E`: ![](https://i.imgur.com/xYPvWkf.png =x200) - Síntese do circuito descrito: 7 LUTs, 6 Flip-Flops: - Compilação: Flow Summary ``` Flow Status Successful - Sat Jun 29 23:16:34 2019 Quartus II 64-Bit Version 15.0.0 Build 145 04/22/2015 SJ Web Edition Revision Name sequence_detector Top-level Entity Name sequence_detector Family Cyclone IV E Device EP4CE115F29C7 Timing Models Final Total logic elements 7 / 114,480 ( < 1 % ) Total combinational functions 7 / 114,480 ( < 1 % ) Dedicated logic registers 6 / 114,480 ( < 1 % ) Total registers 6 Total pins 3 / 529 ( < 1 % ) Total virtual pins 0 Total memory bits 0 / 3,981,312 ( 0 % ) Embedded Multiplier 9-bit elements 0 / 532 ( 0 % ) Total PLLs 0 / 4 ( 0 % ) ``` - RTL (Register Transfer Level) view: ![](https://i.imgur.com/1SqFgsz.png) Onde `current_st` é especificado pelo Quartus II como sendo a MEF: ![](https://i.imgur.com/zUvr1W0.png) - Simulação pós-layout: Testando as mesmas transições da simulação preeliminar, o circuito se comportou conforme especificado. `A` indo inicialmente para `B`: ![](https://i.imgur.com/4t8tsln.png =x200) `A` indo inicialmenet para `E`: ![](https://i.imgur.com/e06Yrrz.png) Tempo de latência: $7,186 ns$ Analisando a primeira mudança na saída. ![](https://i.imgur.com/FUZJpo0.png =x200)