0
我試圖讓集&負荷d-觸發器代碼(同步),但它一直給我count <= '0' & d; it has 2 elements but must have 9 elements
error.Thanks提前VHDL錯誤10344不知道該怎麼辦
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity syn is
port (
clk : in std_logic;
rst_n : in std_logic;
d : in std_logic;
ld : in std_logic;
q : out std_logic_vector(7 downto 0);
co : out std_logic);
end syn;
architecture rtl of syn is
signal count : std_logic_vector(8 downto 0);
begin
co <= count(8);
q <= count(7 downto 0);
process (clk)
begin
if (clk'event and clk = '1') then
if (rst_n = '0') then
count <= (others => '0'); -- sync reset
elsif (ld = '1') then
count <= '0' & d; -- sync load
else
count <= count + 1; -- sync increment
end if;
end if;
end process;
end rtl;
錯誤消息告訴你什麼是錯的 - 在這種情況下非常準確。 –
聚集,例如'count <= (0 => d,others =>'0');'其中count(0)被賦值爲d,其他(8 downto 1)賦值爲'0'。否則你的意圖不明確。你是否打算只加載兩個索引位置? – user1155120