大家帮忙看看这个程序(VHDL)
六十进制计数器library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity counter_60 is
port(clk,bcd1wr,bcd10wr,cin:in std_logic;
co: out std_logic;
datain: in std_logic_vector(3 downto 0);
bcd1: out std_logic_vector(3 downto 0);
bcd10: out std_logic_vector(2 downto 0));
end counter_60;
architecture rtl of counter_60 is
signal bcd1n:std_logic_vector(3 downto 0);
signal bcd10n:std_logic_vector(2 downto 0);
begin
bcd1<=bcd1n;
bcd10<=bcd10n;
process(clk,bcd1wr,datain) is
begin
if(bcd1wr='1') then
bcd1n<=datain;
elsif(clk'event and clk='1') then
if(cin='1') then
if(bcd1n=9) then
bcd1n<="0000";
else
bcd1n<=bcd1n+'1';
end if;
end if;
end if;
end process;
process(clk,bcd10wr,datain) is
begin
if(bcd10wr='1') then
bcd10n<=datain(2 downto 0);
elsif(clk'event and clk='1') then
if(cin='1' and bcd1n=9) then
if(bcd10n=5) then
bcd10n<="000";
else
bcd10n<=bcd10n+'1';
end if;
end if;
end if;
end process;
process(bcd10n,bcd1n,cin) is
begin
if((cin='1') and (bcd1n=9) and (bcd10n=5)) then
co<='1';
else
co<='0';
end if;
end process;
end rtl;
可以编译,但是仿真不合适,仿真不计数,请各位老师同仁指正,万分感谢 对VHDL不熟悉,不过看楼主写得比较复杂。 编译只是说语法上没错,不代表功能没错;仿真不计数就说明计数的条件没达到,再往上查,为什么计数条件没达到,一步步往上查,问题就解决了 回复 1# 冉正国
请问你是用自带工具仿真还是自己写的test bench用modelsim仿的啊?仿真不计数你可以看一看你设置的条件是不是满足不了技术条件啊 回复 4# yun
用的是quartues ii的仿真器,它不行吗,多谢
页:
[1]