打印

请问关于renge和array的问题

[复制链接]
1326|2
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
worrior_1|  楼主 | 2009-3-5 18:17 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
ge, se, ic, logic, ST

这是程序的源代码
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_unsigned.all;
ENTITY General_decoder is
generic(sel_size:integer:=3;
         out_size:integer:=8);
  port(sel:in std_logic_vector(sel_size-1 downto 0);
       en:in std_logic;
       Y:out std_logic_vector(out_size-1 downto 0));
end General_decoder;
ARCHITECTURE rtl of General_decoder is
begin
  process(sel,en)
    begin
     Y<=(others=>'1');
     for i in y'range loop
     if(en='1'and(conv_integer(sel))=i)then
       y(i)<='0';
     end if;
    end loop;
   end process;
  end rtl;
请看我加黑那一行,那个for   loop循环语句 里面的"i"上面没有定义,为什么程序里面还能用?而且y那里为什么用range?还加上了一个   '    这是为什么?他为什么不用array?程序上面定义的y是从高到低,那应该用array才对啊?但是即使是这样程序反而还能编译通过,后来我试验改成array也可以编译通过,但是你把那个 '  去掉了他就编译通不过了,这是为什么?

相关帖子

沙发
worrior_1|  楼主 | 2009-3-5 21:31 | 只看该作者

请问关于renge和array的问题

这句话为什么不能这样写?
for i in y loop?这样写编译通不过,难道是因为上面的y总线输出了7个信号么?

使用特权

评论回复
板凳
worrior_1|  楼主 | 2009-3-7 16:14 | 只看该作者

请问关于renge和array的问题

饿,我还有一点不明白,i 前面没有定义怎么能直接拿来用呢?

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

13

主题

49

帖子

0

粉丝