集成电路技术分享

 找回密码
 我要注册

QQ登录

只需一步,快速开始

搜索
查看: 1589|回复: 0

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

[复制链接]
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 下一条

QQ|小黑屋|手机版|Archiver|集成电路技术分享 ( 京ICP备20003123号-1 )

GMT+8, 2024-5-2 16:02 , Processed in 0.058735 second(s), 19 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表