Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > matrix vs vector

Reply
Thread Tools

matrix vs vector

 
 
Salvatore Callea
Guest
Posts: n/a
 
      07-02-2004
I've defined:

type std_logic_matrix is array (natural range <>, natural range <>) of
std_logic;


and:

signal a : std_logic_vector(31 downto 0);
signal b : std_logic_matrix(1 to 10, 31 downto 0);


Why Modelsim report an error during compilation if I assign:

a <= b(3, 31 downto 0);

Is it posible to assign a std_logic_vector with a slice of a
std_logic_matrix in a more compact way than this:

a(0) <= b(3, 0);
a(1) <= b(3, 1);
...
a(31) <= b(3, 31);


thanks in advance: Salvatore
 
Reply With Quote
 
 
 
 
Just an Illusion
Guest
Posts: n/a
 
      07-02-2004
Hi Salvatore,

I have not try but perhaps with

a <= b(3)(31 downto 0);


JaI

Salvatore Callea wrote:

>I've defined:
>
> type std_logic_matrix is array (natural range <>, natural range <>) of
>std_logic;
>
>
>and:
>
> signal a : std_logic_vector(31 downto 0);
> signal b : std_logic_matrix(1 to 10, 31 downto 0);
>
>
>Why Modelsim report an error during compilation if I assign:
>
> a <= b(3, 31 downto 0);
>
>Is it posible to assign a std_logic_vector with a slice of a
>std_logic_matrix in a more compact way than this:
>
> a(0) <= b(3, 0);
> a(1) <= b(3, 1);
> ...
> a(31) <= b(3, 31);
>
>
>thanks in advance: Salvatore
>
>


 
Reply With Quote
 
 
 
 
Nicolas Matringe
Guest
Posts: n/a
 
      07-02-2004
Just an Illusion a écrit:
> Hi Salvatore,
>
> I have not try but perhaps with
>
> a <= b(3)(31 downto 0);


Nope, won't work either.
A matrix is not an array of vectors so you can't assign a matrix line to
a standard_logic_vector.
You can use a loop (inside a process):

process(b, index)
begin
for i in matrix'range loop -- there is a way to specify "2nd range"
a(i) <= b(index)(i); -- but I forgot it
end loop;
end process;

--
____ _ __ ___
| _ \_)/ _|/ _ \ Adresse de retour invalide: retirez le -
| | | | | (_| |_| | Invalid return address: remove the -
|_| |_|_|\__|\___/

 
Reply With Quote
 
Tuukka Toivonen
Guest
Posts: n/a
 
      07-02-2004
In article <Xns951A8EEEB9228calleaslabenit@130.133.1.4>, Salvatore Callea wrote:
> signal a : std_logic_vector(31 downto 0);
> signal b : std_logic_matrix(1 to 10, 31 downto 0);


Another way to solve this is to change a matrix into array of vectors
something like this:

subtype addr_t is std_ulogic_vector(7 downto 0);
type addr_vector_t is array (integer range <>) of addr_t;
signal ramx_ar : addr_vector_t(0 to 7);

signal x: addr_t;

then this should work:

x <= ramx_ar(4);

You can't synthesize matrices anyway, so that would be another
reason to use "array of vectors" instead of matrix.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Matrix*Vector and Vector*Matrix Holgerson C++ 3 10-26-2007 07:38 AM
const vector<A> vs vector<const A> vs const vector<const A> Javier C++ 2 09-04-2007 08:46 PM
Initializing vector<vector<int> > and other vector questions... pmatos C++ 6 04-26-2007 05:39 PM
Free memory allocate by a STL vector, vector of vector, map of vector Allerdyce.John@gmail.com C++ 8 02-18-2006 12:48 AM
how the vector is created, how to pass vector to webservices method apachesoap:Vector Rushikesh Joshi Perl Misc 0 07-10-2004 01:04 PM



Advertisments