PDA

View Full Version : please help me..


anupamaasok
02-27-2008, 06:33 AM
i am doing a single precision floating point multiplier.my code goes like
this

entity multiplier is
port(frac_A,frac_B:in std_logic_vector(23 downto 0);
s_A,s_B:in std_logic;
e_A,e_B:in std_logic_vector(7 downto 0);
frac_R:out std_logic_vector(23 downto 0);
s_R:out std_logic;
e_R:out std_logic_vector(7 downto 0);
ovrflow:out std_logic;
clk:in std_logic;
reset:in std_logic;
zf:out std_logic
);
end multiplier;

architecture Behavioral of multiplier is

signal mux:std_logic_vector(23 downto 0);

signal e_int:std_logic_vector(8 downto 0);
signal sel:std_logic_vector(1 downto 0);
signal e_intr:std_logic_vector(8 downto 0);
signal l:std_logic:='1';
signal S:std_logic_vector(23 downto 0);
signal sum:std_logic_vector(48 downto 0);
signal A:std_logic_vector(23 downto 0);
signal P:std_logic_vector(48 downto 0);
signal k:std_logic_vector(4 downto 0);

begin

s_R<=s_A xor s_B;
e_intr<=('0'& e_A) +('0' & e_B)-"001111111" ;

process(reset,clk)
variable i:integer;
variable n:std_logic;

begin
if reset='1' then
A<=(others=>'0');
P<=(others=>'0');

elsif (clk'event and clk='1' )then
if l = '1' then
A <= frac_A;
S <= (not A)+'1';
P <= "000000000000000000000000" & frac_B & '0';
l <= '0';
k <= "00000";
else
P <= sum;
for i in 0 to 47 loop
P(i)<=P(i+1);
end loop;
P(48)<='0';
end if;
sel(0)<=P(0);
sel(1)<=P(1);
case sel is
when "00"=>mux<=(others=>'0');
when "01"=>mux<=A;
when "10"=>mux<=S;
when "11"=>mux<=(others=>'0');
when others=>mux<=(others=>'0');

end case;

if k="10111" then
if P(48) = '1' then
e_int <= e_intr+'1';
else
e_int <= e_intr;
for i in 0 to 47 loop
P(i+1) <= P(i);
end loop;
end if;

e_R(7 downto 0) <= e_int(7 downto 0);

ovrflow<=e_int(8);

frac_R(23 downto 0)<=P(48 downto 25);
n:='0';
for i in 0 to 48 loop
n:=n nor P(i);
end loop;
zf<=n;

else
sum <= P +(mux & "0000000000000000000000000" );
k<= k+'1';
end if;
end if;


end process;

end Behavioral;
although i have used the signal sum it is always showing a warning error
saying its not used.the warning errors shown are

ARNING:Xst:646 - Signal <sum> is assigned but never used.
WARNING:Xst:1426 - The value init of the FF/Latch l hinder the constant
cleaning in the block multiplier.
what should i do? please help me....


--
Message posted using http://www.talkaboutprogramming.com/group/comp.lang.vhdl/
More information at http://www.talkaboutprogramming.com/faq.html

Pieter Hulshoff
02-27-2008, 08:07 AM
anupamaasok wrote:
> although i have used the signal sum it is always showing a warning error
> saying its not used.the warning errors shown are
>
> ARNING:Xst:646 - Signal <sum> is assigned but never used.
> WARNING:Xst:1426 - The value init of the FF/Latch l hinder the constant
> cleaning in the block multiplier.
> what should i do? please help me....

The first warning is incorrect as far as I can see, but might be a result of the
second warning. Within your code, l is only ever assigned as '0'. The only
reason it will ever be '1' is because of your initialisation value; otherwise it
would have been a constant '0'. Perhaps an error in your code?

Kind regards,

Pieter Hulshoff

Shannon
02-29-2008, 05:22 PM
The error is correct. 'sum' is never used.

Look at your first IF..Then..Else statement. 'l' is always = 1 so the
'Else' clause will never be executed. Your compiler is deleting all
that code since it is not used. That is the only place you use 'sum'
so the error is correct.

Shannon


On Feb 27, 12:07*am, Pieter Hulshoff <[email protected]> wrote:
> anupamaasok wrote:
> > although i have used the signal sum it is always showing a warning error
> > saying its not used.the warning errors shown are
>
> > ARNING:Xst:646 - Signal <sum> is assigned but never used.
> > WARNING:Xst:1426 - The value init of the FF/Latch l hinder the constant
> > cleaning in the block multiplier.
> > what should i do? please help me....
>
> The first warning is incorrect as far as I can see, but might be a result of the
> second warning. Within your code, l is only ever assigned as '0'. The only
> reason it will ever be '1' is because of your initialisation value; otherwise it
> would have been a constant '0'. Perhaps an error in your code?
>
> Kind regards,
>
> Pieter Hulshoff

Thomas Rouam
03-01-2008, 08:50 AM
On Feb 29, 5:22*pm, Shannon <[email protected]> wrote:
> The error is correct. *'sum' is never used.
>
> Look at your first IF..Then..Else statement. *'l' is always = 1 so the
> 'Else' clause will never be executed. *Your compiler is deleting all
> that code since it is not used. *That is the only place you use 'sum'
> so the error is correct.
>
> Shannon
>
> On Feb 27, 12:07*am, Pieter Hulshoff <[email protected]> wrote:
>
>
>
> > anupamaasok wrote:
> > > although i have used the signal sum it is always showing a warning error
> > > saying its not used.the warning errors shown are
>
> > > ARNING:Xst:646 - Signal <sum> is assigned but never used.
> > > WARNING:Xst:1426 - The value init of the FF/Latch l hinder the constant
> > > cleaning in the block multiplier.
> > > what should i do? please help me....
>
> > The first warning is incorrect as far as I can see, but might be a result of the
> > second warning. Within your code, l is only ever assigned as '0'. The only
> > reason it will ever be '1' is because of your initialisation value; otherwise it
> > would have been a constant '0'. Perhaps an error in your code?
>
> > Kind regards,
>
> > Pieter Hulshoff- Hide quoted text -
>
> - Show quoted text -

What Shannon just said is right and wrong.
'sum' is truly never used, but not for thos reasons.
If you look at that IF..Then.Else statement he's talking about, in the
Else part :
P <= sum;
for i in 0 to 47 loop
P(i)<=P(i+1);
end loop;
P(48)<='0';
sum is assigend to P, but then the bits 0 to 47 of P are assigned and
finally the bit 48. sinc P is defined as 48 downto 0, P is entireley
assigned with the for loop and the final 48th bit assignment. These
two assignement "overwrite" the P <= sum assignment. Since that's the
only place where you use sum, it is not used.

Best Regards,

Thomas

Thomas Stanka
03-03-2008, 06:29 AM
On 27 Feb., 09:07, Pieter Hulshoff <[email protected]> wrote:
> second warning. Within your code, l is only ever assigned as '0'. The only
> reason it will ever be '1' is because of your initialisation value; otherwise it
> would have been a constant '0'. Perhaps an error in your code?

Signal values in the signal declaration are not relevant for synthesis
(only for simulation). So the signal 'I' should throw the first
warning because its value is not defined.
The signal 'I' should be initialisated during reset.

bye Thomas