Is this a synthesizable code?

Joined
Mar 17, 2012
Messages
3
Reaction score
0
Sorry for my newbie question. I have this code that perform a multiplication. Since the operatore '*' is not defined for std_logic_vector, i used integer variable to do so and then convert it to std_logic_vector. The simulations runs well, but is this really synthesizable? Or should i "build" a true multiplier? thanks

Code:
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.std_logic_arith.all;
use IEEE.std_logic_signed.all;

entity Mul is
    Port ( x : in  STD_LOGIC_VECTOR (7 downto 0);
           y : in  STD_LOGIC_VECTOR (7 downto 0);
           z : out  STD_LOGIC_VECTOR (15 downto 0));
end Mul ;

architecture Behavioral of Mul is

begin

process (x,y)

variable multiplicand : integer :=0;
variable multiplier : integer :=0;
variable product : integer :=0;

begin
	multiplicand := CONV_INTEGER(x);
	multiplier := CONV_INTEGER(y);
	product:= multiplicand*multiplier;
	
	z <= CONV_STD_LOGIC_VECTOR(product,16);
end process;

end Behavioral;

ps: is there a way to know if code is synthesizable without have to try on a board?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top