FPGA Central - World's 1st FPGA / CPLD Portal

FPGA Central

World's 1st FPGA Portal

 

Go Back   FPGA Groups > NewsGroup > VHDL

VHDL comp.lang.vhdl newsgroup / Usenet

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-24-2004, 03:21 PM
Bakkurudeen Ali J
Guest
 
Posts: n/a
Default VHDL - Query about Division of two Nos

Hello All,

How can I perform division for the below mentioned :

Data_In : std_logic_vector(33 downto 0);
constant ZETA :std_logic_vector(8 downto 0) := "100100001";

Now : Result <= Data_in / Zeta;

I intend to represent the result rounded to (16,-7) (i.e., 9 bits
integer and 7 bits fractional)

NOTE: The Constant(ZETA) which I have mentioned is Canonical Signed
Digit Representation of An Integer value = -0.8710935


Kindly suggest me a solution to this problem !

Regards,
Ali
Reply With Quote
  #2 (permalink)  
Old 11-24-2004, 03:33 PM
Ralf Hildebrandt
Guest
 
Posts: n/a
Default Re: VHDL - Query about Division of two Nos

Bakkurudeen Ali J wrote:


> How can I perform division for the below mentioned :
>
> Data_In : std_logic_vector(33 downto 0);
> constant ZETA :std_logic_vector(8 downto 0) := "100100001";
>
> Now : Result <= Data_in / Zeta;


Wouldn't it be a good idea to use a multiplication? (Division by a
constant is the multiplication by the inverse of the constant.)
Multiplication by a constant can be reduced to some additions.

Ralf
Reply With Quote
  #3 (permalink)  
Old 11-24-2004, 04:06 PM
Jim Lewis
Guest
 
Posts: n/a
Default Re: VHDL - Query about Division of two Nos

Ali,
See the package IEEE.Fixed_Pkg:
http://www.eda.org/vhdl-200x/vhdl-20...ges/files.html

Since it is not yet standardized, you will temporarily need to
compile it into your own library to use it.

Cheers,
Jim
P.S.
Also note Ralf's post about using multiplication instead of division.

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~
Jim Lewis
Director of Training mailto:[email protected]
SynthWorks Design Inc. http://www.SynthWorks.com
1-503-590-4787

Expert VHDL Training for Hardware Design and Verification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~


> Hello All,
>
> How can I perform division for the below mentioned :
>
> Data_In : std_logic_vector(33 downto 0);
> constant ZETA :std_logic_vector(8 downto 0) := "100100001";
>
> Now : Result <= Data_in / Zeta;
>
> I intend to represent the result rounded to (16,-7) (i.e., 9 bits
> integer and 7 bits fractional)
>
> NOTE: The Constant(ZETA) which I have mentioned is Canonical Signed
> Digit Representation of An Integer value = -0.8710935
>
>
> Kindly suggest me a solution to this problem !
>
> Regards,
> Ali

Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clock division by 2 Parthav Verilog 4 04-03-2006 12:53 AM
XST :division and mod in vhdl Okashii FPGA 7 11-27-2005 01:05 AM
Query regarding VHDL "if" statement Kingfischer VHDL 2 10-15-2004 08:09 PM
division Ketan FPGA 5 07-10-2003 01:28 AM


All times are GMT +1. The time now is 11:34 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
Copyright 2008 @ FPGA Central. All rights reserved