[an error occurred while processing this directive]
Ответ:
(«Телесистемы»: Конференция «Языки описания аппаратуры (VHDL и др.))

миниатюрный аудио-видеорекордер mAVR

Отправлено Leo02 21 октября 2002 г. 17:11
В ответ на: Ответ: двунаправленный счетчик отправлено Leo02 21 октября 2002 г. 16:07

library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_unsigned.all;

entity Reg_Cnt is
port (D : in std_logic;
Sum : out std_logic_vector(3 downto 0);
Q : out std_logic_vector(7 downto 0);
Clk : in std_logic;
nReset : in std_logic);
end Reg_Cnt;

architecture Arch_Reg_Cnt of Reg_Cnt is
signal QTmp : std_logic_vector(7 downto 0);
signal SumTmp : std_logic_vector(3 downto 0);
begin
Q<=QTmp;
Sum<=SumTmp;
ShiftReg: process (nReset, Clk)
begin
if nReset='0' then
QTmp<="00000000";
elsif (Clk'event and Clk='1') then
QTmp(7 downto 0)<=QTmp(6 downto 0)&D;
else
QTmp<=QTmp;
end if;
end process ShiftReg;

Cnt: process (nReset, Clk)
begin
if nReset='0' then
SumTmp<="0000";
elsif (Clk'event and Clk='1') then
if (D=Qtmp(7)) then
SumTmp<=SumTmp;
elsif ((D='1') and (Qtmp(7)='0')) then
SumTmp<=SumTmp+1;
elsif ((D='0') and (Qtmp(7)='1')) then
SumTmp<=SumTmp-1;
end if;
end if;
end process Cnt;
end Arch_Reg_Cnt;

Составить ответ  |||  Конференция  |||  Архив

Ответы


Отправка ответа

Имя (обязательно): 
Пароль: 
E-mail: 

Тема (обязательно):
Сообщение:

Ссылка на URL: 
Название ссылки: 

URL изображения: 


Перейти к списку ответов  |||  Конференция  |||  Архив  |||  Главная страница  |||  Содержание  |||  Без кадра

E-mail: info@telesys.ru