Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I'm so glad I found this site... Now I can get some sleep, because my problem is solved..."

Geography

Where in the world do Tek-Tips members come from?

index addressing array reaches beyond bounds

Elenthra (Programmer)
7 Nov 01 7:06
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="0000" THEN
                result(Count1) <= "0000";
            ELSIF Data_In="0001" THEN
                result(Count1) <= NM;
            ELSIF Data_In="0010" THEN
                result(Count1) <= NS;
            ELSIF Data_In="0011" THEN
                result(Count1) <= Z;
            ELSIF Data_In="0100" THEN
                result(Count1) <= PS;
            ELSIF Data_In="0101" THEN
                result(Count1) <= PM;
            ELSE
                result(Count1) <= "0000";
                
            END IF;


    
                                
    END PROCESS loadingrules;

END loading;
ahedin (Programmer)
8 Nov 01 18:13
(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.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close