ups 发表于 2010-6-27 23:41:48

仿真的时候输出没有波形,不知道问题出在哪里,是循环除了问题还是加法出了问题

本帖最后由 fpgaw 于 2010-7-16 10:19 编辑

一段程序,但是仿真的时候输出没有波形,不知道问题出在哪里,是循环除了问题还是加法出了问题。编译综合通过。两段程序都试过了。都不行。希望高手给与解答。

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity test_2 is
port(
key : in std_logic_vector(6 downto 0);
tmp : buffer std_logic_vector(2 downto 0)

);
end entity test_2;
architecture behave of test_2 is
begin
p1:process(key)
begin
loop1 : for i in 0 to 6 loop
if(key(i) = '1')then
tmp <= tmp + 1;
end if;
end loop;
end process;
end architecture;


library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_unsigned.all;
entity exp11_2 is
port(
key : in std_logic_vector(6 downto 0);
-- vote : out std_logic;
tmp : out std_logic_vector(2 downto 0)
-- ledag : out std_logic_vector(6 downto 0)
);
end entity exp11_2;
architecture behave of exp11_2 is
--signaltmp : std_logic_vector(2 downto 0);
begin
p1:process(key)
variable count:std_logic_vector(2 downto 0);
begin
loop1 : for i in 0 to 6 loop
if(key(i) = '1')then
count := count + 1;
end if;
end loop;
tmp <= count;
end process;
end architecture;
页: [1]
查看完整版本: 仿真的时候输出没有波形,不知道问题出在哪里,是循环除了问题还是加法出了问题