接下來的ssd過程就是向我展示我對這兩個用戶所擁有的東西。代碼ATM似乎很好地存儲了這兩個用戶的數據,並且在任何給定的時間內都可以記住它。然而,問題是,我似乎無法改變這樣一個事實,即只要按下其中一個按鈕,就可以通過小數點1-來增加或減少兩位用戶的數字。無論如何,它都會更改第一個用戶的號碼。開關(7)是「1」還是「0」並不重要。另外,我可以選擇第二個用戶,但我也不能對他進行任何更改 - 這些按鈕隻影響第一個用戶。這是我的問題,我不知道爲什麼發生這種情況,但我唯一的直覺是,我在這裏有一個可怕的設計。反正下面是感興趣的和有用的代碼:VHDL one如果在每種情況下都是成立的,另一個不是
process (clk)
begin
if(switch(7) <= '1') then --first user
if(rising_edge(clk)) then
if(btn(0)='1' and lastButtonState(0) = '0') then--increase by 1
user0 <= user0 + "001";
end if;
lastButtonState(0) <= btn(0);
if(btn(1) = '1' and lastButtonState(1) = '0') then --decrease by 1
user0 <= user0 + "111";
end if;
lastButtonState(1) <= btn(1);
end if;
elsif (switch(6) = '1') then --second user
if(rising_edge(clk)) then
if(btn(0) = '1' and lastButtonState(0) = '0') then
user1 <= user1 + "001";
end if;
lastButtonState(0) <= btn(0);
if(btn(1) = '1' and lastButtonState(1) = '0') then
user1 <= user1 + "111";
end if;
lastButtonState(1) <= btn(1);
end if;
end if;
end process;
process (user0, user1, switch)
begin
if(switch(7) = '1') then
case user0 is
when "000" => a_to_g <= "0000001";
when "001" => a_to_g <= "1001111";
when "010" => a_to_g <= "0010010";
when "011" => a_to_g <= "0000110";
when "100" => a_to_g <= "1001100";
when "101" => a_to_g <= "0100100";
when "110" => a_to_g <= "0100000";
when others => a_to_g <= "0001111";
end case;
elsif (switch(6) = '1') then
case user1 is
when "000" => a_to_g <= "0000001";
when "001" => a_to_g <= "1001111";
when "010" => a_to_g <= "0010010";
when "011" => a_to_g <= "0000110";
when "100" => a_to_g <= "1001100";
when "101" => a_to_g <= "0100100";
when "110" => a_to_g <= "0100000";
when others => a_to_g <= "0001111";
end case;
end if;
end process;
該代碼有幾個問題。然而,目前造成麻煩的具體問題可能是您實際上並不測試開關7 =「1」。小於或等於,是的。等於,不。 –
什麼是ssd進程?固態硬盤還是七段顯示器?請不要使用非常用的縮寫。 – Paebbels
您也可以用VHDL標記任何語句,包括進程語句。哪兩個過程被認爲是ssd?什麼是'代碼atm'?您的兩個進程不包含[最小,完整和可驗證示例](http://stackoverflow.com/help/mcve)。 – user1155120