Velocity Reviews > VHDL > please help me with this pc of code

please help me with this pc of code

mk.supriya@gmail.com
Guest
Posts: n/a

 07-31-2007
hello,
please go through the following code and tell me where i am wrong.
this is a FOR loop to do some arithmetic operations on a matrix.
instead of the outermost loop(j), if i assign, 0, 1, 2...etc manually,
i am able to get the desired result, but when i run this loop, only
1st row gets the right values. remaining rows, get some very high
values

for j in 0 to 2 loop
temp := 1;
row1 := hm1(j); -- here if i put 0, 1, w/o j loop, correct result
for count in 0 to 2 loop
col := 0;
tempc := 0;
while ( col < (temp * 2)) loop
row2(col) := row1(tempc) + row1(tempc + temp);
row2(col + 1) := row1(tempc) - row1(tempc + temp);
tempc := tempc + 1;
col := col + 2;
end loop;
row1 := row2;
temp := temp * 2;
end loop;
hm2(j):= row2;-- here if i put 0, 1, w/o j loop, correct result
end loop;

Andy
Guest
Posts: n/a

 07-31-2007
On Jul 31, 7:15 am, (E-Mail Removed) wrote:
> hello,
> please go through the following code and tell me where i am wrong.
> this is a FOR loop to do some arithmetic operations on a matrix.
> instead of the outermost loop(j), if i assign, 0, 1, 2...etc manually,
> i am able to get the desired result, but when i run this loop, only
> 1st row gets the right values. remaining rows, get some very high
> values
>
> for j in 0 to 2 loop
> temp := 1;
> row1 := hm1(j); -- here if i put 0, 1, w/o j loop, correct result
> for count in 0 to 2 loop
> col := 0;
> tempc := 0;
> while ( col < (temp * 2)) loop
> row2(col) := row1(tempc) + row1(tempc + temp);
> row2(col + 1) := row1(tempc) - row1(tempc + temp);
> tempc := tempc + 1;
> col := col + 2;
> end loop;
> row1 := row2;
> temp := temp * 2;
> end loop;
> hm2(j):= row2;-- here if i put 0, 1, w/o j loop, correct result
> end loop;

Please read the documentation for your simulator and learn how to use
break points, monitors, etc. in your simulation.

Otherwise, instrument your code with assert and/or report statements
to tell you what's going on as the code executes.

These are basic code debugging skills that will serve you well in the
future.

Andy

mk.supriya@gmail.com
Guest
Posts: n/a

 07-31-2007
On Jul 31, 6:10 pm, Andy <(E-Mail Removed)> wrote:
> On Jul 31, 7:15 am, (E-Mail Removed) wrote:
>
>
>
>
>
> > hello,
> > please go through the following code and tell me where i am wrong.
> > this is a FOR loop to do some arithmetic operations on a matrix.
> > instead of the outermost loop(j), if i assign, 0, 1, 2...etc manually,
> > i am able to get the desired result, but when i run this loop, only
> > 1st row gets the right values. remaining rows, get some very high
> > values

>
> > for j in 0 to 2 loop
> > temp := 1;
> > row1 := hm1(j); -- here if i put 0, 1, w/o j loop, correct result
> > for count in 0 to 2 loop
> > col := 0;
> > tempc := 0;
> > while ( col < (temp * 2)) loop
> > row2(col) := row1(tempc) + row1(tempc + temp);
> > row2(col + 1) := row1(tempc) - row1(tempc + temp);
> > tempc := tempc + 1;
> > col := col + 2;
> > end loop;
> > row1 := row2;
> > temp := temp * 2;
> > end loop;
> > hm2(j):= row2;-- here if i put 0, 1, w/o j loop, correct result
> > end loop;

>
> Please read the documentation for your simulator and learn how to use
> break points, monitors, etc. in your simulation.

thanks. i was applying breakpoints and stepping through the code, but
now i realised that unless i give a wait statement i am not able to
view the output on my simulation window.
now i am getting the right output

 Thread Tools

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are Off Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post casioculture@gmail.com Java 4 05-05-2005 08:24 AM MuZZy C++ 7 01-07-2005 08:40 PM Nick Computer Support 0 06-04-2004 08:49 PM tpg comcntr Computer Support 11 02-15-2004 06:22 PM KK C++ 2 10-14-2003 02:08 PM

Advertisments