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

Reply

VHDL - multiplier with one fixed value other user defined

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


Hi,,
I am interested to write a code in VHDL 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;

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 for the code.. and I want to keep the fixed input hidden. So the
user just can change the other input and see the results... but with
existing code user cn c both inputs and requires to define both.

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

thanks

John



xiibweb@hotmail.com
  Reply With Quote
Old 04-23-2005, 01:37 PM   #2
Mohammed A khader
 
Posts: n/a
Default Re: multiplier with one fixed value other user defined

Hi John,

To have a fixed input it must be a constant (not a input port). So you
have to change your code to
================================================== ==============
> library IEEE;
> use IEEE.STD_LOGIC_1164.ALL;
> use IEEE.STD_LOGIC_ARITH.ALL;
> use IEEE.STD_LOGIC_UNSIGNED.ALL;
>
> entity multo is
> Port ( w1 : in std_logic_vector(1 downto 0);


> ou : out std_logic_vector(3 downto 0));
> end multo;
>
> architecture Behavioral of multo is

constant p1 : std_logic_vector(1 downto 0):= "10";
> begin
>
> ou <= w1 * p1;
>
> end Behavioral;
>
> ================================================== ==============



There are other things to correct in code. You have included the
package for unsigned and arithmetic but have not used it. When you do
some arithmetic opearation then it is good to define operators by
either unsigned or signed But dont use std_logic_vector. I assume you
want to do unsgined multiplication , so use unsigned type rather then
std_logic_vector.

Hence your declarations must be

w1 : in unsigned(1 downto 0); .....

-- Mohammed A Khader.



Mohammed A khader
  Reply With Quote
Old 04-23-2005, 02:01 PM   #3
xiibweb@hotmail.com
 
Posts: n/a
Default Re: multiplier with one fixed value other user defined
well the problem is not solved......... i cannot hide the input
still... or keep it defined...
thanks.



xiibweb@hotmail.com
  Reply With Quote
Old 04-23-2005, 02:05 PM   #4
xiibweb@hotmail.com
 
Posts: n/a
Default Re: multiplier with one fixed value other user defined
Well thanks very much for the reply...
i am getting following errors when i try to do compilation...

ERROR:HDLParsers:800 - "C:/Projects/AndNN/multhree.vhd" Line 14. Type
of p1 is incompatible with type of 10 .
ERROR:HDLParsers:808 - "C:/Projects/AndNN/multhree.vhd" Line 17. * can
not have such operands in this context

and i hv no idea how figure these out....

thanks again



xiibweb@hotmail.com
  Reply With Quote
Old 04-23-2005, 02:16 PM   #5
xiibweb@hotmail.com
 
Posts: n/a
Default Re: multiplier with one fixed value other user defined
THANKS A LOOOOOOOOOOOOOOOOOOOOT........... NOW THE CODE IS WORKING
FINEEEEEEEEEEEEEEE

THANKS AGAIN

John



xiibweb@hotmail.com
  Reply With Quote
Old 04-24-2005, 04:40 PM   #6
info_
 
Posts: n/a
Default Re: multiplier with one fixed value other user defined
Mohammed A khader wrote:

> Hi John,
>
> To have a fixed input it must be a constant (not a input port). So you
> have to change your code to
> ================================================== ==============
>
>>library IEEE;
>>use IEEE.STD_LOGIC_1164.ALL;
>>use IEEE.STD_LOGIC_ARITH.ALL;
>>use IEEE.STD_LOGIC_UNSIGNED.ALL;
>>
>>entity multo is
>> Port ( w1 : in std_logic_vector(1 downto 0);

>
>
>> ou : out std_logic_vector(3 downto 0));
>>end multo;
>>
>>architecture Behavioral of multo is

>
> constant p1 : std_logic_vector(1 downto 0):= "10";
>
>>begin
>>
>> ou <= w1 * p1;
>>
>>end Behavioral;
>>
>>================================================ ================

>
>
>
> There are other things to correct in code. You have included the
> package for unsigned and arithmetic but have not used it.


Yes he did !
that's what std_logic_unsigned is about :
it treats std_logic_vectors as unsigned.

>
> Hence your declarations must be
>
> w1 : in unsigned(1 downto 0); .....
>
> -- Mohammed A Khader.
>


Not necessary. see above.

But I think everyone should give up synopsys arith packages and
switch to numeric_std instead.

Bert Cuzeau


info_
  Reply With Quote
Old 04-25-2005, 01:29 PM   #7
Mohammed A khader
 
Posts: n/a
Default Re: multiplier with one fixed value other user defined

Mohammed said ....
>> You have included the
>> package for unsigned and arithmetic but have not used it.


Bert Said....
> that's what std_logic_unsigned is about :
> it treats std_logic_vectors as unsigned.


Sorry I wrote unsigned as well as arithmetic . * operator for
std_lgoic_vector is defined in unsigned .So no need of arithmetic
package since it is not used.

> But I think everyone should give up synopsys arith packages and
> switch to numeric_std instead.


Yes I agree with it.



Mohammed A khader
  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