Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

std_logic_vector vs integer

Status
Not open for further replies.

GrimSleepers

Technical User
Jun 24, 2003
2
0
0
US
I am fairly new to VHDL and have reviewed numerous codes and have tried to learn various programs [Xilinx, Altera, etc.,] What I have found in many examples is the use of 'std_logic_vector' used as counters versus using 'integers'. Is there an advantage or reason for this type of use? For example, in a telemetry system, a frame sync is timed to go to a '1' at count "0000000100101010" [298] and then '0' at count "0011111111111111" [16383] of a 5MHz clock and resets and counts up again.
 
Std_logic_vector is same as integer. Whatever integer value is specified, it is implemented as bus of appropriate size subsequently.

So, declaring a bus for instance,
temp: std_logic_vector(3 downto 0)
is same as
temp: integer range 0 to 15
because both require 4-bit wide bus.

However, note that, if required range is not specified for the integer type, then it will occupy 32-bit bus, by default.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top