FPGA開発日記

カテゴリ別記事インデックス https://msyksphinz.github.io/github_pages , English Version https://fpgadevdiary.hatenadiary.com/

Yosysの使い方を勉強する (2. RocketのVerilog実装をYosysでコンパイル)

次はChipyardで生成したRocket-Chipの実装をYosysで読ませてみたい。

Chipyardで生成したRocket-Chipの実装をYosysに読み込ませてElaborationするためには以下のコマンドを実行すればよい。

  • synth.cmd
read -sv chipyard.TestHarness.RocketConfig.top.v
hierarchy -top ChipTop
proc; opt
write_verilog chipyard.TestHarness.RocketConfig.synth.v
# write_cxxrtl  chipyard.TestHarness.RocketConfig.synth.cpp
write_rtlil   chipyard.TestHarness.RocketConfig.synth.rtlil
write_json    chipyard.TestHarness.RocketConfig.synth.json

なお、生成のトップレベルはChipTopだった。RocketTileかと思ったら違っていた。

これを再度ChipyardのVerilator生成環境にフィードバックしてシミュレーションバイナリを作成する。

オリジナルのVerilogでRTLシミュレーションを実行した結果は以下。

using random seed 1656825556
This emulator compiled with JTAG Remote Bitbang client. To enable, use +jtag_rbb_enable=1.
Listening on port 37189
Microseconds for one run through Dhrystone: 447
Dhrystones per Second:                      2236
mcycle = 223647
minstret = 196029
*** PASSED *** Completed after 323957 cycles

Yosys合成後のRTLシミュレーションの実行結果は以下。

using random seed 1656819754
This emulator compiled with JTAG Remote Bitbang client. To enable, use +jtag_rbb_enable=1.
Listening on port 34421
Microseconds for one run through Dhrystone: 447
Dhrystones per Second:                      2236
mcycle = 223647
minstret = 196029
*** PASSED *** Completed after 323957 cycles

うん、一致した。素晴らしい。