0

32ビットの入力を取り、一度に2ビットを出力する小さなコードを書いています。シミュレーションの試行に基づいて、while ループから無限ループの問題が発生していると思います。私が見た他のループの例と比較して、すべてが私には正しいように見えます。私が間違っている可能性がある手がかりはありますか?

library ieee;
use ieee.std_logic_1164.all;

entity regA is 
port(mpcnd: in std_logic_vector(31 downto 0);
      clk: in std_logic;
      twobits: out std_logic_vector(1 downto 0));
end regA;

architecture behavior of regA is 
begin
process
variable count: integer;
begin
count := 0;
while (count < 32) loop
    if rising_edge(clk) then
    twobits(0) <= mpcnd(count);
    twobits(1) <= mpcnd(count+1);
    count := count + 2;
    end if;
end loop;
end process;
end behavior;
4

1 に答える 1

1

プロセスの場合、機密リストまたは待機ステートメントが必要です。プロセスの (合成可能ではなくシミュレート可能な) バージョンは次のようになります。

process
    variable count: integer;
begin
    count := 0;
    while (count < 32) loop
    wait until rising_edge(clk);-- if rising_edge(clk) then
    twobits(0) <= mpcnd(count);
    twobits(1) <= mpcnd(count+1);
    count := count + 2;
--end if;
end loop;
end process;
于 2013-03-30T17:27:52.847 に答える