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

Reply

VHDL - 'HDL-27 Constant value required' when using signal as index

 
Thread Tools Search this Thread
Old 11-27-2008, 09:59 AM   #1
Default 'HDL-27 Constant value required' when using signal as index


I hope you can help me on this problem, I've been working on it for some days now.

When I simulate the following VHDL code, I receive no errors and the results are good.
Part of my code:

library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;--to use to_integer()
...
generic
(
AXI_ADDR_DATA_BITS : integer := 32;
VPAGE_BITS : integer := 12;
VPAGE_SETTING_BITS : integer := 3;
VPAGE_SETTING_OFFSET : integer := 10
)
port
(
PAGE_SIZE_SETTING : in std_logic_vector(VPAGE_SETTING_BITS - 1 downto 0);
VIR_ADDRESS_PAGE : out std_logic_vector(VPAGE_BITS - 1 downto 0);
VIR_ARAW_ADDR : in std_logic_vector(AXI_ADDR_DATA_BITS - 1 downto 0);
)
...
VIR_ADDRESS_PAGE <=
VIR_ARAW_ADDR
(
VPAGE_BITS
+
to_integer
(
unsigned
(
PAGE_SIZE_SETTING
)
)
+
VPAGE_SETTING_OFFSET
-
1
downto
to_integer
(
unsigned
(
PAGE_SIZE_SETTING
)
)
+
VPAGE_SETTING_OFFSET
);

But when I synthesise it, I get the following error: HDL-27 Constant value required
When I look up the error description (2nd hit: google for "constant value required" vhdl), it is not clear to me why this is not possible. I could image a combinatorial circuit (with a lot of multiplexers) which could solve this problem.
When I replace "to_integer(unsigned(PAGE_SIZE_SETTING))" with "3" it synthesises too. Like this:

VIR_ADDRESS_PAGE <=
VIR_ARAW_ADDR
(
VPAGE_BITS
+
3
+
VPAGE_SETTING_OFFSET
-
1
downto
3
+
VPAGE_SETTING_OFFSET
);

To solve this problem, I tried the following code:

FIX : for I in (to_integer(unsigned(PAGE_SIZE_SETTING)) + VPAGE_SETTING_OFFSET) to (VPAGE_BITS + to_integer(unsigned(PAGE_SIZE_SETTING)) + VPAGE_SETTING_OFFSET - 1) loop
VIR_ADDRESS_PAGE(I - (to_integer(unsigned(PAGE_SIZE_SETTING)) + VPAGE_SETTING_OFFSET)) <= VIR_ARAW_ADDR(I);
end loop FIX;

but I get the same error again. When applying the replace, it "works" again. Like this:

FIX : for I in (3 + VPAGE_SETTING_OFFSET) to (VPAGE_BITS + 3 + VPAGE_SETTING_OFFSET - 1) loop
VIR_ADDRESS_PAGE(I - (3 + VPAGE_SETTING_OFFSET)) <= VIR_ARAW_ADDR(I);
end loop FIX;

Can you give me a hint to solve my problem please?
I guess that my problem is "just" indexing a std_logic_vector with a signal as index.

Thank you in advance,
Wouter

Simulation: ModelSim SE 6.3a
Synthesis: Synopsys Design Analyzer


woutput
woutput is offline   Reply With Quote
Old 12-03-2008, 09:29 AM   #2
woutput
Junior Member
 
Join Date: Nov 2008
Posts: 2
Default
I solved the problem with help from someone else:

Now I have

VIR_ADDRESS_PAGE <= (others => '0');
FILL_VIR_ADDRESS_PAGE : for I in (0 + VPAGE_SETTING_OFFSET) to (VPAGE_BITS + (2**VPAGE_SETTING_BITS - 1) + VPAGE_SETTING_OFFSET - 1) loop
if ((I > (to_integer(unsigned(PAGE_SIZE_SETTING)) + VPAGE_SETTING_OFFSET)) and (I < (VPAGE_BITS + to_integer(unsigned(PAGE_SIZE_SETTING)) + VPAGE_SETTING_OFFSET - 1))) then
VIR_ADDRESS_PAGE(I - (to_integer(unsigned(PAGE_SIZE_SETTING)) + VPAGE_SETTING_OFFSET)) <= VIR_ARAW_ADDR(I);
end if;
end loop FILL_VIR_ADDRESS_PAGE;


woutput
woutput is offline   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
I am having trouble editing a signal in a sub program. Haai Hardware 0 08-28-2007 02:58 PM
Required permissions cannot be acquired. Mukesh Doot Software 1 04-18-2007 10:58 PM
Need help on Modelsim VHDL syntax? ASAP:) kaji General Help Related Topics 0 03-14-2007 10:43 PM
IMHO, Digital SECAM video is better than Analog NTSC video Radium DVD Video 167 10-25-2006 04:16 AM
DVD Verdict reviews: THE CONSTANT GARDENER, TRANSPORTER 2, and more! DVD Verdict DVD Video 0 01-10-2006 09:21 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