宿題にこれらのSTD_LOGIC_VECTORを追加するにはどうすればよいですか? [閉まっている]

StackOverflow https://stackoverflow.com/questions/633081

  •  08-07-2019
  •  | 
  •  

質問

コードをデバッグした後、コンパイラーがそれを受け入れるようになりましたが、シミュレーター例外をスローします。

私が抱えていた主な問題は、一時配列の初期化と最後にベクトルを追加することです。

STD_LOGIC_VECTORを追加できないため、追加に使用する方法はリファレンスで見つけたものです

ありがとう、 ブズキー

library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.numeric_std.all;

entity signedmult is 
port (cand, lier: in std_logic_vector (4 downto 0);
    pro: out std_logic_vector (9 downto 0)); 

end signedmult;     


architecture synth of signedmult is
      --temp arrays
      signal a,b,c,d,e: std_logic_vector(9 downto 0); 

begin
process (a,b,c,d,e)
        variable j:integer;
begin

for j in 0 to 9 loop
a(j) <= '0';
b(j) <= '0';
c(j) <= '0';
d(j) <= '0';
e(j) <= '0';

end loop;

end process;

process (cand, lier,a,b,c,d,e)      
        variable i:integer;     
begin
    for i in 0 to 4 loop
     a(i) <= cand(0) and lier(i);
     b(i+1) <= cand(1) and lier(i);
        c(i+2) <= cand(2) and lier(i);
        d(i+3) <= cand(3) and lier(i);
        e(i+4) <= cand(4) and lier(i);
    end loop;

end process;

  a(5) <= a(4); a(6) <= a(4); a(7) <= a(4); a(8) <= a(4);

  b(6) <= b(5); b(7) <= b(5); b(8) <= b(5);

  c(7) <= c(6); c(8) <= c(6);

  d(8) <= d(7);

  pro <= std_logic_vector(unsigned(a) + unsigned(b)); -- + c + d + e;


end synth;
役に立ちましたか?

解決

まず std_logic_arith を削除して、 numeric_std との競合を回避する必要があります。

完了したら、なぜ追加が機能しないのかわかりません。

実行中にどのようなエラーが発生しますか?

また、おそらく複数のプロセスからシグナルを駆動します。 a および b でゴミを取得します。それがエラーの原因ですか? 一時配列へのすべての割り当てを1つのプロセスに入れてみてください。

他のヒント

すばやく簡単な方法:

a(9 downto 0) <= (others=>'0');
b(9 downto 0) <= (others=>'0');
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top