for loop problem

Guest
hello,
i am having a small problem with this pc of code, can anyone help me
with it.
during simulation i get an error - Index 8 out of bound 0 to 7 on line
4

for count in 0 to 2 loop
for row in 0 to 7 loop
tempc := 0;
for col in 0 to (temp - 1) loop
mat2(row)(col) <= (mat1(row)(tempc) + mat1(row)(tempc + 1)) / 2;
mat2(row)(col + temp) <= (mat1(row)(tempc) - mat1(row)(tempc + 1)) /
2;
tempc := tempc + 2;
end loop;
end loop;
mat1 <= mat2;
temp := temp/2;
end loop;
 
On Jul 26, 5:31 pm, mk.supr...@gmail.com wrote:
hello,
i am having a small problem with this pc of code, can anyone help me
with it.
during simulation i get an error - Index 8 out of bound 0 to 7 on line
4

for count in 0 to 2 loop
for row in 0 to 7 loop
tempc := 0;
for col in 0 to (temp - 1) loop
mat2(row)(col) <= (mat1(row)(tempc) + mat1(row)(tempc + 1)) / 2;
mat2(row)(col + temp) <= (mat1(row)(tempc) - mat1(row)(tempc + 1)) /
2;
tempc := tempc + 2;
end loop;
end loop;
mat1 <= mat2;
temp := temp/2;
end loop;
here temp = 4.
now it is simulating, earlier i had given only temp, when i changed to
temp - 1 in the for loop it works, but now, even though i had
initialized mat1 to contain 255, it does not show on the simulator,
and at the end of the simulation both mat1 and mat2 contain only zeroes
 
In news:1185453861.663322.154380@x35g2000prf.googlegroups.com
timestamped Thu, 26 Jul 2007 05:44:21 -0700, mk.supriya@gmail.com
posted:
|------------------------------------------------------------------------------|
|"On Jul 26, 5:31 pm, mk.supr...@gmail.com wrote: |
|> hello, |
|> i am having a small problem with this pc of code, can anyone help me |
|> with it. |
|> during simulation i get an error - Index 8 out of bound 0 to 7 on line |
|> 4 |
|> |
|> for count in 0 to 2 loop |
|> for row in 0 to 7 loop |
|> tempc := 0; |
|> for col in 0 to (temp - 1) loop |
|> mat2(row)(col) <= (mat1(row)(tempc) + mat1(row)(tempc + 1)) / 2; |
|> mat2(row)(col + temp) <= (mat1(row)(tempc) - mat1(row)(tempc + 1)) /|
|> 2; |
|> tempc := tempc + 2; |
|> end loop; |
|> end loop; |
|> mat1 <= mat2; |
|> temp := temp/2; |
|> end loop; |
| |
|here temp = 4. |
|now it is simulating, earlier i had given only temp, when i changed to |
|temp - 1 in the for loop it works," |
|------------------------------------------------------------------------------|

Hello,

You have confused me. The code you had showed earlier had temp - 1 so
can you simulated the code I have quoted above?

|------------------------------------------------------------------------------|
|" but now, even though i had |
|initialized mat1 to contain 255, it does not show on the simulator, |
|and at the end of the simulation both mat1 and mat2 contain only zeroes" |
|------------------------------------------------------------------------------|

This surprises me for a simulation (which simulator are you using?),
but as synthesis tools will ignore an initialization (by which an
assignment at the declaration is meant, I am unsure whether your
unshown code really does that) it is a good idea to not rely on
initializations anyway.

Regards,
Colin Paul Gloster
 
On Jul 26, 5:59 pm, Colin Paul Gloster <Colin_Paul_Glos...@ACM.org>
wrote:
Innews:1185453861.663322.154380@x35g2000prf.googlegroups.com
timestamped Thu, 26 Jul 2007 05:44:21 -0700, mk.supr...@gmail.com
posted:
|--------------------------------------------------------------------------­----|
|"On Jul 26, 5:31 pm, mk.supr...@gmail.com wrote: |
|> hello, |
|> i am having a small problem with this pc of code, can anyone help me |
|> with it. |
|> during simulation i get an error - Index 8 out of bound 0 to 7 on line |
|> 4 |
|> |
|> for count in 0 to 2 loop |
|> for row in 0 to 7 loop |
|> tempc := 0; |
|> for col in 0 to (temp - 1) loop |
|> mat2(row)(col) <= (mat1(row)(tempc) + mat1(row)(tempc + 1)) / 2; |
|> mat2(row)(col + temp) <= (mat1(row)(tempc) - mat1(row)(tempc + 1)) /|
|> 2; |
|> tempc := tempc + 2; |
|> end loop; |
|> end loop; |
|> mat1 <= mat2; |
|> temp := temp/2; |
|> end loop; |
| |
|here temp = 4. |
|now it is simulating, earlier i had given only temp, when i changed to |
|temp - 1 in the for loop it works," |
|--------------------------------------------------------------------------­----|

Hello,

You have confused me. The code you had showed earlier had temp - 1 so
can you simulated the code I have quoted above?

|--------------------------------------------------------------------------­----|
|" but now, even though i had |
|initialized mat1 to contain 255, it does not show on the simulator, |
|and at the end of the simulation both mat1 and mat2 contain only zeroes" |
|--------------------------------------------------------------------------­----|

