2016-05-23 7 views
0

Quartus2V13.0SP1 DE1board VHDLVHDL、FPGA、プッシュボタン付き7セグメントLED

私は大学の学生です。

教授は、「CLOCKと「イベント」を使用しないでください。

昨日私は7セグメントLEDで逆オンオフを行っています。

今日この質問は多く編集されました。

以下のコードは正しい動作です。

そして、私は「イベント」なしでCode2でやりたいと思います。

--Code1 
library IEEE; 
use ieee.std_logic_1164.all ; 
use IEEE.std_logic_unsigned.all; 

entity increase is 
    port(
     key0 : in std_logic; 
     hex3 : out std_logic_vector(6 downto 0)); 
end increase; 

architecture RTL of increase is 
    signal hex3c : integer range 0 to 9; 
    begin 
     process(key0, hex3c)begin 
      if(key0' event and key0 = '0') then 
       if(hex3c = 9) then 
        hex3c <= 0;  
       else   
        hex3c <= hex3c + 1;    
       end if; 
      end if; 
     end process;   
    process(hex3c) 
    begin 
    case hex3c is 
     when 0 => hex3 <= "1000000"; 
     when 1 => hex3 <= "1111001"; 
     when 2 => hex3 <= "0100100"; 
     when 3 => hex3 <= "0110000"; 
     when 4 => hex3 <= "0011001"; 
     when 5 => hex3 <= "0010010"; 
     when 6 => hex3 <= "0000010"; 
     when 7 => hex3 <= "1111000"; 
     when 8 => hex3 <= "0000000"; 
     when others => hex3 <= "0010000"; 
     end case; 
    end process; 
end RTL; 

--Code2 
library IEEE; 
use ieee.std_logic_1164.all ; 
use IEEE.std_logic_unsigned.all; 

entity increase is 
    port(
     key0 : in std_logic; 
     hex3 : out std_logic_vector(6 downto 0)); 
end increase; 

architecture RTL of increase is 
    signal hex3c : integer range 0 to 9; 
    signal prev : std_logic; 
    begin 
     process(key0, hex3c, prev)begin 
      if(key0 = '0' and prev = '0')then 
       if(hex3c = 9) then 
        hex3c <= 0; 
        prev <= '1'; 
       else   
        hex3c <= hex3c + 1; 
        prev <= '1'; 
       end if; 
      elsif(key0 = '1' and prev = '1')then 
       prev <= '0'; 
      end if; 
     end process;   
    process(hex3c) 
    begin 
    case hex3c is 
     when 0 => hex3 <= "1000000"; 
     when 1 => hex3 <= "1111001"; 
     when 2 => hex3 <= "0100100"; 
     when 3 => hex3 <= "0110000"; 
     when 4 => hex3 <= "0011001"; 
     when 5 => hex3 <= "0010010"; 
     when 6 => hex3 <= "0000010"; 
     when 7 => hex3 <= "1111000"; 
     when 8 => hex3 <= "0000000"; 
     when others => hex3 <= "0010000"; 
     end case; 
    end process; 
end RTL; 

この問題を解決する方法をお願いします。

本当にこれを実現できますか?

+0

"no clockと' 'event' "はクロックを使用しないか、' 'event'よりも優れた' rising_edge() 'を使用しています。 – Paebbels

+0

おそらく私はこの課題でrising_edgeとfalling_edgeを使用できません。おそらく、この課題のルールから外れているかもしれません。 – rararoland

答えて

0

あなたは非同期カウンタを使いたいのですが、if(clock = '1' AND clock'event)ではなくrising_edge(clock)を探していますか?

+0

教授は、立ち上がりエッジと立ち下がりエッジを許可しないことがあります。同期カウンタとは、クロックを使用することですか? – rararoland

+0

非同期では、私は(システム)クロックなしで意味する、私は純粋に組み合わせている必要があります。 – pietervanderstar

+0

すみません。純粋にコンビナトリアルな手段は、「前のキー信号」と「現時点のキー信号」を使用する権利ですか?コード2など?はい、私は、 "クロック"、 "イベント"、 "rising_edge"と "falling_edge"なしで、立ち上がりエッジと立ち下がりエッジをキャッチしたい。私はそれが教授からの私たちの学生の割り当てだと理解しました。 – rararoland

0

私はあなたのコードをテストするために私の近くに評価ボードを持っていませんが、今私にとって問題になる可能性のある唯一のものは感度リストです。 countを入れて、いつでもディスプレイが更新されるようにしてください。

私があなたに与えることができるもう1つの提案は、すべての可能な場合を置きます。コンビナトリアルプロセスを使用する場合は、elseステートメントをプロセスに追加してください。

何か変更された場合は今すぐ教えてください。

+0

ありがとうございます。私は以下のコードを試しました。しかし何も変わっていない。 process(key0、count)begin – rararoland

+0

立ち上がり部分またはカウント+1が間違っていると思いますが、CLOCKおよび 'イベントなしで修正する方法がわかりません。 – rararoland

+0

私はcase文を 'else'部分に入れることを意味しませんでした。しかし、あなたの最後の 'elsif'文の後でそれを宣言するだけです。とにかく、前にそれをシミュレートしようとしましたか? –

関連する問題