A
Alex Rast
Guest
I'm trying to determine how you can associate a definite size to type you
want to declare as a nested array (that is, an array of arrays). I can have
a type declared as:
type inner_array is array (natural range <> of {element type};
then I declare the nested array:
type outer_array is array (natural range <> of inner_array;
Now if I want to use this type, I would have thought you could make a
declaration like :
signal actual_matrix : outer_array(specific_bit_width1 downto 0)
(specific_bit_width2 downto 0);
but this doesn't work. The compiler seems to want to see the outer array
fixed association, but not the inner array. So how would I declare the
signal so as to associate the desired inner array size?
To make this more concrete, the position is that I (would like to) have a
generic bus arbiter that can switch any of m busses of any width n. So, it
would seem to me natural to define a type : std_logic_tensor as an array of
std_logic_vector. Then the port clause in the entity declaration might look
something like this:
entity genericarbiter is
port(
Input_matrix : in std_logic_tensor;
Output_matrix : out std_logic_tensor;
...)
end entity;
Now I want to use a bus arbiter in a design. So I declare the component.
But now, once in this design, my bit-width and number of busses is fixed.
Let's say my word size is 32 and I have 8 busses. I'd want to declare the
component like this:
component genericarbiter
port(
Input_matrix : in std_logic_tensor(7 downto 0)(31 downto 0)
' Output_matrix : in std_logic_tensor(7 downto 0)(31 downto 0)
...);
end component;
except, of course, as I've noted above, the compiler chokes. How do I make
the declaration so that it actually works? Although it breaks the idea of
what I'm trying to achieve, I tried making the fixed-width port
declarations in the entity declaration, and the compiler still complained,
in the same way. So I can be pretty certain that it's the indexing method
that's screwed up.
--
Alex Rast
ad.rast.7@nwnotlink.NOSPAM.com
(remove d., .7, not, and .NOSPAM to reply)
want to declare as a nested array (that is, an array of arrays). I can have
a type declared as:
type inner_array is array (natural range <> of {element type};
then I declare the nested array:
type outer_array is array (natural range <> of inner_array;
Now if I want to use this type, I would have thought you could make a
declaration like :
signal actual_matrix : outer_array(specific_bit_width1 downto 0)
(specific_bit_width2 downto 0);
but this doesn't work. The compiler seems to want to see the outer array
fixed association, but not the inner array. So how would I declare the
signal so as to associate the desired inner array size?
To make this more concrete, the position is that I (would like to) have a
generic bus arbiter that can switch any of m busses of any width n. So, it
would seem to me natural to define a type : std_logic_tensor as an array of
std_logic_vector. Then the port clause in the entity declaration might look
something like this:
entity genericarbiter is
port(
Input_matrix : in std_logic_tensor;
Output_matrix : out std_logic_tensor;
...)
end entity;
Now I want to use a bus arbiter in a design. So I declare the component.
But now, once in this design, my bit-width and number of busses is fixed.
Let's say my word size is 32 and I have 8 busses. I'd want to declare the
component like this:
component genericarbiter
port(
Input_matrix : in std_logic_tensor(7 downto 0)(31 downto 0)
' Output_matrix : in std_logic_tensor(7 downto 0)(31 downto 0)
...);
end component;
except, of course, as I've noted above, the compiler chokes. How do I make
the declaration so that it actually works? Although it breaks the idea of
what I'm trying to achieve, I tried making the fixed-width port
declarations in the entity declaration, and the compiler still complained,
in the same way. So I can be pretty certain that it's the indexing method
that's screwed up.
--
Alex Rast
ad.rast.7@nwnotlink.NOSPAM.com
(remove d., .7, not, and .NOSPAM to reply)