【发布时间】:2017-02-20 22:10:19
【问题描述】:
我正在尝试为一个学术项目创建一个展位乘数,但我遇到了最奇怪的错误。不确定这是否可以追溯到 Quartus II 或与 VHDL 相关。
每次我尝试分析和细化以下代码时,在分析和综合阶段的 46% 处,进程都会无限期冻结(我已经运行了一个小时),在控制台中的最后一行是 12127 Elaborating entity "booth_mul" for the top level hierarchy没有任何其他特殊警告或注意错误(只是通常的 (found x design units,...)
ARCHITECTURE booth_mul OF booth_mul IS
BEGIN
process(Ain, Bin)
variable result, toResult: STD_LOGIC_VECTOR(63 downto 0);
--other variables
begin
--other stuff
for i in 0 to 31 loop
--other stuff
--toResult is the partial product being added to the result
toResult := STD_LOGIC_VECTOR(SHIFT_LEFT(UNSIGNED(toResult), i*2));
result := result + toResult; --A&E Freezes if this line is included!!
end loop;
output <= result;
end process;
END;
我已经尝试注释掉这部分的各个部分,问题就出在那一行。这是 VHDL 还是 Quartus II 本身的语法问题?
使用 Quartus II 64 位版本 13.0.1 Build 232 06/12/2013 SJ Web Edition
更新: 我已经提供了我的其余代码,但它似乎不应该是错误的。该设计确实编译没有错误,但仅在近三个小时后。这是完整的设计:
LIBRARY ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_signed.all;
use ieee.numeric_std.all;
ENTITY booth_mul IS
PORT
(
Ain : IN STD_LOGIC_VECTOR(31 downto 0);
Bin : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
output : OUT STD_LOGIC_VECTOR(63 DOWNTO 0)
);
END booth_mul;
ARCHITECTURE booth_mul OF booth_mul IS
BEGIN
process(Ain, Bin)
variable result, temp, toResult: STD_LOGIC_VECTOR(63 downto 0);
variable toAdd, toSub : STD_LOGIC_VECTOR(31 downto 0);
begin
toAdd := Ain;
toSub := (0 - Ain);
for i in 0 to 31 loop
if i = 0 then
if Bin(0) <= '1' then
toResult(31 downto 0):= toSub;
end if;
else
if (Bin(i) <= '1' and Bin(i-1) <='0') then
toResult(31 downto 0):= toSub;
elsif (Bin(i) <= '0' and Bin(i-1) <='1') then
toResult(31 downto 0):= toAdd;
end if;
end if;
--
-- --Sign Extension
if toResult(31) <= '1' then
toResult(63 downto 32) := x"11111111";
else
toResult(63 downto 32) := x"00000000";
end if;
toResult := STD_LOGIC_VECTOR(SHIFT_LEFT(UNSIGNED(toResult), i*2));
result := result + toResult; --A&E Freezes HERE!!
end loop;
output <= result;
end process;
END;
【问题讨论】:
-
我在 2014 i7 笔记本电脑上用 Quartus 13.1 网络版在 54 分钟内合成了这个。这是很多逻辑:2082 个逻辑元素。
-
您有任何 VHDL 经验吗?您正在编写代码,就好像它是 CPU 代码一样。 VHDL(尤其是在综合时)需要不同的方法。