导航: 老古网老古论坛XMOS公共讨论区XMOS开源项目区单片机程序设计嵌入式系统广告区域
→硬件:帮忙看看,我一点信心也没有了[UIL]

 *第4167篇: 硬件:帮忙看看,我一点信心也没有了

  
楼 主:UIL 2002年7月22日19:00
 硬件:帮忙看看,我一点信心也没有了
 看看这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.
为什么会这样?我的数组范围没有超过定义的值呀 

 

  
2楼:二极管 2008年2月18日13:53
 问题解决没有啊?
我也出现了这样的问题!!!

>>>>>>对该主题发表你的看法

本主题贴数2,分页: [第1页]


[上一篇主题]:硬件:请问画原理图的时候,电阻有RES1、RES2,到底哪一个是最新的国家标准?

[下一篇主题]:招聘单片机开发