1 / 15

ModelSim 2 Pontos de Paragem ( Breakpoints )

ModelSim 2 Pontos de Paragem ( Breakpoints ). Exemplo:. y0,y1. y1,y2. 1. a0. a1. x0. not x0. y3,y4,y5. a2. not x0 and not x1. x0. x3 and not x0. x3 and x0. not x1. not x0 and x1. a4. a3. not x3. y1,y5. x1. y4.

Télécharger la présentation

ModelSim 2 Pontos de Paragem ( Breakpoints )

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. ModelSim 2 Pontos de Paragem (Breakpoints) LDH Aula3

  2. Exemplo: y0,y1 y1,y2 1 a0 a1 x0 not x0 y3,y4,y5 a2 not x0 and not x1 x0 x3 and not x0 x3 and x0 not x1 not x0 and x1 a4 a3 not x3 y1,y5 x1 y4 A = {a0,a1,a2,a3,a4}; - conjunto de estados – mostrar nos displays Y = {y0,y1,y2,y3,y4,y5} - conjunto de saídas – mostrar nos LEDs X = {x0,x1,x2,x3,x4} - conjunto de entradas – entrar a partir dos interruptores LDH Aula3

  3. Exemplo: library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity FSM_code is Port ( reset : std_logic; X : in STD_LOGIC_VECTOR (3 downto 0); Y : out STD_LOGIC_VECTOR (5 downto 0); state : out integer range 0 to 4; Clock : in STD_LOGIC); end FSM_code; architecture Behavioral of FSM_code is type estado is (a0,a1,a2,a3,a4); signal c_s, n_s : estado; signal Y_c : std_logic_vector(5 downto 0); signal Y_n : std_logic_vector(5 downto 0); LDH Aula3

  4. Exemplo: begin process(Clock,reset) begin if reset = '1' then c_s <= a0; Y_c <= (others => '0'); elsif rising_edge(Clock) then c_s <= n_s; Y_c <= Y_n; end if; end process; process(c_s) begin n_s <= c_s; Y_n <= Y_c; case c_s is when a0 => Y_n <= "000011"; n_s <= a1; when a1 => Y_n <= "000110"; if X(0) = '1' then n_s <= a2; else n_s <= a4; end if; LDH Aula3

  5. Exemplo: when a2 => Y_n <= "111000"; if X(0) = '1' then n_s <= a2; elsif X(1) = '1' then n_s <= a3; else n_s <= a0; end if; when a3 => Y_n <= "010000"; if X(3) = '0' then n_s <= a4; elsif X(0) = '1' then n_s <= a1; else n_s <= a0; end if; when a4 => Y_n <= "100010"; if X(1) = '1' then n_s <= a3; else n_s <= a0; end if; when others => null; end case; end process; state <= 0 when c_s = a0 else 1 when c_s = a1 else 2 when c_s = a2 else 3 when c_s = a3 else 4 when c_s = a4 else 0; Y <= Y_n; end Behavioral; LDH Aula3

  6. Depuração em ModelSim Pontos de Paragem (Breakpoints) LDH Aula3

  7. Pontos de paragem só podem ser activados em linhas de cor vermelha • Abrir ficheiro FSM_VHDL. • Inserir um ponto de paragem em linha 43 (when a1 => Y_n <= "000110";). • Click ícone “Restart” • A simulação vai ser executada até ao ponto de paragem. • Pode verificar valores: • na janela “Objects”; • utilizando rato; • seleccionando examine (ver próximo slide). LDH Aula3

  8. LDH Aula3

  9. Depois pode utilizar o botão “step” ou “step over” terminar simulação ou “Continue Run”, etc LDH Aula3

  10. Exemplos VHDL: Full Adder library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity ORGATE is port ( A: in STD_LOGIC; B: in STD_LOGIC; Z: out STD_LOGIC ); end ORGATE; architecture ORGATE_arch of ORGATE is begin Z <= A or B; end ORGATE_arch; library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity adder1 is port ( A: in STD_LOGIC; B: in STD_LOGIC; SUM: out STD_LOGIC; CARRY: out STD_LOGIC ); end adder1; architecture adder1_arch of adder1 is begin SUM <= A xor B; CARRY <= A and B; end adder1_arch; LDH Aula3

  11. entity FULLADD is port (A, B, CIN : in std_logic; SUM, CARRY : out std_logic); end FULLADD; architecture STRUCT of FULLADD is signal I1, I2, I3 : std_logic; component adder1 port(A,B : in std_logic; SUM, CARRY : out std_logic); end component; component ORGATE port(A,B : in std_logic; Z : out std_logic); end component; begin u1:adder1 port map(A,B,I1,I2); u2:adder1 port map(I1,CIN,SUM,I3); u3:ORGATE port map(I2,I3,CARRY); end STRUCT; LDH Aula3

  12. Exemplos VHDL: Sinais e variáveis library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity var_sig is port (clk : in std_logic; output : out std_logic); end entity var_sig; architecture behav of var_sig is begin process (clk) variable temp_var : std_logic; begin temp_var := '1'; if (temp_var = '1') then output <= temp_var; else output <= '0'; end if; temp_var := '0'; end process; end behav; library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity sig_var is port (clk : in std_logic; output : out std_logic); end entity sig_var; architecture behav of sig_var is signal temp_sig : std_logic; begin test: process (clk) begin temp_sig <= '1'; if (temp_sig = '1') then output <= temp_sig; else output <= '0'; end if; temp_sig <= '0'; end process test; end behav; LDH Aula3

  13. library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.STD_LOGIC_ARITH.ALL; use IEEE.STD_LOGIC_UNSIGNED.ALL; entity test_bench_SigVar is port ( outputSig : buffer std_logic; outputVar : buffer std_logic ); end; architecture test_adder of test_bench_SigVar is signal clk : std_logic := '0'; component var_sig is port (clk : in std_logic; output : out std_logic); end component; component sig_var is port (clk : in std_logic; output : out std_logic); end component; begin var_sig_instance : var_sig port map (clk, outputVar); sig_var_instance : sig_var port map (clk, outputSig); process begin wait for 50 ps; clk <= not clk; end process; end architecture test_adder; LDH Aula3

  14. Trabalho Prático Acabar exemplos da aula anterior 15.10.2009 - 1ª avaliação Organização: 1. Cada grupo vai receber tarefas 1, 2, 3, etc. Quando um grupo concluir uma tarefa deverá mostrar os resultados. A nota da avaliação será calculada com base no número de tarefas implementadas e número de erros. 2. O tempo de trabalho é 2.5 horas. Os primeiros 20 minutos da aula vão ser usados para explicar o trabalho. Os seguintes 5 minutos - para distribuir a primeira tarefa. O tempo de trabalho é 13h25m-15h55m. Depois das 15h55m não será aceite nenhuma tarefa. LDH Aula3

  15. Exemplos de tarefas Pode encontrar o código aqui ou utilizar códigos dos meus exemplos (por exemplo, para máquina de estados finitos) Deve mostrar os resultados da simulação Durante avaliação não pode fazer perguntas LDH Aula3

More Related