Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   VHDL (http://www.velocityreviews.com/forums/f18-vhdl.html)
-   -   Re: Nested For Loop incrementation (http://www.velocityreviews.com/forums/t21375-re-nested-for-loop-incrementation.html)

Ralf Hildebrandt 07-02-2003 02:24 PM

Re: Nested For Loop incrementation
 
Hi Aaron!


> pair_arrayC : FOR col IN 0 TO row_length GENERATE
> CONSTANT pair_inc : INTEGER := pair_inc + 1; --This, of course,
> is wrong
> --but the type of
> thing I'd
> --like to do.



If "pair_inc" only depends on the iteration of the for-loop, the
for-variable "col" ist nearly the same like "pair_inc". -> You can use a
(linear) derivative X*col+Y instead:

Ao(X*col+Y) <= A(row);

where X, Y are constants.

Ralf


Egbert Molenkamp 07-02-2003 03:05 PM

Re: Nested For Loop incrementation
 
I think the 'distance' between the rows is not a constant.
The distance between the same column positions of row 0
and row 1 is 7, between row 1 and row 2 is 6, etc.

Maybe the following function handles the problem.
My synthesis tool has no problem with it.

FUNCTION index(row,col : IN integer) RETURN integer IS
TYPE int_arr_tp IS ARRAY (0 TO 6) OF integer;
CONSTANT lut : int_arr_tp := (0,7,13,18,22,25,27);
BEGIN
RETURN lut(row)+col;
END index;
BEGIN
pair_arrayR : FOR row IN 0 TO 6 GENERATE
CONSTANT row_length : NATURAL := 6 - row;
BEGIN
pair_arrayC : FOR col IN 0 TO row_length GENERATE
BEGIN
AB_Cells : IF (row<4) AND (col<4) GENERATE
Ao(index(row,col)) <= A(row);
Bo(index(row,col)) <= B(3-col);
END GENERATE AB_Cells;
etc.

Egbert Molenkamp


"Ralf Hildebrandt" <Ralf-Hildebrandt@gmx.de> wrote in message
news:bdurgt$10vlhh$4@ID-8609.news.dfncis.de...
> Hi Aaron!
>
>
> > pair_arrayC : FOR col IN 0 TO row_length GENERATE
> > CONSTANT pair_inc : INTEGER := pair_inc + 1; --This, of course,
> > is wrong
> > --but the type of
> > thing I'd
> > --like to do.

>
>
> If "pair_inc" only depends on the iteration of the for-loop, the
> for-variable "col" ist nearly the same like "pair_inc". -> You can use a
> (linear) derivative X*col+Y instead:
>
> Ao(X*col+Y) <= A(row);
>
> where X, Y are constants.
>
> Ralf
>




Aaron McFarland 07-02-2003 06:50 PM

Re: Nested For Loop incrementation
 
> If "pair_inc" only depends on the iteration of the for-loop, the
> for-variable "col" ist nearly the same like "pair_inc". -> You can use a
> (linear) derivative X*col+Y instead:
>
> Ao(X*col+Y) <= A(row);


Ralf,
Thanks for the reply. It is true that pair_inc can be calculated from
only "row" and "col", but I think the equations are an iterative
summation (or subtraction) looking something like this for each row:

col + 7*row <-- Row 0
col + 7*row 0 <-- Row 1
col + 7*row 1 <-- Row 2
col + 7*row - 2 1 <-- Row 3
col + 7*row 3 - 2 1 <-- Row 4
col + 7*row 4 3 2 1 <-- Row 5
col + 7*row 5 - 4 3 2 1 <-- Row 6

This would create the following values for pair_inc that correspond to
the combinations in the first post.

Col
0 1 2 3 4 5 6
Row --------------------
0 | 0 1 2 3 4 5 6
1 | 7 8 9 10 11 12
2 |13 14 15 16 17
3 |18 19 20 21
4 |22 23 24
5 |25 26
6 |27

Actually, they do not even really need to be in that order, but just
cover 0 to 27 with no bits missing. I need pair_inc to increment for
each iteration of Row *and* Col, not just Col.

--Aaron

Aaron McFarland 07-03-2003 12:28 AM

Re: Nested For Loop incrementation
 
> I think the 'distance' between the rows is not a constant.
> The distance between the same column positions of row 0
> and row 1 is 7, between row 1 and row 2 is 6, etc.


Yes, that is the problem better explained ;-)

> Maybe the following function handles the problem.
> My synthesis tool has no problem with it.
>
> FUNCTION index(row,col : IN integer) RETURN integer IS
> TYPE int_arr_tp IS ARRAY (0 TO 6) OF integer;
> CONSTANT lut : int_arr_tp := (0,7,13,18,22,25,27);
> BEGIN
> RETURN lut(row)+col;
> END index;
>
> Egbert Molenkamp


Ah, I hadn't thought of a look up table. I think this should work,
I'll try it as soon as I get a chance tomorrow.

Thanks,
Aaron


All times are GMT. The time now is 04:28 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.