1
我正在嘗試創建一個減少長度的std_logic_vectors數組。我試圖用通用的std_logic_vector創建一個數組,然後使用generate語句來創建向量。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;
與返回通用std_logic_vector函數一起:我使用不當產生的語句
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結果的長度? – user1155120