This surprises me for a simulation (which simulator are you using?),
but as synthesis tools will ignore an initialization (by which an
assignment at the declaration is meant, I am unsure whether your
unshown code really does that) it is a good idea to not rely on
initializations anyway.

Regards,
Colin Paul Gloster
i am using xilinx simulator. during synthesis i am planning to store
data onto the flash and then read from it. but as of now, to analyse
the problem i split the code, go thru this, now again i am getting
error index 8 out of bound 0 to 7
architecture Behavioral of test is
signal row1, row2: row;
begin
process is
variable tempc, temp: integer;
constant value1: integer := 255;
begin
for i in 0 to 7 loop
row1(i) <= value1;
end loop;
temp := 4;
tempc := 0;
for count in 0 to 2 loop
for i in 0 to (temp-1) loop
row2(i) <= (row1(tempc) + row1(tempc + 1))/2;
row2(i + temp) <= (row1(tempc) - row1(tempc + 1)) / 2;
tempc := tempc + 2;
end loop;
temp := temp/2;
end loop;
half <= row2;
wait for 1 ns;
end process;
end Behavioral;
 
mk.supriya@gmail.com wrote:

i am using xilinx simulator.
Consider trying the xilinx oem modelsim simulator.
-- Mike Treseler
 
On Jul 26, 6:47 pm, Mike Treseler <mike_trese...@comcast.net> wrote:
mk.supr...@gmail.com wrote:
i am using xilinx simulator.

Consider trying the xilinx oem modelsim simulator.
-- Mike Treseler
i have to license that
 
Hello MK,

I see that you found your index problem.

I think you should post all of your code.
I can't figure out what you are trying
to do. Is it top secret?

Can we assume that you are using the free
Xilinx web package. And are you using the
Xilinx simulator or ModelSimXE?

Part of your problem might be that when you
make an <= signal assignment, this schedules
a change in the signal at a future time. If
you make another schedule that overwrites it,
then the first assignment is nullified.

I would put a "wait for 5 ns" in your inner
most loop. So you can see the simulation as
it unfolds.

Brad Smallridge
AiVision

<mk.supriya@gmail.com> wrote in message
news:1185453861.663322.154380@x35g2000prf.googlegroups.com...
On Jul 26, 5:31 pm, mk.supr...@gmail.com wrote:
hello,
i am having a small problem with this pc of code, can anyone help me
with it.
during simulation i get an error - Index 8 out of bound 0 to 7 on line
4

for count in 0 to 2 loop
for row in 0 to 7 loop
tempc := 0;
for col in 0 to (temp - 1) loop
mat2(row)(col) <= (mat1(row)(tempc) + mat1(row)(tempc + 1)) / 2;
mat2(row)(col + temp) <= (mat1(row)(tempc) - mat1(row)(tempc +
1)) /
2;
tempc := tempc + 2;
end loop;
end loop;
mat1 <= mat2;
temp := temp/2;
end loop;

here temp = 4.
now it is simulating, earlier i had given only temp, when i changed to
temp - 1 in the for loop it works, but now, even though i had
initialized mat1 to contain 255, it does not show on the simulator,
and at the end of the simulation both mat1 and mat2 contain only zeroes
 
On Jul 26, 11:15 pm, "Brad Smallridge" <bradsmallri...@dslextreme.com>
wrote:
Hello MK,

I see that you found your index problem.

I think you should post all of your code.
I can't figure out what you are trying
to do. Is it top secret?

Can we assume that you are using the free
Xilinx web package. And are you using the
Xilinx simulator or ModelSimXE?

Part of your problem might be that when you
make an <= signal assignment, this schedules
a change in the signal at a future time. If
you make another schedule that overwrites it,
then the first assignment is nullified.

I would put a "wait for 5 ns" in your inner
most loop. So you can see the simulation as
it unfolds.

Brad Smallridge
AiVision

mk.supr...@gmail.com> wrote in message

news:1185453861.663322.154380@x35g2000prf.googlegroups.com...



On Jul 26, 5:31 pm, mk.supr...@gmail.com wrote:
hello,
i am having a small problem with this pc of code, can anyone help me
with it.
during simulation i get an error - Index 8 out of bound 0 to 7 on line
4

for count in 0 to 2 loop
for row in 0 to 7 loop
tempc := 0;
for col in 0 to (temp - 1) loop
mat2(row)(col) <= (mat1(row)(tempc) + mat1(row)(tempc + 1)) / 2;
mat2(row)(col + temp) <= (mat1(row)(tempc) - mat1(row)(tempc +
1)) /
2;
tempc := tempc + 2;
end loop;
end loop;
mat1 <= mat2;
temp := temp/2;
end loop;

here temp = 4.
now it is simulating, earlier i had given only temp, when i changed to
temp - 1 in the for loop it works, but now, even though i had
initialized mat1 to contain 255, it does not show on the simulator,
and at the end of the simulation both mat1 and mat2 contain only zeroes- Hide quoted text -

- Show quoted text -
i found a way out. i do have a licensed version of xilinx, and have a
license for modelsim xe but i havent set it up as yet.
the problem was:
i should have put tempc := 0 imediately after the first loop started,
now my haar twavelet ransformation works. thanks.
 

Welcome to EDABoard.com

Sponsor

Back
Top