2013-04-22 56 views
0

当我综合这个32位乘法器代码时,我没有得到任何错误,只是警告我的输入未被使用并且被分配但未被使用。我的代码是这样的:VHDL乘法器代码中的综合警告

library IEEE; 
use IEEE.STD_LOGIC_1164.ALL; 

entity multiplier is 
    Port (multiplicand : in STD_LOGIC_VECTOR(31 downto 0); 
      multiply : in STD_LOGIC_VECTOR(31 downto 0); 
      clk : in STD_LOGIC; 
      product : out STD_LOGIC_VECTOR(63 downto 0)); 
end multiplier; 

architecture Behavioral of multiplier is 

    component adder32bit is 
     port(addone, addtwo : in STD_LOGIC_VECTOR(31 downto 0); 
       sum : out STD_LOGIC_VECTOR(31 downto 0); 
       cout : out STD_LOGIC); 
    end component; 

    signal tempsum : STD_LOGIC_VECTOR(31 downto 0); 
    signal preg : STD_LOGIC_VECTOR(63 downto 0); 
    signal start : STD_LOGIC := '1'; 
    signal tempcout : STD_LOGIC; 
    signal counter : integer := 1; 
begin 

    addN: adder32bit port map(multiplicand, preg(63 downto 32), tempsum, tempcout); 

    process(clk) 
    begin 
     if(rising_edge(clk)) then 
      if(start = '1') then 

       if(counter = 1) then 
        preg <= "00000000000000000000000000000000" & multiply; 
       end if; 

       if(preg(0) = '1') then 
        preg(63 downto 32) <= tempsum; 
        preg <= tempcout & preg(63 downto 1); 
       else 
        preg <= '0' & preg(63 downto 1); 
       end if; 

       counter <= counter + 1; 

       if(counter = 33) then 
        product <= preg; 
        start <= '0'; 
        counter <= 1; 
       end if; 

      end if; 
     end if; 
    end process; 

end Behavioral; 

当我不管我的两个输入(被乘数和乘)什么运行模拟,输出将是这样的:“0000 ... UUUUUUU”

任何建议至于我应该在这里做什么?初始化preg

+0

周期后一个是“预浸”你所期望的价值?如果没有,了解Delta循环模型,以及流程中信号分配的顺序,找出原因,然后重试。这个Q/A可能是有用的:http://stackoverflow.com/questions/13954193/is-process-in-vhdl-reentrant/13956532#13956532 – 2013-04-22 17:03:34

+0

嘿,非常感谢,我发现了这个问题。问题是我在这个过程中设置了很多次,所以它只用了最后一个。 但是....现在我的问题是,如何初始化preg以使preg的值为“000 ...&multiply”?我的模拟只有当我设置preg为某个实际值而不使用乘法时才起作用。那么我可以使用乘法来初始化信号线中的preg吗? – user2308179 2013-04-22 17:59:46

回答

0

一种方法只涉及到代码中的微小的变化......

  if(counter = 1) then 
       preg <= "00000000000000000000000000000000" & multiply; 
      else 
       if(preg(0) = '1') then ... 
      end if;