1

Verilog コードの合成でいくつかの問題に直面していますが、シミュレーションは問題ないようです。

具体的には、次のように定義されたモジュール..

module nexys2_sevensegment(
  input clk,
  input [NUM_CHARS*4-1: 0] disp_chars,
  output [NUM_CHARS-1: 0] anodes,   // The common cathodes for each display.
  output [6: 0] cathodes // The seven segments in the form {G,F,E,D,C,B,A}
  );

  parameter NUM_CHARS = 4; // The number of characters that need to be
                           // displayed. Should be in [1, 4].

そして、次のようにインスタンス化されます。

  nexys2_sevensegment #(4) seven_seg_disp(clk, disp_bus, an, seg);

シミュレーションは正常に動作しているようですが、合成すると次のエラーが発生します。

=========================================================================
*                          HDL Compilation                              *
=========================================================================
Compiling verilog file "nexys2_sevensegment.v" in library work
ERROR:HDLCompilers:28 - "nexys2_sevensegment.v" line 8 'NUM_CHARS' has not been declared
ERROR:HDLCompilers:28 - "nexys2_sevensegment.v" line 9 'NUM_CHARS' has not been declared
Compiling verilog file "tb_nexys2_seven_segment.v" in library work
Module <nexys2_sevensegment> compiled
Module <tb_nexys2_seven_segment> compiled
Analysis of file <"tb_nexys2_seven_segment.prj"> failed.

Spartan3e-1200 - Digilent Nexys2でザイリンクスに取り組んでいます。

ありがとう !

4

2 に答える 2

5

パラメータを使用している場合は、使用する前に宣言する必要があります。試す:

module nexys2_sevensegment
  #( parameter NUM_CHARS=4 )
  (
  input clk,
  input [NUM_CHARS*4-1: 0] disp_chars,
  output [NUM_CHARS-1: 0] anodes,   // The common cathodes for each display.
  output [6: 0] cathodes // The seven segments in the form {G,F,E,D,C,B,A}
  );

  // ( remove parameter statement here )

コンパイラはNUM_CHARS、ポート定義でそれを確認する前に、 の定義を検出しました。

これを機能させるには、コンパイラで Verilog-2001 スイッチを設定する必要がある場合があります。

于 2012-05-22T17:36:27.400 に答える
4

ポートリストの後にポート宣言を使用することもできます。

//non-ANSI style header
module nexys2_sevensegment(
  clk,
  disp_chars,
  anodes,   // The common cathodes for each display.
  cathodes // The seven segments in the form {G,F,E,D,C,B,A}
  );

  parameter NUM_CHARS = 4; // The number of characters that need to be
                           // displayed. Should be in [1, 4]

  input                     clk;
  input  [NUM_CHARS*4-1: 0] disp_chars;
  output [NUM_CHARS-1: 0]   anodes;   // The common cathodes for each display.
  output [6: 0]             cathodes; // The seven segments in the form {G,F,E,D,C,B,A}

endmodule
于 2012-05-23T01:26:59.707 に答える