# FPGA Central

## World's 1st FPGA Portal

 FPGA Groups > FPGA VHDL:Dividing a real number by two??
 User Name Remember Me? Password

 FPGA comp.arch.fpga newsgroup (usenet)

02-10-2004, 01:26 AM
 kwaj Guest Posts: n/a
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

02-10-2004, 02:03 AM
 Bevan Weiss Guest Posts: n/a
Re: VHDL:Dividing a real number by two??

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.

"kwaj" <[email protected]> wrote in message
news:[email protected]
> 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
>
>
>
>

02-10-2004, 02:18 AM
 Allan Herriman Guest Posts: n/a
Re: VHDL:Dividing a real number by two??

On Tue, 10 Feb 2004 15:03:11 +1300, "Bevan Weiss"
<[email protected]> wrote:

>"kwaj" <[email protected]> wrote in message
>news:[email protected]
>> 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

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.
02-10-2004, 08:55 AM
 Uwe Bonnes Guest Posts: n/a
Re: VHDL:Dividing a real number by two??

Allan Herriman <[email protected]> wrote:

: 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 [email protected]

Institut fuer Kernphysik Schlossgartenstrasse 9 64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
02-10-2004, 09:04 AM
 Allan Herriman Guest Posts: n/a
Re: VHDL:Dividing a real number by two??

On Tue, 10 Feb 2004 08:55:53 +0000 (UTC), Uwe Bonnes
<[email protected]> wrote:

>Allan Herriman <[email protected]> wrote:
>
>: 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?

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.

 Bookmarks

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post anand Verilog 1 08-16-2006 09:21 PM [email protected] Verilog 7 07-10-2006 08:06 PM weizbox Verilog 5 10-12-2004 03:02 PM

All times are GMT +1. The time now is 09:03 PM.