【发布时间】:2014-06-20 01:05:59
【问题描述】:
我试图通过 vhdl 中的类型转换返回类型 std_logic_vector。 这是我的代码:
function mul(num1,num2 : in std_logic_vector(7 DOWNTO 0)) return std_logic_vector is
variable v_TEST_VARIABLE1 : integer;
variable v_TEST_VARIABLE2 : integer;
variable n_times: integer:=1;
variable product: integer:=0;
begin
for n_times in 1 to v_TEST_VARIABLE2 loop
product:=product + v_TEST_VARIABLE1;
end loop;
return std_logic_vector(product);
end mul;
它在编译时给出"Illegal type conversion from std.standard.integer to ieee.std_logic_1164.std_logic_vector (numeric to array)."。
如何在这样的代码中返回 std_logic_vector?
【问题讨论】:
标签: type-conversion vhdl