Multidimentional arrays of std_logic

Discussion in 'VHDL' started by willem, Feb 15, 2005.

  1. willem

    willem Guest

    I have declared in a package:

    type Silly_In is array (natural range <>) of std_logic_vector;

    I want to use generics in a entity to define the ranges:

    entity test_Gates is
    generic
    ( InBits : integer := 3
    );
    port
    ( clk : in std_logic;
    Din : in Silly_In(2**Inbits-1 downto 0)(Inbits-1 downto 0); --??????
    Q : out std_logic_vector(2**Inbits-1 downto 0)
    );
    end test_Gates;

    The Din line gives errors. How do I code it correctly so that Din is a
    array (255 downto 0) of std_logic_vector(2 downto 0) ? or I will want to
    try for different InBits sizes.


    --
    Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
    willem, Feb 15, 2005
    #1
    1. Advertising

  2. willem

    willem Guest

    Small mistake:

    > How do I code it correctly so that Din is a array (255 downto 0) of
    > std_logic_vector(2 downto 0) ?


    Should be:

    How do I code it correctly so that Din is a
    array (7 downto 0) of std_logic_vector(2 downto 0) ?

    On Tue, 15 Feb 2005 15:17:33 +0200, willem <> wrote:

    > I have declared in a package:
    >
    > type Silly_In is array (natural range <>) of std_logic_vector;
    >
    > I want to use generics in a entity to define the ranges:
    >
    > entity test_Gates is
    > generic
    > ( InBits : integer := 3
    > );
    > port
    > ( clk : in std_logic;
    > Din : in Silly_In(2**Inbits-1 downto 0)(Inbits-1 downto 0);
    > --??????
    > Q : out std_logic_vector(2**Inbits-1 downto 0)
    > );
    > end test_Gates;
    >
    > The Din line gives errors. How do I code it correctly so that Din is a
    > array (255 downto 0) of std_logic_vector(2 downto 0) ? or I will want to
    > try for different InBits sizes.
    >
    >




    --
    Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
    willem, Feb 15, 2005
    #2
    1. Advertising

  3. willem

    cristian Guest

    Willem,

    I'd declare the type in the pacakge as:

    constant Inbits: constant:=3;
    type Silly_In is array (2**Inbits-1 downto 0) of
    std_logic_vector(Inbits-1 downto 0); --

    and use the Silly_In type in the entity for both Din and Q.

    regards,

    cristian



    willem wrote:
    > Small mistake:
    >
    > > How do I code it correctly so that Din is a array (255 downto 0) of


    > > std_logic_vector(2 downto 0) ?

    >
    > Should be:
    >
    > How do I code it correctly so that Din is a
    > array (7 downto 0) of std_logic_vector(2 downto 0) ?
    >
    > On Tue, 15 Feb 2005 15:17:33 +0200, willem <> wrote:
    >
    > > I have declared in a package:
    > >
    > > type Silly_In is array (natural range <>) of std_logic_vector;
    > >
    > > I want to use generics in a entity to define the ranges:
    > >
    > > entity test_Gates is
    > > generic
    > > ( InBits : integer := 3
    > > );
    > > port
    > > ( clk : in std_logic;
    > > Din : in Silly_In(2**Inbits-1 downto 0)(Inbits-1 downto 0);
    > > --??????
    > > Q : out std_logic_vector(2**Inbits-1 downto 0)
    > > );
    > > end test_Gates;
    > >
    > > The Din line gives errors. How do I code it correctly so that Din

    is a
    > > array (255 downto 0) of std_logic_vector(2 downto 0) ? or I will

    want to
    > > try for different InBits sizes.
    > >
    > >

    >
    >
    >
    > --
    > Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
    cristian, Feb 15, 2005
    #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. Replies:
    1
    Views:
    391
    Victor Bazarov
    Jan 24, 2005
  2. vertigo
    Replies:
    1
    Views:
    240
    Mathias Panzenboeck
    Dec 10, 2006
  3. cedric
    Replies:
    2
    Views:
    316
    Michael Mair
    Dec 30, 2004
  4. Bangalore

    multidimentional array

    Bangalore, Sep 27, 2005, in forum: C++
    Replies:
    7
    Views:
    375
    Marcus Kwok
    Oct 6, 2005
  5. Sébastien Cottalorda

    IPC::Shareable Problem with multidimentional hash

    Sébastien Cottalorda, Sep 9, 2005, in forum: Perl Misc
    Replies:
    8
    Views:
    210
    Sébastien Cottalorda
    Sep 13, 2005
Loading...

Share This Page