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

Отправлено Vladimir_vss 27 мая 2002 г. 18:58
В ответ на: Thanks ,написал ,но в железе работает не корректно >> отправлено Борода 25 мая 2002 г. 21:06

То что я пользую:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity Div_cnt is
Port ( CLK : in std_logic; -- Clock
Reset : in std_logic;
Div_Out : out std_logic );

end Div_cnt ;

architecture rtl of Div_cnt is
signal Count : std_logic_vector(3 downto 0);
begin
process (CLK, Reset)
begin
if Reset='1' then
Count <= (Others => '0');
elsif rising_edge(CLK) then
Count <= Count + 1;
end if;
end process;
Div_Out <= Count(3);
end rtl;

Счётчик, который пару лет назад советовали на семинаре:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
--use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity Count_16 is
Port ( CLK, Reset : in std_logic;
qout : out std_logic_vector(3 downto 0) );
end Count_16 ;

architecture bin of Count_16 is
signal Count : integer range 0 to 15;
Begin
ctr: process (CLK, Reset)
begin
if (Reset='1') then
Count <= 0;
elsif CLK'event and CLK = '1' then
if (Count >= 15) then
Count <= 0;
else
Count <= Count + 1;
end if;
end if;
end process;
qout <= conv_std_logic_vector (Count,4);
end bin;

и ещё оттуда-же:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
--use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity Count_on_16 is
Port ( CLK, Reset : in std_logic;
qout : out std_logic_vector(3 downto 0) );
end Count_on_16 ;

architecture bin of Count_on_16 is
signal Count : std_logic_vector(3 downto 0);
Begin
ctr: process (CLK, Reset)
begin
if (Reset='1') then
Count <= (others => '0');
elsif CLK'event and CLK = '1' then
if (Count >= 15) then
Count <= (others => '0');
else
Count <= Count + 1;
end if;
end if;
end process;
qout <= Count;
end bin;

О двух последних ничего не могу сказать хорошего, т.к. не использовал и не компелировал. Первый использовался в Xilinx Foundation. Вообще-то нужно быть осторожным с преобразованием типов переменных. Так-же всегда нужно проверять во что та или иная конструкция компелируется в железе. В ISE и Foundation Clasic для этого вполне подходят FloorPlanner and FPGA Editor.


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

Ответы


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

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

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

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

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


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

E-mail: info@telesys.ru