[an error occurred while processing this directive]
|
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all; --- вот это позволяет пользоваться INT и LOGICом одновременно.
entity acc is
port (
CLK : in std_logic;
CE : in std_logic; -- разрешение клока,
LOAD : in std_logic; -- установка нового значения в базовый регистр
CLR : in std_logic; -- сброс
DATA : in std_logic_vector (7 downto 0); -- значение для загрузки в базовый регистр
B : in std_logic_vector (7 downto 0); -- шаг или значение на которое увеличивается значение базового регистра
Q : out std_logic_vector (7 downto 0) -- выход базового регитсра
);
end entity;
architecture acc_arch of acc is
signal REG_Q : std_logic_vector (7 downto 0);
signal TEMP_Q : std_logic_vector (7 downto 0);
begin
process (REG_Q, B)
begin
TEMP_Q <= REG_Q + B;
end process;
process(CLK)
begin
if rising_edge(CLK) then
if CE = '1' then
if CLR = '1' then
REG_Q <= "00000000";
elsif LOAD = '1' then
REG_Q <= DATA;
else
REG_Q <= TEMP_Q;
end if;
end if;
end if;
end process;
Q <= REG_Q;
end architecture;
E-mail: info@telesys.ru