arithmetic problem

Hi, the following code :

library IEEE; use IEEE.STD_LOGIC_1164.ALL; use IEEE.numeric_std.ALL; ... rnext.addr

Reply to
Thorsten Kiefer
Loading thread data ...

1) Make absolutely sure that you don't have use ieee.std_logic_arith or use ieee.std_logic_[un]signed in the context clauses. 2) Just as an experiment (I'm not recommending this for real code) try

rnext.addr

Reply to
Jonathan Bromley

Declare rnext.addr and rreg.addr as unsigned, and write

rnext.addr

Reply to
Brian Drummond

I don't use them ...

rnext.addr

Reply to
Thorsten Kiefer

Do you mean this:

rnext.addr

Reply to
Dave

You also need not convert the integer to unsigned. Numeric_std "+" is already defined for unsigned and natural operands (returning unsigned).

next.addr

Reply to
Andy

Even though Andy's suggestion is the same as in the original post, he's right. This problem shouldn't be happening if you're using numeric_std, and not using std_logic_arith, std_logic_signed, or std_logic_unsigned. I would re-check your code to make sure those libraries aren't in there. If you're sure, I'd be interested to know what tool it is that's giving you this error.

The problem stems from the fact that std_logic_arith has two "+" functions for each possible combination of input argument types: one which has a result of type std_logic_vector, and one which has a result of either signed or unsigned (depending on the input argument types). the compiler doesn't know which one to use. Numeric_std doesn't have this problem, since it only defines the "+" function once for each possible input argument type combination. If, however, you were to use both numeric_std and std_logic_arith, then the ambiguity increases, since there are now 3 options: the two from std_logic_arith, and the one from numeric_std. I notice that your error statement mentions three possibilities...

Dave

Reply to
Dave

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.