我正在尝试编写一个代码,用于在vhdl
中乘以两个100x100矩阵 library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use ieee.numeric_std.all;
library work;
use work.mult_100x100_pack.all;
entity multiplier_main_code is
Port ( in_matrix1 : in t_2d_array;
in_matrix2 : in t_2d_array;
out_matrix : inout t_2d_array);
end multiplier_main_code;
architecture Behavioral of multiplier_main_code is
begin
process(in_matrix1, in_matrix2)
begin
for i in 0 to 99 loop
for j in 0 to 99 loop
for k in 0 to 99 loop
out_matrix(i)(j) <= std_logic_vector(signed(out_matrix(i)(j)) + (signed(in_matrix1(i)(k)) * signed(in_matrix2(k)(j))));
end loop;
end loop;
end loop;
end Behavioral;
一次又一次地显示错误说:
期待“行为”的类型无效
“行为”附近的语法错误
mult_100X100_pack包的代码是:
library IEEE;
use IEEE.STD_LOGIC_1164.all;
use ieee.numeric_std.all;
package mult_100x100_pack is
type t_1d_array is array(integer range 0 to 99)of std_logic_vector(7 downto 0);
type t_2d_array is array(integer range 0 to 99)of t_1d_array;
end mult_100x100_pack;
拜托,有人可以帮我解决这个错误吗?
答案 0 :(得分:2)
修正缩进后,你应该很清楚你错过了什么:
process(in_matrix1, in_matrix2)
begin
for i in 0 to 99 loop
for j in 0 to 99 loop
for k in 0 to 99 loop
-- Do things
end loop;
end loop;
end loop;
-- Perhaps `end process;` might be appropriate here...
答案 1 :(得分:1)
您的<button id="Button">Generate a new div</button>
<div id="Frame"></div>
需要process
:
end process;
这说明了注意正确缩进代码的优点。如果您的所有 end loop;
end process;
end Behavioral;
都与其对应的end for
对齐,那么这一点就很明显了。