Assigning entire row in a 2d array?

Discussion in 'VHDL' started by Tricky, Aug 28, 2009.

  1. Tricky

    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, Aug 28, 2009
    #1
    1. Advertising

  2. Tricky

    h.e. Guest

    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)); ?
     
    h.e., Aug 28, 2009
    #2
    1. Advertising

  3. Tricky

    Tricky Guest

    On Aug 28, 10:56 am, "h.e." <> 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.
     
    Tricky, Aug 28, 2009
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Peter
    Replies:
    0
    Views:
    501
    Peter
    Sep 9, 2004
  2. Adam The Generic

    setting entire row as a hyperlink

    Adam The Generic, Apr 4, 2009, in forum: ASP .Net
    Replies:
    1
    Views:
    346
    imransyed63
    Apr 5, 2009
  3. D
    Replies:
    0
    Views:
    256
  4. Replies:
    7
    Views:
    122
    James Edward Gray II
    Jul 4, 2005
  5. weston
    Replies:
    1
    Views:
    279
    Richard Cornford
    Sep 22, 2006
Loading...

Share This Page