VHDL:Dividing a real number by two??

I would have assumed that given a real variable, LAPP, to divide it by two would simply be;

LAPP / 2

But I get as an error, "no feasible entries for /". How would one divide through a real number??

- Kingsley

Reply to
kwaj
Loading thread data ...

I think that you're mistaking VHDL as some form of programming language. VHDL is a hardware description language, and as such it has no real knowledge of a divide. The only thing that a divide would be used for would be as an expression to form a constant.

If you're trying to divide some non-constant value by two, then you have to ask yourself where this non-constant value is coming from, what kind of operation would need to be performed on it to divide it by two, and where you want the result to end up. Then you must design the logic to go between the input and the output of the divide operation (or alternatively use some prebuilt libray which already has such a design).

I think that you should read an introductory book on VHDL, it should help you understand where you're going wrong with your approach.

Reply to
Bevan Weiss

try

LAPP / 2.0

'2.0' is a real, and '2' is an integer (and the compiler hasn't been told to divide a real by an integer).

This is unlikely to be synthesisable (depending on context) as Bevan suggested.

Regards, Allan.

Reply to
Allan Herriman

: try

: LAPP / 2.0

: '2.0' is a real, and '2' is an integer (and the compiler hasn't been : told to divide a real by an integer).

What about substracting -1 from the exponent?

--
Uwe Bonnes                bon@elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
Reply to
Uwe Bonnes

That doesn't work in general (for IEEE floating point). There are special cases to consider. Besides, we don't know yet whether the OP requires synthesisable code.

Regards, Allan.

Reply to
Allan Herriman

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.