ТОР 5 статей: Методические подходы к анализу финансового состояния предприятия Проблема периодизации русской литературы ХХ века. Краткая характеристика второй половины ХХ века Характеристика шлифовальных кругов и ее маркировка Служебные части речи. Предлог. Союз. Частицы КАТЕГОРИИ:
|
Описание автоматов Мура и Мили на языке VHDL
Описание автомата Мура на языке VHDL (вариант с синхронными входами и выходами)
LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; ENTITY control_unit IS PORT(U: IN std_logic_vector (3 DOWNTO 1); clk: IN std_logic; rst: IN std_logic; V: OUT std_logic_vector (3 DOWNTO 1)); ARCHITECTURE moore OF control_unit IS TYPE STATE_TYPE IS (s0, s1,s2,s3); SIGNAL current_state: STATE_TYPE; BEGIN clocked_proc: PROCESS (clk, rst) BEGIN IF (rst = '0') THEN current_state <= s0; ELSIF (clk'EVENT AND clk = '1') THEN CASE current_state IS WHEN s0 => V(3 downto 1) <= (others => '0'); IF (U(1)='1') THEN current_state <= s1; ELSE current_state <= s0; END IF; WHEN s1 => V<= "001"; IF (U(2) = '1') THEN current_state <= s2; ELSE current_state <= s1; END IF; WHEN s2 => V <= "010"; IF (U(3) = '0') THEN current_state <= s3; ELSE current_state <= s0; END IF; WHEN s3 => V <= "100"; current_state <= s0; WHEN OTHERS => current_state <= s0; END CASE; END IF; END PROCESS clocked_proc; END moore;
Описание автомата Мили на языке VHDL (вариант с синхронными входами и выходами)
LIBRARY ieee; USE ieee.std_logic_1164.all; USE ieee.std_logic_arith.all; ENTITY control_unit IS PORT(U: IN std_logic_vector (3 DOWNTO 1); clk: IN std_logic; rst: IN std_logic; V: OUT std_logic_vector (3 DOWNTO 1)); ARCHITECTURE mielie OF control_unit IS TYPE STATE_TYPE IS (s0, s1,s2,s3); SIGNAL current_state: STATE_TYPE; BEGIN clocked_proc: PROCESS (clk, rst) BEGIN IF (rst = '0') THEN current_state <= s0; ELSIF (clk'EVENT AND clk = '1') THEN CASE current_state IS WHEN s0 => IF (U(1)='1') THEN V<="001"; current_state <= s1; ELSIF (U(1) = '0') THEN V(3 downto 1) <= (others => '0'); current_state <= s0; ELSE current_state <= s0; END IF; WHEN s1 => IF (U(2) = '1') THEN V <= "010"; current_state <= s2; ELSE current_state <= s1; END IF; WHEN s2 => IF (U(3) = '1') THEN V <= "000"; current_state <= s0; ELSIF (U(3) = '0') THEN V <= "100"; current_state <= s0; ELSE current_state <= s2; END IF; WHEN OTHERS => current_state <= s0; END CASE; END IF; END PROCESS clocked_proc;
END mielie;
Не нашли, что искали? Воспользуйтесь поиском:
|