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

Reply

VHDL - std_logic_vector divide

 
Thread Tools Search this Thread
Old 10-01-2003, 10:05 AM   #1
Default std_logic_vector divide


Hi all,

Is there any operator to divide a std_logic_vector, either by another
std_logic_vector or by an integer?

I am using the following code at the moment

temp := CONV_INTEGER(buf2) / q ;
ZRLOut <= CONV_STD_LOGIC_VECTOR(temp,11);

where buf2 and ZRLOut are signals of type std_logic_vector, temp is a
variable of type integer, and q is a signal of type integer.

Thanks
Ciarán Hughes

This works fine in behavioural simulation, but when I run a post
translate simulation, the division seems to be ignored, i.e. ZRLOut is
equal buf2. It is like the division can't be synthesised, and is
ignored (like the after statement).

Thanks,
Ciarán Hughes


Ciar?n Hughes
  Reply With Quote
Old 10-01-2003, 02:12 PM   #2
FE
 
Posts: n/a
Default Re: std_logic_vector divide
Sorry, division operator are not available for synthesis, except for power
of 2 (shift).You must design it. You can check for non restoring algorithm
on the web (I think that it's the easiest algorithm to implement) and you
can found some existing vhdl implemetation too.

regards
fe

"Ciar?n Hughes" <> wrote in message
news: om...
> Hi all,
>
> Is there any operator to divide a std_logic_vector, either by another
> std_logic_vector or by an integer?
>
> I am using the following code at the moment
>
> temp := CONV_INTEGER(buf2) / q ;
> ZRLOut <= CONV_STD_LOGIC_VECTOR(temp,11);
>
> where buf2 and ZRLOut are signals of type std_logic_vector, temp is a
> variable of type integer, and q is a signal of type integer.
>
> Thanks
> Ciarán Hughes
>
> This works fine in behavioural simulation, but when I run a post
> translate simulation, the division seems to be ignored, i.e. ZRLOut is
> equal buf2. It is like the division can't be synthesised, and is
> ignored (like the after statement).
>
> Thanks,
> Ciarán Hughes





FE
  Reply With Quote
Old 10-04-2003, 02:34 PM   #3
David Bishop
 
Posts: n/a
Default Re: std_logic_vector divide

You will find an unsigned divide routine commented out in
the floating point routines.

http://www.eda.org/fphdl/vhdl/fphdl_base_pkg_body.vhd

It is done as a subtraction tree, not very elegant, but it will
synthesize.

Ciar?n Hughes wrote:
>
> Hi all,
>
> Is there any operator to divide a std_logic_vector, either by another
> std_logic_vector or by an integer?
>
> I am using the following code at the moment
>
> temp := CONV_INTEGER(buf2) / q ;
> ZRLOut <= CONV_STD_LOGIC_VECTOR(temp,11);
>
> where buf2 and ZRLOut are signals of type std_logic_vector, temp is a
> variable of type integer, and q is a signal of type integer.
>
> Thanks
> Ciarán Hughes
>
> This works fine in behavioural simulation, but when I run a post
> translate simulation, the division seems to be ignored, i.e. ZRLOut is
> equal buf2. It is like the division can't be synthesised, and is
> ignored (like the after statement).
>
> Thanks,
> Ciarán Hughes


--
NAME: David W. Bishop INTERNET:


David Bishop
  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




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