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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem adding two integers

Status
Not open for further replies.

cdchilds

Programmer
Dec 8, 2003
9
GB
Hi,

I am trying to add an integer to an integer variable in VHDL, but when I try to synthesise it in XST I get:

"ERROR:Xst:1549 - controller.vhd line 331: Range bound must be a constant."

I have a bus (7 downto 0) that I convert to an integer using CONV_INTEGER, then try to add it to a variable using the following code:

totalLogCount := totalLogCount + CONV_INTEGER(internalBus);

The definitions are:

variable totalLogCount : integer;
and
internalBus : inout std_logic_vector(7 downto 0);

I use similar lines elsewhere in the code, but only ever adding 1 (e.g. "x := x + 1;"), and this seems to be synthesisable.

Any help would be most appreciated.

Thanks,

Chris.
 
Sorry, that is the wrong error message. The correct one is:

"ERROR:Xst:677 - controller.vhd line 330: Illegal constants on arithmetic operators."

Apologies for being dumb :)

Chris.
 
I don't know exactly what this error means, but I think you should first convert the std_logic_vector to unsigned or signed, and then to integer. this needs the std_logic_unsigned and std_logic_signed libraries to be defines (with USE). I have always done it that way, and never have encountered such errors
 
Thanks senjed, I think I have heard something like that before. For the time being I have recoded my design to avoid the issue, but I'm sure it will appear again before too long :)

Chris.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top