2 つのスイッチを使用して変数の値を制御したいと考えています。1 つは値を増やすためのもので、もう 1 つは値を減らすためのものです。このコードをどのように変更すればよいですか。エラーは、変数のカウントが合成できないことを示しています。私は多くのことを試しましたが、問題が正確に何であるかを理解できませんでした。
エラー:Xst:827 - 34 行目: 信号 count0 を合成できません。同期の記述が正しくありません。同期要素 (レジスタ、メモリなど) の記述に使用している記述スタイルは、現在のソフトウェア リリースではサポートされていません。
library IEEE;
use IEEE.std_logic_1164.ALL;
use IEEE.numeric_std.ALL;
entity counts is
port(
btn_up : in std_logic;
reset : IN STD_LOGIC;
btn_dn : in std_logic;
counted : out std_logic_vector(8 downto 0)
);
end entity counts;
architecture behaviour of counts is
signal counter : std_logic_vector(8 downto 0);
begin
btupprocess : process(btn_up,reset,counter)
variable counting : unsigned(8 downto 0);
begin
counting := unsigned(counter);
if(reset = '1') then
counting := (others => '0');
elsif (rising_edge(btn_up)) then
if(counting > 399) then
counting := counting - 1;
else
counting := counting + 1;
end if;
end if;
counter <= std_logic_vector(counting);
end process;
btndnprocess : process(btn_dn,counter)
variable counting : unsigned(8 downto 0);
begin
counting := unsigned(counter);
if (falling_edge(btn_dn)) then
if(counting < 200) then
counting := counting + 1;
else
counting := counting - 1;
end if;
end if;
counter <= std_logic_vector(counting);
end process;
counted <= counter;
end behaviour;