Go Back   Velocity Reviews > Newsgroups > VHDL
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

VHDL - How to do the shift bit operation in Array

 
Thread Tools Search this Thread
Old 01-25-2007, 12:01 AM   #1
Default How to do the shift bit operation in Array


type B_Matrix is array (0 to 3) of std_logic_vector(15 downto 0);
signal MatrixB : B_Matrix :=(others =>(others=>'0'));

For example MatrixB has some values {"1000001010101010",
"1000001010111010",..........}

Now I want to get the first bit of MatrixB(2) to give variable ad like
that: ad := MatrixB(2, 15); It doesn't work. Sounds like I use the
wrong grammar. Does anybody know how to do that.

One more thing, Can I do the operation like :

d2Rkk is signed(17 downto 0):= (others=>'0');

d2Rkk (12 downto 0) :=signed(MatrixR(2, 15 downto 3));

It looks like if the variable is an array type, the element of the
array cannot do the normal operation as if they are independent ones. I
mean if MatrixR is std_logic_vector (15 downto 3), I can just do d2Rkk
(12 downto 0) :=signed(MatrixR( 15 downto 3)); Where I can find some
examples for array operations ? Thanks.



ZHIQUAN
  Reply With Quote
Old 01-25-2007, 12:22 AM   #2
Andy
 
Posts: n/a
Default Re: How to do the shift bit operation in Array
You index an array of arrays (slv is an array) as MatrixB(2)(15), not
(2,15).
Two-dimensional arrays are allowed in vhdl, but not synthesizable.
Arrays of arrays are allowed and synthesizable.

Andy

On Jan 24, 6:01 pm, "ZHIQUAN" <threeinchn...@gmail.com> wrote:
> type B_Matrix is array (0 to 3) of std_logic_vector(15 downto 0);
> signal MatrixB : B_Matrix :=(others =>(others=>'0'));
>
> For example MatrixB has some values {"1000001010101010",
> "1000001010111010",..........}
>
> Now I want to get the first bit of MatrixB(2) to give variable ad like
> that: ad := MatrixB(2, 15); It doesn't work. Sounds like I use the
> wrong grammar. Does anybody know how to do that.
>
> One more thing, Can I do the operation like :
>
> d2Rkk is signed(17 downto 0):= (others=>'0');
>
> d2Rkk (12 downto 0) :=signed(MatrixR(2, 15 downto 3));
>
> It looks like if the variable is an array type, the element of the
> array cannot do the normal operation as if they are independent ones. I
> mean if MatrixR is std_logic_vector (15 downto 3), I can just do d2Rkk
> (12 downto 0) :=signed(MatrixR( 15 downto 3)); Where I can find some
> examples for array operations ? Thanks.




Andy
  Reply With Quote
Old 01-25-2007, 12:44 AM   #3
Rob Dekker
 
Posts: n/a
Default Re: How to do the shift bit operation in Array

"Andy" <> wrote in message news: ups.com...
....
> Two-dimensional arrays are allowed in vhdl, but not synthesizable.
> Arrays of arrays are allowed and synthesizable.


Multi-dimensional arrays in VHDL should be synthesizable.
Which tool did you find that does not support that ?

Rob




Rob Dekker
  Reply With Quote
Old 01-25-2007, 04:23 PM   #4
Andy
 
Posts: n/a
Default Re: How to do the shift bit operation in Array
To be honest, I have not tried multidimensional arrays in a long time,
but synplicity did not support it, and I don't think they do now. Have
you found any that do?

I always use arrays of arrays (of arrays of...) . It gives you more
flexibility anyway.

