1

VHDL モジュールを作成しようとしていますが、入力に問題があります。コードは次のとおりです。

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
--use ieee.std_logic_arith.all;
use ieee.std_logic_signed.all;


entity binary_add is
    port( n1 : in std_logic_vector(3 downto 0);
    n2 : in std_logic_vector(3 downto 0);
    segments : out std_logic_vector(7 downto 0);
    DNout : out std_logic_vector(3 downto 0));

end binary_add;

architecture Behavioral of binary_add is
begin

DNout <= "1110";

process(n1, n2)

variable x: integer;


begin

x:= conv_integer(n1(3)&n1(2)&n1(1)&n1(0)) + conv_integer(n2(3)&n2(2)&n2(1)&n2(0));

if(x = "0") then

segments <= "10000001";

elsif(x = "1") then

segments <= "11001111";

else

segments <= "00000000";

end if;

end process;

end Behavioral;

次のエラーが表示されます。

WARNING:PhysDesignRules:367 - The signal <n1<1>_IBUF> is incomplete. The signal
   does not drive any load pins in the design.
WARNING:PhysDesignRules:367 - The signal <n1<2>_IBUF> is incomplete. The signal
   does not drive any load pins in the design.
WARNING:PhysDesignRules:367 - The signal <n1<3>_IBUF> is incomplete. The signal
   does not drive any load pins in the design.
WARNING:PhysDesignRules:367 - The signal <n2<1>_IBUF> is incomplete. The signal
   does not drive any load pins in the design.
WARNING:PhysDesignRules:367 - The signal <n2<2>_IBUF> is incomplete. The signal
   does not drive any load pins in the design.
WARNING:PhysDesignRules:367 - The signal <n2<3>_IBUF> is incomplete. The signal
   does not drive any load pins in the design.
WARNING:Par:288 - The signal n1<1>_IBUF has no load.  PAR will not attempt to route this signal.
WARNING:Par:288 - The signal n1<2>_IBUF has no load.  PAR will not attempt to route this signal.
WARNING:Par:288 - The signal n1<3>_IBUF has no load.  PAR will not attempt to route this signal.
WARNING:Par:288 - The signal n2<1>_IBUF has no load.  PAR will not attempt to route this signal.
WARNING:Par:288 - The signal n2<2>_IBUF has no load.  PAR will not attempt to route this signal.
WARNING:Par:288 - The signal n2<3>_IBUF has no load.  PAR will not attempt to route this signal.
WARNING:Par:283 - There are 6 loadless signals in this design. This design will cause Bitgen to issue DRC warnings.

エラーは複雑に見えますが、実際には、n1 および n2 信号の他の 3 つの入力をルーティングできないと表示されています。なぜこれが起こっているのかわかりませんが、私がしたいのは、n1 と n2 の符号付き数値の合計を 7 セグメント ディスプレイに表示することだけです。誰かがこの問題を理解するのを手伝ってくれるなら、本当に感謝しています。

4

1 に答える 1

3

最初に:使用しないでくださいstd_logic_arithまたはstd_logic_signed-私はなぜそうしないかについて書きました。2番目:非同期プロセスを作成しました。これは、同期方式で使用するように設計された(およびツールが使用することを想定している)FPGAでは適切な方法ではありません。クロック入力を作成して使用します。非同期で行うこともできますが、自分が何をしているかが本当にわかるまでは避けください。自分が何をしているのかを本当に理解したら、それがどれほど厄介になるかを理解しているので、それも避ける可能性があります:)

signedタイプとのポートを作成しますuse ieee.numeric_stdd.all;。またはinteger、入力ポートのタイプを使用することもできます。これが最上位のブロックである場合は、ラッパーを配置して、最も外側のピンでstd_logic_vectorsを取得し、それらを整数に変換して、上記で記述したブロックにフィードする必要があります。

n1 <= to_integer(signed(n1_pins));

次に、このようなことをする必要があります...

architecture Behavioral of binary_add is
begin
DNout <= "1110";
process(clk)
  variable x: integer;
begin
  x:= n1+n2;
  case x
    when 0 => segments <= "10000001";
    when 1 => segments <= "11001111";

または、整数を7セグメントに変換する定数配列を作成して実行します

segments <= int_to_7seg(x);
于 2010-11-03T13:48:44.827 に答える