在for-loop循环语句里,你的i值如果为0话,q(i-1)就变成了q(-1)了,自然就会有那种问题出现了。
你可以用别的语句来实现(循环左移<<),或者改成下面这样:
PROCESS(a,b,nclr,clock)
BEGIN
IF nclr= '0' THEN
q <= "00000000";
ELSE
IF clock'EVENT AND clock = '1'
THEN
FOR i IN 1 to 7 LOOP
q(i) <= q(i-1);
end loop;
q(0) <= (a AND b);
END IF;
END IF;
END PROCESS;作者: ljp 时间: 2004-5-25 16:57 标题: 请问大虾,在MAX+PLUS(10.0)里是不是不支持此语句q(i)
请问大虾,在MAX+PLUS(10.0)里是不是不支持此语句q(i) <= q(i-1);?具体请见程序 library IEEE;
use IEEE.Std_logic_1164.all;
ENTITY SHIFT164 IS
PORT(a, b, nclr, clock : IN BIT;
q : BUFFER BIT_VECTOR(0 TO 7));
END SHIFT164;
ARCHITECTURE version1 OF SHIFT164 IS
BEGIN
PROCESS(a,b,nclr,clock)
BEGIN
IF nclr??= '0' THEN
q <= "00000000";
ELSE
IF clock'EVENT AND clock = '1'
THEN
FOR i IN q'RANGE LOOP
IF i = 0 THEN q(i) <= (a AND b);
ELSE
q(i) <= q(i-1);
END IF;
END LOOP;
END IF;
END IF;
END PROCESS;
END version1;
在验证时总是出错index value(-1)is out of the bounds for VHDL object 'q[o-7]'作者: boyfly 时间: 2004-5-25 16:57