Xilinx ISE Webpack 気づいた点 のバックアップ(No.5)

更新


概要

Xilinx ISE Webpack 関連で気づいたバグや改善要望などを。

本来ここに書いても仕方がないのですが、 もし同じ問題を抱える方々の助けになれば、ということで書いてみます。

古い記事

電気回路/HDL/Xilinx ISE 12.1で気づいた点

電気回路/HDL/Xilinx ISE 12.2で気づいた点

Xilinx ISE Webpack 14.2: CPLD プロジェクトの Fitting フェーズで Segmentation Fault エラー

CPLD 用の Verilog コードを Project Navigator から論理合成したところ、 Fitting がエラーで止まってしまいました。

ISE 上での表示:

Considering device XC95288XL-7-TQ144.
Flattening design..
Multi-level logic optimization...
Timespec optimization..........................................
Timing optimization............................................
Timespec driven global resource optimizationAll paths with TIMESPECs have been optimized.

Timing driven global resource optimization
General global resource optimization........
Re-checking device resources ...
Mapping a total of 83 equations into 16 function blocks........
 
Design main has been optimized and fit into device XC95288XL-7-TQ144.
ERROR:ProjectMgmt:387 - TOE: ITclInterp::ExecuteCmd gave Tcl result 'can't read "iFileType": 
no such variable'.

Tcl_ErrnoId: unknown error
Tcl_ErrnoMsg: No error
_cmd: ::xilinx::Dpm::dpm_chTransformExecute dpm_fitterRun $piThisInterface
errorInfo: can't read "iFileType": no such variable
    while executing
"if { $iFileType eq "UNKNOWN" } {
                continue ; # unknown is just ignored, its probably .txt
              }"
    ("foreach" body line 3)
    invoked from within
