I am using vhdl for analysising the network packets.
The trouble started with the way array are decleared.
Why is that all most all use "downto" rather than "to", i really
got confused with this.
Is it some way related to Big Indian and Small Endian ( i do not
know which one is the correct spelling).
What is the use of downto---
Sorry if the question is very simple.
Ramnath
> I am using vhdl for analysising the network packets.
> The trouble started with the way array are decleared.
> Why is that all most all use "downto" rather than "to", i really
> got confused with this.
>
> Is it some way related to Big Indian and Small Endian ( i do not
> know which one is the correct spelling).
>
> What is the use of downto---
In the hardware world, it is common to denote signal buses as vectors of
bits that go from MSB (left) to LSB (right). Since buses often
represent binary numbers, it is meaningful to give a bit an index that
corresponds to its magnitude in the number representation, which is 0
for the LSB (right) and n-1 for the MSB (left) for an n-bit bus.
Therefore, you often see buses denoted as BUS[15:0] (like in Verilog) or
BUS(15 downto 0) (in VHDL).
Reto
Ramnath wrote:
>
> hi,
>
> I am using vhdl for analysising the network packets.
> The trouble started with the way array are decleared.
> Why is that all most all use "downto" rather than "to", i really
> got confused with this.
Lets say I have a vector "10000000"
If I declare it DOWNTO, then the '1' bit has the largest index.
If I declare it TO, then the '1' bit has the smallest index.
> Is it some way related to Big Indian and Small Endian ( i do not
> know which one is the correct spelling).
It's related, but endianness
concerns the order of slicing octets out
of a 16, 32 or 64 bit vector.
> What is the use of downto---
>
I use DOWNTO for numeric vectors
and TO for bitstreams where the
the least significant bit goes first.
--Mike Treseler
Mike Treseler wrote:
--
--Ray Andraka, P.E.
President, the Andraka Consulting Group, Inc.
401/884-7930 Fax 401/884-7950
email r...@andraka.com
http://www.andraka.com
"They that give up essential liberty to obtain a little
temporary safety deserve neither liberty nor safety."
-Benjamin Franklin, 1759
>I also use TO for shift registers used as delay lines, that way the index
>is equal to the number of clock cycles delay.
That's funny, I use DOWNTO for shift registers, and the index is equal
to the number of clock cycles delay.
I guess you shift right, and I shift left.
BTW, the OP should read Jonathan Swift's Gulliver's Travels.
From http://www.maxmon.com/1726ad.htm
In 1980, a famous paper written by Danny Cohen entitled
"On Holy Wars and a Plea for Peace" used the terms
big-endian and little-endian to refer to the two techniques for
storing data. These terms, which are still in use today, were
derived from that part of Gulliver's tale whereby two countries
go to war over which end of a hard-boiled egg should be
eaten first -- the little end or the big end!
Regards,
Allan.
I use "downto" when dealing with most busses, and things that are likely
to be numbers (counters, addresses, etc).
I use "to" when indexing memory elements.
For instance, an eight-bit wide, 1024-word deep RAM type could be declared:
type RAM_TYPE is array (0 to 1023) of std_logic_vector (7 downto 0);
[NB: The clever coder would use generics for the RAM's depth and width.]
--a