cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
huangpoh
Visitor
Visitor
7,020 Views
Registered: ‎07-20-2017

Multiplier using numeric (VHDL)

Jump to solution
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;

-- Uncomment the following library declaration if using
-- arithmetic functions with Signed or Unsigned values
use IEEE.NUMERIC_STD.ALL;

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

entity MULTIPLIER is
    Port ( A : in  STD_LOGIC_VECTOR (7 downto 0);
           B : in  STD_LOGIC_VECTOR (3 downto 0);
           RES : out  STD_LOGIC_VECTOR (11 downto 0));
end MULTIPLIER;


architecture Behavioral of MULTIPLIER is
	signal A_int: integer;
	signal B_int: integer;
	signal RES_int: integer;
begin

	A_int <= to_integer(unsigned(A));
        B_int <= to_integer(unsigned(B));
	RES_int <=  A_int * B_int;
        RES <= std_logic_vector(to_unsigned(RES_int , RES'length) );

--if I comment out everything related with RES_int and use the below code everything works --RES <= std_logic_vector(to_unsigned(A_int * B_int , RES'length) ); end Behavioral;

with the above code I get, but I don't understand why? Can someone help me understand?  

 

Xst:646 - Signal <RES_int<31:12>> is assigned but never used. This unconnected signal will be trimmed during the optimization process.   

 

 

Thanks in advance.

0 Kudos
1 Solution

Accepted Solutions
vijayak
Xilinx Employee
Xilinx Employee
8,295 Views
Registered: ‎10-24-2013

Hi @huangpoh

Your output is just 12 bit and you are assigning it to 32 bit values. So the the remaining bits 31:12 are never used.

I believe you are seeing the expected output in the simulation. Do you?

Thanks,Vijay
--------------------------------------------------------------------------------------------
Please mark the post as an answer "Accept as solution" in case it helped resolve your query.
Give kudos in case a post in case it guided to the solution.

View solution in original post

0 Kudos
1 Reply
vijayak
Xilinx Employee
Xilinx Employee
8,296 Views
Registered: ‎10-24-2013

Hi @huangpoh

Your output is just 12 bit and you are assigning it to 32 bit values. So the the remaining bits 31:12 are never used.

I believe you are seeing the expected output in the simulation. Do you?

Thanks,Vijay
--------------------------------------------------------------------------------------------
Please mark the post as an answer "Accept as solution" in case it helped resolve your query.
Give kudos in case a post in case it guided to the solution.

View solution in original post

0 Kudos