"foreach sItem $lOutputFileList {
            if { ![dpm_parseOutputFile $sItem $iDesign sFile iFileType fileOrigination] } {
              if { $iFile..."
    (procedure "dpm_chTransformOutput" line 15)
    invoked from within
"dpm_chTransformOutput $iTranInst $lOutputFileList"
    (procedure "dpm_fitterRun" line 477)
    invoked from within
"$sCmd $iTransformInstance $sCmdArgs"
    (procedure "dpm_chTransformExecuteEngine" line 100)
    invoked from within
"dpm_chTransformExecuteEngine $sFlowProc $iInterface $bRunTransformWithEmptyInputSet "
    (procedure "::xilinx::Dpm::dpm_chTransformExecute" line 3)
    invoked from within
"::xilinx::Dpm::dpm_chTransformExecute dpm_fitterRun $piThisInterface"

おかしなエラーで Fitting が終了できません。

Design main has been optimized and fit into device XC95288XL-7-TQ144.

と出た後に、

ERROR:ProjectMgmt:387 - TOE: ITclInterp::ExecuteCmd gave Tcl result 'can't read "iFileType": no such variable'.

とか、明らかにツールのバグっぽいエラーが生じているのですが、 同様の問題に関する ISE 13.4 に関する報告は、

http://forums.xilinx.com/t5/CPLDs/Please-help-with-Nonsense-error-ProjectMgmt-387-TOE-when-running/td-p/230943

に1件だけあって、原因も不明のまま放置されていたようでした。
(後に、ここで得た結果を私自身が書き込みました)

リンク先では「他の機能を追加していったらいつの間にかエラーが消えた」 という、一応のハッピーエンドだったので放置されたんだと思うのですが、 こちらのコードはもうこれで完成なので、これが通らないと困ってしまいます。

むむぅ。

どうやらエラーを吐いているのは Project Navigator 側のバグっぽい、 と感じたため cpldfit を直接コマンドラインから実行してみたところ、

LANG:console
$ cpldfit -intstyle ise -p xc95288xl-7-TQ144 -ofmt vhdl -optimize speed 
 -htmlrpt -loc on -slew fast -init low -inputs 54 -pterms 50 -unused ground 
 -power std -terminate keeper main.ngd

WARNING:Cpld - Unable to retrieve the path to the iSE Project Repository. 
Will use the default filename of 'main.ise'.

... (中略) ...

Timing driven global resource optimization
General global resource optimization........
Re-checking device resources ...
Mapping a total of 83 equations into 16 function blocks...................
..........................

Design main has been optimized and fit into device XC95288XL-7-TQ144.
Segmentation fault

となって、cpldfit が最後に SEGV でコケていることが判明しました。

Project Navigator がこれを正しくハンドリングできていないことが上記のエラーの 直接の原因ですが、その前に cpldfit が SEGV するのを何とかしないと先には進めない。

とはいえ、これだけの情報では結局理由が分からず困っています・・・

状況・試したこと

Cleanup Project Files

上記リンク先でも報告されているとおり、

  • Cleanup Project Files...

では変化はありませんでした。

Warning の確認

Rebuild All した際に表示される Warning は、 Synthesize フェーズに出る

WARNING:Cpld - Unable to retrieve the path to the iSE Project Repository. Will
use the default filename of 'main.ise'.

だけで、この警告は

http://japan.xilinx.com/support/answers/38791.htm

によれば無視して良いとのこと。

どこでこけているか

Fitting がうまくいった場合、

Design main has been optimized and fit into device XC95288XL-7-TQ144.

Started : "Generate HTML report".
Running XSLTProcess...
Command Line: XSLTProcess main_build.xml
Release 14.2 - CPLD HTML Report Processor P.28xd (nt64)
Copyright (c) 1995-2012 Xilinx, Inc.  All rights reserved.

Process "Generate HTML report" completed successfully

Started : "Generate Post-Fit Timing Data".
Running tsim...
Command Line: tsim -intstyle ise main main.nga
Creating NGA for simulation.
Speed File: Version 3.0

Process "Generate Post-Fit Timing Data" completed successfully

Process "Fit" completed successfully

Started : "Generate Timing".
Running taengine...
Command Line: taengine -intstyle ise -f main -w --format html1 -l main_html/tim/timing_report.htm
Release 14.2 - Timing Report Generator P.28xd (nt64)
Copyright (c) 1995-2012 Xilinx, Inc.  All rights reserved.
Path tracing ........
The number of paths traced: 708.

....
The number of paths traced: 1417.

Checking for asynchronous logic...
No asynchronous logic found.
Generating TA GUI report ...
Generating detailed paths report ...

main_html/tim/timing_report.htm has been created.

Process "Generate Timing" completed successfully

のようになるはずで、

Design main has been optimized and fit into device XC95288XL-7-TQ144.

の次は、

Started : "Generate HTML report".

が続きます。

論理合成が済んで、HTML レポートを作成するまでの間でこけている?

HTML レポートを作らせない

そこで、コマンドラインから -htmlrpt オプションを除いてみたけれど、 結果は変わりませんでした。

Fit の Process Options -> Implementation Template = Optimize Speed

Fit の Process Options の中で、 Implementation Template が Balance になっていたのを、Speed に変更したところ、 上と変わりませんでした。

Fit の Process Options -> Implementation Template = Optimize Density

Implementation Template を Density に変更したところ、

Re-checking device resources ...
ERROR:Cpld:853 - Insufficient number of product terms.  This design needs at
   least 1508 but only 1440 left after allocating other resources.
Device 95288XL144 was disqualified.
ERROR:Cpld:868 - Cannot fit the design into any of the specified devices with
   the selected implementation options.

となって、フィッティングができないと言われました。 Density にしたら入り切らなくなると言うのもおかしな話ですね。

Macrocells UsedPterms UsedRegisters UsedPins UsedFunction Block Inputs Used
16/288 (6%)20/1440 (2%)5/288 (2%)31/117 (27%)46/864 (6%)

レポートを見る限り入りきらない訳もなさそうなのですが・・・

Logic Optimization を Speed から Density にしても、 Implementation Template が Optimize Density だと上記のエラー。

Exhaustive Fit Mode = on

Exhaustive Fit Mode を on にすると、

pterm limit: 90 and input limit: 54

から、徐々に input limit を減らして試すようで、

pterm limit: 90 and input limit: 24

の時に、

INFO:Cpld:994 - Exhaustive fitting is trying pterm limit: 90 and input limit: 24
Considering device XC95288XL-7-TQ144.
Multi-level logic optimization...
Timespec optimization..............................................................................................................................................................................
Density optimization........   
Timespec driven global resource optimization All paths with TIMESPECs have been optimized.

General global resource optimization........
Re-checking device resources ...
Mapping a total of 86 equations into 16 function blocks...........................................................................................................................................................................................................................................................

Design main has been optimized and fit into device XC95288XL-7-TQ144.
ERROR:Cpld:1244 - Unexpected Exceptions

Started : "Generate HTML report".
Running XSLTProcess...
Command Line: XSLTProcess main_build.xml
Release 14.2 - CPLD HTML Report Processor P.28xd (nt64)
Copyright (c) 1995-2012 Xilinx, Inc.  All rights reserved.
ERROR:Cpld:1244 - Unexpected Exceptions

Process "Generate HTML report" completed successfully

Started : "Generate Post-Fit Timing Data".
Running tsim...
Command Line: tsim -intstyle ise main main.nga
Creating NGA for simulation.
Speed File: Version 3.0

Process "Generate Post-Fit Timing Data" completed successfully

Process "Fit" completed successfully

Started : "Generate Timing".
Running taengine...
Command Line: taengine -intstyle ise -f main -w --format html1 -l main_html/tim/timing_report.htm
Release 14.2 - Timing Report Generator P.28xd (nt64)
Copyright (c) 1995-2012 Xilinx, Inc.  All rights reserved.
Path tracing ........
The number of paths traced: 789.

....
The number of paths traced: 1579.

Checking for asynchronous logic...
No asynchronous logic found.
Generating TA GUI report ...
Generating detailed paths report ...

main_html/tim/timing_report.htm has been created.

Process "Generate Timing" completed successfully

となって、途中で

ERROR:Cpld:1244 - Unexpected Exceptions

を2度吐いているにも関わらず、うまくいったことになりました。

Generate Programming File も、

Started : "Generate Programming File".
Running hprep6...
Command Line: hprep6 -s IEEE1149 -n main -i main
Release 14.2 - Programming File Generator P.28xd (nt64)
Copyright (c) 1995-2012 Xilinx, Inc.  All rights reserved.

Process "Generate Programming File" completed successfully

のようにすんなり通りましたが・・・これでできた回路を実機に入れて試して良い物かどうか・・・

Input Limit の初期値は Fit の Process Properties の中で Collapsing Input Limit として設定できるので、 これをはじめから 24 にしておけば、Fit にかかる時間を減らせそうです。

動いていない感じ

うーん、案の定というか何というか、上記のようにして無理矢理合成した回路は実機で動きませんでした。

全然動かないわけではないのですが、カウンタが必要以上に回っている感じでシミュレーション結果と合いません。

クロック周波数に掛けている制約を満たせていないのにそのままになっている雰囲気なのですが、 上記を見る限り Timing Report などはちゃんと走っていそうなので、そんなことがあるのかどうか、 いまいち自信を持てないでいます。

原因を突き止めました => -ofmt VHDL

これがいけなかったみたいです。

Fit の Process Properties で -ofmt を ABEL (default?) にしたところ、上記エラーは出なくなりました。

Fitting が終わって、HTML Report の出力の手前でこけていた原因としては妥当ですね。。。

Map 中の WARNING Pack:266 について

Pack:266 - The function generator <some_thing> failed to merge with 
F5 multiplexer <some_other_thing>. There is a conflict for the FXMUX. 
The design will exhibit suboptimal timing.

という警告が出て、その内容が気になったのですが、結局よく分かりませんでした。

入りきらないということ?

http://rubidium.dyndns.org/pipermail/fpga-synth/2007-March/000814.html

によれば気にすることはない、ということで、確かに Timing Constraint を満たしている限りは見なかったことにしても良いのかもしれませんね。

ISim の Simulation Terminated エラー

あるテストベンチを ISim で走らせたところ、

The simulator has terminated in an unexpected manner. Please review
the ISim log (isim.log) for details.

というメッセージが出ました。ISim 14.2 です。

ISim の Console には、

LANG:console
ERROR: FATAL ERROR:ISim: This application has discovered an exceptional condition from which it 
cannot recover. Process will terminate. To search for possible resolutions to this issue, refer to 
the Xilinx answer database by going to http://www.xilinx.com/support/answers/index.htm and search 
with keywords 'ISim' and 'FATAL ERROR'. For technical support on this issue, please open a WebCase 
with this project attached at http://www.xilinx.com/support.ERROR: The simulation failed to launch 
for the following reason:
  The Simulation shut down unexpectedly during initialization.  Please review the ISim log 
  (isim.log) for details.
Please shut down ISim and retry the simulation.  If the problem persists, please contact Xilinx 
support.
Time resolution is 1 fs
No active Database
Unable to execute live simulation command.

The simulation has terminated.

が表示されています。

言われたとおりに (project)\isim.log を見てみても、同じ内容が書かれているだけでげんなりします。
(project)\isim\(testbench)\isimkernel.log も同じ内容です。

(project)\isim\(testbench)\isimcrash.log にはスタックトレースが残っていて、

LANG:console
Exception at PC 0x000000018008768E
Attemped to read address 0xFFFFFFFFFFFFFFFF
Printing stacktrace...

[0] (HSimNetDriver::operator=+0xb38e) [0x0x000000018008768e]
[1] (HSimNetDriver::operator=+0xb38e) [0x0x000000018008768e]
[2] (xsi_vlog_namedbase_setdisablestate+0xa544) [0x0x0000000180047744]
[3] (HSimBaseProcess::setCurrentWaitInfo+0xec7c) [0x0x000000018003735c]
[4] (HSimBaseProcess::setCurrentWaitInfo+0x54d2) [0x0x000000018002dbb2]
[5] (HSimBaseProcess::setCurrentWaitInfo+0xe35c) [0x0x0000000180036a3c]
[6] (HSimBaseProcess::setCurrentWaitInfo+0x54d2) [0x0x000000018002dbb2]
[7] (xsi_run_simulation+0x1f0) [0x0x0000000180122cb0]
[8]  [0x0x000000000040180e]
Done

xsi_vlog_namedbase_setdisablestate の中で HSimNetDriver の代入演算子 operator= でアドレス 0xFFFFFFFFFFFFFFFF を参照してこけていることが分かります。

代入演算子をオーバーロードしているあたりはちょっとアレな感じもしますが、 ここからだとなんだか分からないですね。disable を呼んでいるところが問題なのかも しれません?

未だコードのどこを直せばよいのか分からず、あちこち削っては試しています。

特定しました

かなり時間がかかりましたが、原因を特定できました。

以下のごく単純なコードで再現します。

LANG:verilog
module test_tb;

    wire [7:0] test;        // 8 bit しかないのに
    assign test[8] = 0;     // 9bit 目に assign する

endmodule

本来ならビット幅を超えているというエラーが出るはずが、 エラーを出さずにコンパイラーがこけてしまったわけです。

確かにスタックトレースの示すとおり、 ネットドライバーを設定するところでこけてましたね。

実際のコードでは generate for の中でパラメータの指定を間違って、 下位モジュールに存在しないビットを渡していました。

コンパイラーが正しくエラーを出してくれれば数秒で直せるところ、 コンパイラーのバグ探しで1時間以上かかってしまいました(怒

コメント





Counter: 30273 (from 2010/06/03), today: 1, yesterday: 2