長さを減らしてstd_logic_vectorsの配列を作成しようとしています。私は、ジェネリックstd_logic_vectorで配列を作成し、ベクトルを生成するためにgenerateステートメントを使用しようとしました。ジェネリックSTD_LOGIC_VECTORを返す関数と一緒にVHDL長さを短縮してSTD_LOGIC_VECTORSの配列を生成する
architecture behavioral of dadda_mul_32bit is
type and_planes is array (0 to 31) of std_logic_vector;
begin
generate_and_plane:
for i in 0 to 31 generate
and_planes(i) <= and_vector(a, b(i), i);
end generate generate_and_plane;
end behavioral;
:
function and_vector(vec: std_logic_vector; x: std_logic; length: natural) return std_logic_vector is
variable result: std_logic_vector(length - 1 downto 0);
begin
for i in 0 to length - 1 loop
result(i) := vec(i) and x;
end loop;
return result;
end function;
私が間違って生成するステートメントを使用していますか?
なぜあなたのAND結果にはaの長さがありませんか? – user1155120