硬件:帮忙看看,我一点信心也没有了
看看这VHDL的东西吧,什么错误?
Library ieee;
use ieee.std_logic_1164.all;
Entity fifo is
port(
datain:in std_logic_vector(6 downto 0);
dataout:out std_logic_vector(7 downto 0);
empty,full:out std_logic;
rd,wr,en,clk,clr:in std_logic
);
end fifo;
Architecture rtl of fifo is
type mem is array (0 to 15) of std_logic_vector(7 downto 0);
signal ram:mem;
signal in_full,in_empty:std_logic;
signal a:std_logic_vector(7 downto 0);
begin
empty<=in_empty;
full<=in_full;
dataout<=a;
process(clk,clr,rd,en,wr)
variable wp:integer;
begin
if (clk'event and clk='1') then
if en='1'then
if clr='1' then
in_empty<='1';
in_full<='0';
wp:=0;
clear: for i in 0 to 15 loop
ram(i)<="00000000";
end loop clear;
a<="XXXXXXXX";
elsif wp<=15 and wp>=0 then
if in_empty='0' and rd='1' then
a<=ram(0);
for i in 1 to 15 loop
ram(i-1)<=ram(i);
end loop;
wp:=wp-1;
elsif wr='1' and in_full='0' then
ram(wp)<=datain;此处有问题!!!
wp:=wp+1;
end if;
end if;
end if;
end if;
if wp=16 then
in_full<='1';
end if;
if wp=-1 then
in_empty<='0';
end if ;
end process;
end rtl;
error messages:
bounds of non-constant index addressing array
reach beyond the bounds of the array.
为什么会这样?我的数组范围没有超过定义的值呀
发表时间:2002年7月22日19:00:00