Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

index addressing array reaches beyond bounds

Status
Not open for further replies.

Elenthra

Programmer
Jan 1, 2009
1
SG
Hello, I am having this problem, hope someone could help me.
Below is a portion of VHDL file. I faced the problem of storing values into arrays through indexing. Currently I am using Altera Max Plus II. And the error is:
"Bounds of non-constant array reaches beyond the bounds of the array"

I could not figure out what could have prompted this error.

************************************************
The Package used is:
PACKAGE array_consequent IS

constant rules_width : INTEGER :=25;
TYPE result_consq IS ARRAY (1 to rules_width) of std_logic_vector(3 downto 0);

END array_consequent;




LIBRARY ieee;
USE ieee.std_logic_1164.all;
USE ieee.std_logic_arith.all;
LIBRARY work;
USE work.array_consequent.all; --containts the number of rules




ARCHITECTURE loading OF ctrlblck IS

SIGNAL result: result_consq;
SIGNAL NM,NS,Z,PS,PM: STD_LOGIC_VECTOR(3 downto 0);
SIGNAL Count1:INTEGER;
BEGIN

dummy:pROCESS(Clock)
BEGIN
IF Clock='1' THEN
IF Count1<rules_width THEN

Count1<=Count1+1;
ELSE
Count1<=1;
END IF;
END IF;
END PROCESS DUMMY;


loadingrules:pROCESS(Count1)
BEGIN
IF Data_In=&quot;0000&quot; THEN
result(Count1) <= &quot;0000&quot;;
ELSIF Data_In=&quot;0001&quot; THEN
result(Count1) <= NM;
ELSIF Data_In=&quot;0010&quot; THEN
result(Count1) <= NS;
ELSIF Data_In=&quot;0011&quot; THEN
result(Count1) <= Z;
ELSIF Data_In=&quot;0100&quot; THEN
result(Count1) <= PS;
ELSIF Data_In=&quot;0101&quot; THEN
result(Count1) <= PM;
ELSE
result(Count1) <= &quot;0000&quot;;

END IF;




END PROCESS loadingrules;

END loading;
 
(I use modelsim XE so I hope this helps)
My guess is that the value of Count1 is not valid at the beginning of simulation time. On my pc using modelsim an unitialized integer is -2147483648. Your array only has values from 1 to 25...

For simulation, you can get around this problem in at least 2 ways.

1. SIGNAL Count1 :INTEGER := 1;
2. SIGNAL Count1:INTEGER range result_consq'range;

However,I am not sure how your synthesizer treats 1 or 2.
Mine would ignore the value given in statement 1 and I am not sure about 2.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top