![]() |
|
|
|||||||
![]() |
VHDL - Synthesis of variable index array |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
Hello everyone,
I am new to VHDL and I am having problems with synthesis. Is variable indexing of arrays (e.g. std_logic_vector) not really synthesizable? For example, ----- VARIABLE x : std_logic_vector(7 DOWNTO 0); VARIABLE start : natural := 2; VARIABLE end : natural := 4; VARIABLE y : std_logic_vector(2 DOWNTO 0); ------ y := x(end DOWNTO start); ------------------------------------------------- Why is this code not synthesizable? the tool I am using gives me "Slice indices should be static"? Is there someway to get around this in hardware? The solution that I have till now is: Shifiting right and left till the part that we need remains and all others are 0's then ORing the parts that we need together. Waiting for your replies. Thank you very much ____ O.S. oshouman |
|
|
|
|
|
|
#2 | |
|
Junior Member
Join Date: Mar 2007
Posts: 5
|
Quote:
the code is synthesizable, i'm using FPGA Advantage and xilinx ISE 9.1i alias works too Code:
Ahmed Samieh |
|
|
|
|
|
|
#3 |
|
Member
Join Date: Nov 2006
Posts: 32
|
Hello Oshouman,
Well the synthesis will definetly show problem with your code. The compiler looks for the defined boundaries while synthesizing the VHDL code. Giving a local variable or global variable parameter would result in error. So, instead of defining "start" and "end" as variables, define them as constant and then compile. constant start : natural := 2; constant end : natural := 4; VARIABLE x : std_logic_vector(7 DOWNTO 0); VARIABLE y : std_logic_vector(2 DOWNTO 0); ------ y := x(end DOWNTO start); Hope this will solve your problem ![]() quantum_dot |
|
|
|
|
|
#4 |
|
Junior Member
Join Date: Jun 2007
Posts: 6
|
Dear Quantum_dot,
The idea is that I need to access a variable part (i.e. a slice of the vector) each time. In other words, the range changes each time the code executes. Actually, I found a way to get around this, I do not really know if it is a stupid solution or a good one. The idea is to have a separate function that copies a certain slice of a vector with start and end indeces to a target vector with different start and range indeces. Here is the code (hint: I am new to VHDL and converting from programming): Code:
The function or3 just ORs three vectors. When I use this functon, it does what I need and it is synthesizable. Thanks for your reply and concern. oshouman Last edited by oshouman : 06-24-2007 at 11:49 PM. |
|
|
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| constants as of array of integers, for loops | octavsly | Hardware | 0 | 04-25-2009 11:53 AM |
| Array Programme | rits | Software | 2 | 03-04-2009 05:18 PM |
| Passing value with out using variable in query string in PHP! | Ali_ggl | General Help Related Topics | 0 | 11-29-2008 12:22 PM |
| synthesis error | sekhar_kollati | Hardware | 0 | 11-13-2007 04:48 AM |
| Variable Scope in asp.Net | jansi_rk | Software | 1 | 09-18-2006 06:05 PM |