Assigning entire row in a 2d array?

T

Tricky

Guest
Now, if I had made an array of arrays like this:

type array1_t is array(0 to 9) of integer;
type array2_t is array(0 to 9) of array1_t;

variable A : array2_t;

I can do assignments like this:

A(1) := (others => 0);

now, if I do this instead

type array_t is array(0 to 9, 0 to 9) of integer;

is there anyway I can do something similar to above (neat and tidy)?
or do I have to do it inside a for loop (a little annoying)?
 
Tricky schrieb:
Now, if I had made an array of arrays like this:

type array1_t is array(0 to 9) of integer;
type array2_t is array(0 to 9) of array1_t;

variable A : array2_t;

I can do assignments like this:

A(1) := (others => 0);

now, if I do this instead

type array_t is array(0 to 9, 0 to 9) of integer;

is there anyway I can do something similar to above (neat and tidy)?
or do I have to do it inside a for loop (a little annoying)?
have you tried A := (others=>(others=>0)); ?
 
On Fri, 28 Aug 2009 02:10:03 -0700 (PDT), Tricky
<trickyhead@gmail.com> wrote:

Now, if I had made an array of arrays like this:

type array1_t is array(0 to 9) of integer;
type array2_t is array(0 to 9) of array1_t;

variable A : array2_t;

I can do assignments like this:

A(1) := (others => 0);

now, if I do this instead

type array_t is array(0 to 9, 0 to 9) of integer;

is there anyway I can do something similar to above (neat and tidy)?
or do I have to do it inside a for loop (a little annoying)?
Yes, you need the loop.

The big advantage of true 2-d arrays such as (0 to 9, 0 to 9)
is that BOTH dimensions can be unconstrained. The big
disadvantage is that they don't really have rows or columns.
However, functions and procedures can smooth out those
wrinkles easily enough.
--
Jonathan Bromley, Consultant

DOULOS - Developing Design Know-how
VHDL * Verilog * SystemC * e * Perl * Tcl/Tk * Project Services

Doulos Ltd., 22 Market Place, Ringwood, BH24 1AW, UK
jonathan.bromley@MYCOMPANY.com
http://www.MYCOMPANY.com

The contents of this message may contain personal views which
are not the views of Doulos Ltd., unless specifically stated.
 
On Aug 28, 10:56 am, "h.e." <h...@thisisnovalidaddress.net> wrote:
Tricky schrieb:



Now, if I had made an array of arrays like this:

type array1_t is array(0 to 9) of integer;
type array2_t is array(0 to 9) of array1_t;

variable A : array2_t;

I can do assignments like this:

A(1) := (others => 0);

now, if I do this instead

type array_t is array(0 to 9, 0 to 9) of integer;

is there anyway I can do something similar to above (neat and tidy)?
or do I have to do it inside a for loop (a little annoying)?

have you tried A := (others=>(others=>0)); ?
That wont work, you'd have to do A := (others =>0) and that would
assign the entire 2d array.

I just want to assign a single row to 0, not every element.
 

Welcome to EDABoard.com

Sponsor

Back
Top