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

Reply

VHDL - Using a vector as an index

 
Thread Tools Search this Thread
Old 05-22-2008, 08:40 PM   #1
Default Using a vector as an index


Why is the Xilinx tool complaining about this (VHDL):

timer_done <= timer(data_len);

Where data_len is a 4 bit std_logic_vector, and timer is a 16 bit
std_logic_vector.

I want the tool to automatically infer a MUX with data_len as the
selector and timer as the input.

I can use a CASE statement but that is a lot of coding. I think
Verilog can happily accept that.

Thanks.


M. Hamed
  Reply With Quote
Old 05-22-2008, 08:52 PM   #2
Dave
 
Posts: n/a
Default Re: Using a vector as an index
On May 22, 3:40 pm, "M. Hamed" <mhs...@gmail.com> wrote:
> Why is the Xilinx tool complaining about this (VHDL):
>
> timer_done <= timer(data_len);
>
> Where data_len is a 4 bit std_logic_vector, and timer is a 16 bit
> std_logic_vector.
>
> I want the tool to automatically infer a MUX with data_len as the
> selector and timer as the input.
>
> I can use a CASE statement but that is a lot of coding. I think
> Verilog can happily accept that.
>
> Thanks.


Try this:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

-- snip

timer_done <= timer(to_integer(unsigned(data_len));

Dave


Dave
  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
synthesis error sekhar_kollati Hardware 0 11-13-2007 04:48 AM




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