uc2_lab_2.docx

(10 KB) Pobierz

Instrukcje współbieżne (wyróżnione podstawowe):

- przypisanie do sygnału,

- instrukcja procesu process,

- instrukcja współbieżnego wywołania procedury,

- instrukcja łączenia komponentów port map,

- instrukcja powielania generale,

- instrukcja blokowa block.

 

Instrukcje sekwencyjne:

- przypisanie podstawowe do sygnału,

- wywołanie procedury,

- przypisanie do zmiennej,

- instrukcja czekania wait,

- instrukcja warunkowa if-then-else,

- instrukcja wyboru case,

- instrukcja pętli loop i związane instrukcje exit i next,

- instrukcja pusta null,

- instrukcja testowa assert.

 

Licznik modulo 10

library IEEE;

use IEEE.std_logic_1164.all;

use.IEEE.numeric_std.all;

 

entity mod10 is

   port(C,R : in std_logic;

        Q   : out std_logic_vector(3 downto 0));

end mod10;

 

architecture beh of mod10 is

begin

   process(C,R)

   variable cnt : unsigned(3 downto 0);

   begin

      if R='1' then

         cnt := "0000";

      elsif rising_edge(C) then

         if cnt<9 then

            cnt := cnt + 1;

         else

            cnt := "0000";

         end if;

      end if;

   Q <= std_logic_vector(cnt);

   end process;

end beh; 

Zgłoś jeśli naruszono regulamin