不會動的程式碼:
library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
entity test is
port (
CLK : in std_logic;
SO : out std_logic_vector(2 downto 0)
);
end test;
architecture output of test is
signal buf : std_logic_vector(2 downto 0) := "000";
begin
process(CLK)
begin
buf <= buf + 1;
SO <= buf;
end process;
end output;
會動的程式碼:
library ieee;
Use ieee.std_logic_1164.all;
Use ieee.std_logic_arith.all;
Use ieee.std_logic_unsigned.all;
entity test is
port (
CLK : in std_logic;
SO : out std_logic_vector(2 downto 0)
);
end test;
architecture output of test is
signal buf : std_logic_vector(2 downto 0) := "000";
begin
process(CLK)
begin
if ((CLK'event) and (CLK='1')) then
buf <= buf + 1;
SO <= buf;
end if;
end process;
end output;作者: ryoownt 時間: 2016-6-1 23:45:20