matrix(2)(15 downto <= a_byte;

matrix(3 downto 1) <= three_words;

matrix(3 downto 1)(15 downto <= no_worky; -- three_bytes won't work

Those operations don't work with multidimensional arrays.

Besides, any multidimensional array can be represented as an array of
arrays (of...).

Andy

On Jan 24, 6:44 pm, "Rob Dekker" <r...@verific.com> wrote:
> "Andy" <jonesa...@comcast.net> wrote in messagenews: oglegroups.com......
>
> > Two-dimensional arrays are allowed in vhdl, but not synthesizable.
> > Arrays of arrays are allowed and synthesizable.Multi-dimensional arrays in VHDL should be synthesizable.

> Which tool did you find that does not support that ?
>
> Rob




Andy
  Reply With Quote
Old 01-25-2007, 08:11 PM   #5
ZHIQUAN
 
Posts: n/a
Default Re: How to do the shift bit operation in Array

So I cannot use it like MatrixA((17) <=MatrixB(1)(15) ?Error: parse
error, unexpected COLON

On 25 Jan, 16:23, "Andy" <jonesa...@comcast.net> wrote:
> To be honest, I have not tried multidimensional arrays in a long time,
> but synplicity did not support it, and I don't think they do now. Have
> you found any that do?
>
> I always use arrays of arrays (of arrays of...) . It gives you more
> flexibility anyway.
>
> matrix(2)(15 downto <= a_byte;
>
> matrix(3 downto 1) <= three_words;
>
> matrix(3 downto 1)(15 downto <= no_worky; -- three_bytes won't work
>
> Those operations don't work with multidimensional arrays.
>
> Besides, any multidimensional array can be represented as an array of
> arrays (of...).
>
> Andy
>
> On Jan 24, 6:44 pm, "Rob Dekker" <r...@verific.com> wrote:
>
>
>
> > "Andy" <jonesa...@comcast.net> wrote in messagenews: oglegroups.com......

>
> > > Two-dimensional arrays are allowed in vhdl, but not synthesizable.
> > > Arrays of arrays are allowed and synthesizable.Multi-dimensional arrays in VHDL should be synthesizable.

> > Which tool did you find that does not support that ?

>
> > Rob- Hide quoted text -- Show quoted text -




ZHIQUAN
  Reply With Quote
Old 01-25-2007, 09:37 PM   #6
ZHIQUAN
 
Posts: n/a
Default Re: How to do the shift bit operation in Array
I cannot do like this: MatrixA(0 to 3)(17 downto 16)<= (others=>
MatrixB(0 to 3)(15));

MatrixA is array(integer range 0 to 3) of std_logic_vector (17 downto
0);
MatrixB is array(integer range 0 to 3) of std_logic_vector(15 downto
0);

Besides, I cannot use ":" to replace (0 to 3).



ZHIQUAN
  Reply With Quote
Old 01-25-2007, 09:50 PM   #7
Rob Dekker
 
Posts: n/a
Default Re: How to do the shift bit operation in Array

"Andy" <> wrote in message news: oups.com...
> To be honest, I have not tried multidimensional arrays in a long time,
> but synplicity did not support it, and I don't think they do now. Have
> you found any that do?


Yes. Leonardo for sure. I wrote the synthesizer for it.
And Quartus II does, since is has a Verific front-end.
I would be surprised if Synplicity does not support it (at least now)

>
> I always use arrays of arrays (of arrays of...) . It gives you more
> flexibility anyway.
>
> matrix(2)(15 downto <= a_byte;
>
> matrix(3 downto 1) <= three_words;
>
> matrix(3 downto 1)(15 downto <= no_worky; -- three_bytes won't work
>
> Those operations don't work with multidimensional arrays.
>
> Besides, any multidimensional array can be represented as an array of
> arrays (of...).



You are right. Array-of-array has everything that 2-dim array has, and more.
I don't know why they even introduced the concept (of multi-dim arrays).
But is is there in the language, so tools should support it.

Rob




Rob Dekker
  Reply With Quote
Old 01-25-2007, 09:57 PM   #8
Rob Dekker
 
Posts: n/a
Default Re: How to do the shift bit operation in Array

"ZHIQUAN" <> wrote in message news: oups.com...
>I cannot do like this: MatrixA(0 to 3)(17 downto 16)<= (others=>
> MatrixB(0 to 3)(15));
>
> MatrixA is array(integer range 0 to 3) of std_logic_vector (17 downto
> 0);
> MatrixB is array(integer range 0 to 3) of std_logic_vector(15 downto
> 0);


So you want to assign a few bits of each of the 4 elements of MatrixA
You cannot do that with the 0 to 3 slice as far as I know.
Please use a for-loop.

>
> Besides, I cannot use ":" to replace (0 to 3).
>


What made you think that the ":" does anything other than give you a syntax error ?





Rob Dekker
  Reply With Quote
Old 01-26-2007, 06:45 PM   #9
Mike Treseler
 
Posts: n/a
Default Re: How to do the shift bit operation in Array
Rob Dekker wrote:

> Yes. Leonardo for sure. I wrote the synthesizer for it.


Congratulations.
That's the first synthesizer I used that
really covered VHDL-87.

> And Quartus II does, since is has a Verific front-end.


Interesting. Do you think the register duplication
issue we discussed in another thread could ever be fixed
in the front end, or will that always have to be
taken out by the fitter?

-- Mike Treseler




Mike Treseler
  Reply With Quote
Old 01-26-2007, 10:01 PM   #10
Rob Dekker
 
Posts: n/a
Default Re: How to do the shift bit operation in Array

"Mike Treseler" <> wrote in message news:...
> Rob Dekker wrote:
>
>> Yes. Leonardo for sure. I wrote the synthesizer for it.

>
> Congratulations.
> That's the first synthesizer I used that
> really covered VHDL-87.


Thanks !
The first implementation I did was quite terrible (back in '91-92), but after two rewrites it got pretty good..
Those were the days..

>
>> And Quartus II does, since is has a Verific front-end.

>
> Interesting. Do you think the register duplication
> issue we discussed in another thread could ever be fixed
> in the front end, or will that always have to be
> taken out by the fitter?


I am sorry Mike. Which thread was that ?

>
> -- Mike Treseler
>
>





Rob Dekker
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
VHDL sll shift question ohaqqi Hardware 4 09-29-2009 11:27 AM
constants as of array of integers, for loops octavsly Hardware 0 04-25-2009 11:53 AM
How to retrieve array parameter ( JAVA ) naruponk Software 1 04-16-2009 10:20 AM
Array Programme rits Software 2 03-04-2009 05:18 PM
need help Invalid length for a Base-64 char array rrwestva Hardware 0 07-04-2006 09:36 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46