這是一個VHDL代碼序列1-2-3-4-6-7計數,但似乎計數形式1-7 的代碼似乎有一個邏輯錯誤的地方。請幫助我想實現在一個VHDL計數器1-2-3-4-6,但計數遞增形式1-7。
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity newtest is
port(C, CLR : in std_logic;
Q : out std_logic_vector(2 downto 0));
end newtest;
architecture archi of newtest is
signal tmp: std_logic_vector(2 downto 0);
begin
process (C, CLR)
begin
if (CLR='1') then
tmp <= "000";
elsif (C'event and C='1') then
if (tmp="100") then
tmp <= tmp + 1;
end if;
tmp <= tmp + 1;
end if;
end process;
Q <= tmp;
end archi;
信號賦值語義的基本誤解的附加項的輸入。 http://stackoverflow.com/questions/13954193/is-process-in-vhdl-reentrant/13956532#13956532應該犯的錯誤明確。 '如果(TMP = 「100」),那麼 TMP <= TMP + 2;'可能工作 –