VHDL syntax a(10 downto 0)<=b(0 to 10) 
Author Message
 VHDL syntax a(10 downto 0)<=b(0 to 10)

Hi friends,
Very easy VHDL syntax question.
I have
a is std_logic_vector (10 downo 0)
b is std_logic_vector (10 downo 0)
Now I whant that
a(10)<=b(0)
a(1)<=b(1)
....
a(0) <=b(10)

But if I write
a(10 downto 0)<=b(0 to 10)
My compiler gives out a error
How can I do this syntactically correct

* Sent from RemarQ http://www.*-*-*.com/ The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



Sun, 19 May 2002 03:00:00 GMT  
 VHDL syntax a(10 downto 0)<=b(0 to 10)
Hi,

Quote:

> Hi friends,
> Very easy VHDL syntax question.
> I have
> a is std_logic_vector (10 downo 0)
> b is std_logic_vector (10 downo 0)
> Now I whant that
> a(10)<=b(0)
> a(1)<=b(1)
> ....
> a(0) <=b(10)

> But if I write
> a(10 downto 0)<=b(0 to 10)
> My compiler gives out a error
> How can I do this syntactically correct

The range of a slice must match the range definition of the array.
Hence, it is not allowed to write "b(0 to 10)" as "b" is defined
in descending order. A slice gives you just a part of an array
without reordering it!

You may write something like

    a <= b(0) & b(1) & b(2) & .... & b(10);

So you have still a lot to type but at least only a single
line is required. Of course you may also write a function
to do the job.

--
Edwin



Sun, 19 May 2002 03:00:00 GMT  
 VHDL syntax a(10 downto 0)<=b(0 to 10)
Hi Bonio,

Try this inside a process:

for I in a'range loop
  a(I)<=b(b'low+a'high-I);
end loop;

or outside:

L1:for I in a'range generate
        L2:a(I)<=b(b'low+a'high-I);
     end generate;

Catalin

Quote:

> Hi friends,
> Very easy VHDL syntax question.
> I have
> a is std_logic_vector (10 downo 0)
> b is std_logic_vector (10 downo 0)
> Now I whant that
> a(10)<=b(0)
> a(1)<=b(1)
> ....
> a(0) <=b(10)

> But if I write
> a(10 downto 0)<=b(0 to 10)
> My compiler gives out a error
> How can I do this syntactically correct



Sun, 19 May 2002 03:00:00 GMT  
 VHDL syntax a(10 downto 0)<=b(0 to 10)

I thougth it is any way to make such assignments direkt.
Thank you Catalin and Edwin for you answers,

* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!



Sun, 19 May 2002 03:00:00 GMT  
 VHDL syntax a(10 downto 0)<=b(0 to 10)
Quote:

> I thougth it is any way to make such assignments direkt.

You can define a function Freverse, put it into a package where you have
other frequently used stuff.
In synthesis such a function is translated into wires, no gates.
FUNCTION Freverse(a:std_logic_vector) RETURN std_logic_vector IS
VARIABLE t:std_logic_vector(a'RANGE);
BEGIN
  FOR i IN t'RANGE LOOP
   t(i):=a(a'HIGH+a'LOW-i);
  END LOOP;
 RETURN t;
END Freverse;
Andreas

-----------------------------------------------------------------
                        Andreas C. Doering
                        Medizinische Universitaet zu Luebeck
                        Institut fuer Technische Informatik

                        Home: http://www.iti.mu-luebeck.de/~doering
                             quiz, papers, VHDL, music
"The fear of the LORD is the beginning of ... science" (Proverbs 1.7)
----------------------------------------------------------------



Fri, 24 May 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. NEEDED: fixed point routine for 10^x 0<x<2

2. Numbers from 1 to 10 (was Numbers from 1 to 10 in Over 4500 Languages)

3. Numbers from 1 to 10 (was Numbers from 1 to 10 in Over 4500 Languages)

4. mouse sample - regist.arj (10/10)

5. 10 x 10 Multiplication Grid

6. PLI-32 For NT, alpha 3.10 (ZIP File: 378K] - pli-32.zip (10/10)

7. Ranges - enable (10..-10)

8. need F77 compiler to support range wider than 10**-308 to 10**308

9. I need 10*10 Checkers game source code in prolog

10. Relative Performance Study: SPARCstation 10/30 vs 10/41

11. (typep (make-array 10 :element-type 'bit) '(array bit (10)))

12. Help: 10 rows, 10 columns of buttons?

 

 
Powered by phpBB® Forum Software