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

Reply

VHDL - multiplier one fixed value other user defined

 
Thread Tools Search this Thread
Old 04-23-2005, 01:17 PM   #1
Default multiplier one fixed value other user defined




Hi,,
I am interested to write a code where one input is user defined and the
other input is fixed to some value....

for example

0X2=0
1X2=2
2X2=4
3X2=6

here two in fixed (which I want to define as fixed). and 0 , 1, 2 , 3
user defined.


This code is generated using Xilinx webpack...

================================================== ==============
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;

---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;

entity multo is
Port ( p1 : in std_logic_vector(1 downto 0);
w1 : in std_logic_vector(1 downto 0);
ou : out std_logic_vector(3 downto 0));
end multo;

architecture Behavioral of multo is

begin

ou <= w1 * p1;

end Behavioral;

================================================== ==============

the code works fine.. but in a final result I hv to make a schmatic
symbol of the code.. and I want to keep the fixed input hidden. So the
user just can change the other input and see the results...

anybody with an answer... help me out...

thanks

John



xiibweb@hotmail.com
  Reply With Quote
Old 04-23-2005, 05:14 PM   #2
Ralf Hildebrandt
 
Posts: n/a
Default Re: multiplier one fixed value other user defined
wrote:


> I am interested to write a code where one input is user defined and the
> other input is fixed to some value....


> use IEEE.STD_LOGIC_ARITH.ALL;
> use IEEE.STD_LOGIC_UNSIGNED.ALL;


Hint: These libraries are not recommended, because their implementation
depends on the tool. Use IEEE.Numeric_Std.ALL instead.


> entity multo is
> Port ( p1 : in std_logic_vector(1 downto 0);
> w1 : in std_logic_vector(1 downto 0);
> ou : out std_logic_vector(3 downto 0));
> end multo;
>
> architecture Behavioral of multo is
>
> begin
>
> ou <= w1 * p1;
>
> end Behavioral;


If you synthesitze this, you will get a standard multiplier. Only if you
include this in a higher level component and make it clear for the
synthesis tool, that one input is fixed, you will get an efficient
implementation.
Try to use this (Numeric_Std.ALL included):

entity multo is
generic(
p1 : integer:=2 );
port (
w1 : in std_logic_vector(1 downto 0);
ou : out std_logic_vector(3 downto 0) );
end multo;

architecture Behavioral of multo is
begin

ou <= (unsigned)w1 * p1; -- signed or unsigned?

end Behavioral;

Hint: Multiplication by two is nothing more than a shift. With the
suggested approach using the generic parameter the synthesis tool is
able to see this and will infer a simple shifter.

Ralf


Ralf Hildebrandt
  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

Similar Threads
Thread Thread Starter Forum Replies Last Post
creating user defined service in windows suresh_rtp Software 0 05-05-2009 08:34 AM
Fixed image script aegir General Help Related Topics 0 07-09-2008 02:46 PM
ASP.NET with User Interface Process Application Block robinp Software 0 03-05-2007 10:01 AM
Ajax Atlas not working in User Control faiq Software 0 09-16-2006 08:28 AM
Any DVD Player that can override User Prohibitions? Walter Traprock DVD Video 3 12-03-2005 11:43 PM




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