ハードウェアの気になるあれこれ

技術的に興味のあることを調べて書いてくブログ。主にハードウェアがネタ。

Chisel3.4.0のリリースノートを確認した(1) - 概要編

スポンサーリンク

Chisel3.3.0の確認をーーー、、、急がないと3.4.0がー!!ってやってたらChisel3.4.0がリリースされました。
Chisel3.3.0の変更点の確認は、気になったやつは前回で一応おわってて、後はリリースノート確認中に「こんな機能あったんか」案件だったため、ギリギリChisel3.4.0に間に合ったということで。。。

そんなわけで、Chisel3.4.0のリリースノートの確認をしていこうと思う。

Chisel v3.4.0がリリースされた

改めて、Chisel v3.4.0が10/7にリリースされました。

ということで、Chisel3.3.0のときと同様にリリースノートについて、見ていこうと思う。 初回はリリースノートをざっと見て、簡単に内容をまとめる。

先にざっくりまとめ

今回はなんと言っても"naming"と呼ばれている(っぽい)件が目玉。 "_T_xx"のような中間の信号に、Chiselのソースコード中の変数名が使われたり、不要な中間変数については生成自体が抑制されたりして、生成されるRTLの可読性がかなり上がるみたい。 以下のPRが、本件に関する機能のPR。

  • (#1448) Improved Chisel Naming via Compiler Plugins + Prefixing

気になるのが、以下のPRで、ioがdeprecated扱いになったことの影響がどこまでなのかがわからない。

  • (#1550) Deprecate Module.io and BlackBox.io virtual methods (future 2.13 compatibility)

後は次の2つもどういう事が出来るのかがPRを読んだだけでは分からなかったので、上記の2つの後にでも追って試してみたいと思う。

  • (#1499) Basic model checking API : アサーション用のAPIが増えた模様
  • (#1073) Grouping Chisel API, added a chisel annotation API for triggering the firrtl.transforms.GroupComponents transformation. : groupというメソッドが増えてるんだけど、効果がイマイチつかめなかった。

その他だとドキュメント関連で、これまで公開されていたWiki等のソースなども含んだ一式がまとめて"docs"ディレクトリの下に格納されている。とりあえずChiselのリポジトリを見れば、これらの情報にアクセス出来るのは結構ありがたい。ここには上記に書いた"naminig"についてのドキュメントとかも入っているので、後でキッチリ読んでみようと思った。

API Modification

(#1563) Better Building of FIRRTL From Source, Use sbt-sriracha for firrtl and treadle source deps

Firrtlをソースコードからビルドする際にsbt-srirachaを使って、よりクリーンな方法でビルドできるようにした、らしい。Chisel使うときに、githubのデータをそのまま使うことが無いから、いまいちピンときてない。

(#1580) Add new annotation for Chisel Circuit serialization, --chisel-output-file is added to the ChiselCli.

ChiselCircuitAnnotationCustomFileEmissionを継承するのではなく、Unserializableを継承するようにした。またChiselCircuitAnnotationChiselOutputFileAnnotationからなるCircuitSerializationAnnotationを構築するフェーズAddSerializationAnnotationsを追加された。 これによって--chisel-output-fileオプション仕様時に、*.fir*.pbの両方の形式のファイルを出力できるようになった。

(#1476) Move LFSR16 to Compatibility Mode (Deprecated in 3.2), - Remove deprecated LFSR16 utility

LFSR16というユーティリティがchisel3.utilからChisel._に移動された。

(#1550) Deprecate Module.io and BlackBox.io virtual methods (future 2.13 compatibility)

Module.io/BlackBox.ioというメソッドがdeprecated扱いに変更された。

Fixes

(#1568) Relax plugin scalac phase order

この報告にまつわるバグの修正。プラグイン絡み??

Feature

(#1448) Improved Chisel Naming via Compiler Plugins + Prefixing

今回の目玉機能。コンパイラプラグインprefixというメソッドが導入された。 コンパイラプラグインによって、Chiselのコード中の変数名の多くが、そのままRTLの信号名として使用されるようになった。 またprefixメソッドを使用することで、信号名に任意のプリフィックスの付与を行い、RTLの可読性を向上させることができるようになった。

PRに載っている効果は次の通りで、16000あった"anonymous wires"が1400まで減ったとのこと。

  • Just auto-naming: reduced number of Chisel source locations which generated anonymous registers from 95 to 19, and anonymous wires from 19220 to 16073 (16% decrease in bad names).
  • Auto-naming + prefixing of temporaries: further reduction of anonymous wires from 16073 to 10880.
  • Auto-naming + auto-prefixing + added prefixing to one file (Monitor.scala) reduces 10880 -> 1395 anonymous wires.

auto-prefixingが何者かがイマイチわからない。。。けど、後半の方のPR見てるとプラグインでこれについての改善が入ってるっぽくも見えたので、それのことを指している気がする。

(#1499) Basic model checking API

chisel3.experimental.verificationというパッケージが追加されて、assert/assume/covertというアサーションが使用可能に。

(#1515) Allow a counter to be instantiated using a Scala range

Counterを作る際にScalarangeを使った指定が可能になった。

(#785) Canonicalize construction of Decoupled with no payload

引数を取らないDecoupled()Decoupled.emptyというメソッドがサポートされ、ペイロードを含まないDecoupledが使用可能になった。

(#1485) Memoize the hashcode of the ChiselCircuitAnnotation, improves performance of multi-phase generators

ChiselCircuitAnnotationにおいてhashcodeを保存しておくことで、複数のフェイズを含んだジェネレータにおけるパフォーマンスを向上させた。(特に大きい回路で効果があるみたい)

(#1073) Grouping Chisel API, added a chisel annotation API for triggering the firrtl.transforms.GroupComponents transformation.

groupというブループ化のためのメソッドが増えた、、、、っぽい?

(#1203) Add support for ScalaFix.

ScalaFixがサポートされた。

(#1280) Provide an implementation of litOption() for BundleLits

BunldeLits用のlitOptionメソッドが実装された。

(#1405) Switch to HowToSerialize for Emission

chisel3.stage.phases.Emitterを削除して、その機能をChiselCircuitAnnotationに移動した。

(#1525) update Select.get(IntermediateAnd)Leafs to work with records

Select.getLeafs/Select.getIntermediateAndLeafs実行時にBundleの代わりに、スーパークラスRecordにマッチするようにした。

(#1527) Allow a counter to be manually reset

Couneterに任意のタイミングでリセットするための引数resetが追加された。

READMEにChiselのWEBサイトのソース管理用のgithubのリンクが追加された。

(#1518) Check whether signals escape their when scopes, Include and check when scoping as part of reg/mem/wire/node bindings

Moduleを跨いだり、whenブロックを跨いだといった、許されない接続に対してエラボレート時に適切な例外(以下の2つ)を投げるようになった。

  • CrossWhenConnect
  • IllegalRefOuter

(#1554) Chisel3 can use treadle to run tests (faster), only depends on Treadle dependency in tests

test configuration時のみTreadleが依存パッケージとして要求されるように、依存関係を変更した。

(#1452) make parameters for util modules public

chisel3.utilの下にあるユーティリティモジュール(Queueなど)のクラスパラメータをpublicに変更した。これによって設定毎にユニークなモジュール名を割り振れるようになった。

(#1557) Recursively generate one-hot multiplexers for aggregates

Aggregateを使ったMu1H再帰処理することで、より最適化された回路を生成するようにした。

(#1558) Remove use of deprecated PreservesAll, cleanup dependencies, all phases are converted to be more canonical in there specification of dependencies

PreservesAllを削除して、依存関係を整理した。と同時に、すべてのフェーズをより標準的な実装に変更した。

(#1560) Added website docs and mdoc.

Added living documentation with repository. This will enable us to enforce better documentation of new features as part of their upstream process.

WEBサイトで公開されていたドキュメントのソースがChiselのリポジトリに格納されるようになった。

https://github.com/freechipsproject/chisel3/tree/master/docs

(#1561) Move multi-clock to explanations

"multi-clock.md"の場所を"docs/src/explanations/multi-clock.md"に移動した(&説明のコードの微修正)。

(#1562) Updated PR template to include checklist and documentation updates

PRのテンプレートにチェックリストを追加した。テンプレート、、ここにあったんだ↓。

(#1566) Add ChiselPhase, Stop writing files in ChiselStage$ methods, Expand ChiselStage$ helpers

ChiselStageオブジェクトに新しいAPIが追加された(以下の4つ)

  • emitChirrtl(gen: => RawModule): String
  • emitFirrtl(gen: => RawModule): String
  • emitVerilog(gen: => RawModule): String
  • emitSystemVerilog(gen: => RawModule): String

これ、newがいらなくなるから地味に嬉しい。

  (new ChiselStage).emitFirrtl(new VerificationModule)  // 3.3.xではこう書かないとダメだった。
  ChiselStage.emitFirrtl(new VerificationModule)        // 3.4.0ではオブジェクトにAPIが増えたのでこう書ける。

(#1570) Update README.md

READMEの微修正。(developer -> contributor)

(#1571) Restore and deprecate Chisel.Driver, until we also remove underlying chisel3.Driver

”Chisel 3.4.0で削除予定”だったChisel3.Driverが延命された。(警告文に含まれていた”Chisel3.4.0で削除予定”という文言ごと消えたので、しばらくは残されるみたい)

(#1572) Add chisel plugin to mill build system. This enables better, more stable naming capabilities in Chisel3

millのビルドで必要となるChiselのプラグインが追加された。

(#1573) Add documentation of new plugin.

Chisel3.4.0の目玉の"naming"("_T_x"とかの中間変数が無くなる件)に関してのプラグインとドキュメントの追加。ドキュメントは以下のファイル。

(#1579) bug fix for build.sc

build.scのバグ修正

(#1583) Fix load memory from file to work with binary

loadMemoryFromFileBinaryを指定しても、そのまま16進文字列のファイルとして読み込まれてしまうバグを修正

(#1590) Improved speed of ChiselPlugin

キャッシュを使うようにしてChiselPluginの動作を高速化した。

(#1595) Support using switch without importing SwitchContext

switch文がSwitchContextをインポートせずに使えるようになった。これも地味に嬉しい(触り始めた頃にswitch/isだけインポートして動かして、エラーが出て「何もわからん、、、、」ってなったやつ)。

Miscellany

(#1439) Bump 'removed in 3.3' deprecations to 3.4

The removal of unstable methods from chisel3.core from the public API has been delayed. They will be removed with the version 3.4.0 release.

"3.3.x"で消えるよ、となっていたけど、残ってるもののバージョン指定を3.4.0に修正した。

(#1395) Update sbt-site to 1.4.0

sbt-siteのバージョンを1.4.0に変更。

(#1413) Update scalacheck-1-14 to 3.1.1.1

sbtcheck-1-14のバージョンを3.1.1.1に変更。

(#1415) Update sbt to 1.3.10

sbtのバージョンを1.3.10に変更。

(#1429) Update Mergify rules to backport to 3.3.x

Mergifyのルール指定の3.2.xを3.3.xに変更。

(#1430) Update scalatest 3.1.2

scalatestのバージョンを3.1.2に変更。

(#1459) verilator_4_016 --> v4.016

verilatorのバージョン表記を"_4_016"から"v4.016"に変更。

(#1460) Restore backporting to 3.2.x

Mergifyのルールに3.2.x/3.3.xへのバックポートの設定を追加。

(#1479) Have defaultVersions specify complete ModuleIDs.

"build.sbt"のallDependenciesに関するマッチ式を微修正。

(#1481) Remove Deprecated Usages of chisel3.Driver, CircuitForm

Chisel3単体の各種テストでdeprecated指定になった要素を使用しないように変更。

(#1489) Fix Mergify Backport labeling for 3.2.x

Mergifyのラベルの修正。

(#1493) Don't run FIRRTL in FlattenSpec's ChiselStage

FlattenSpecでFIRRTLが実行されてないように変更。

(#1495) Add .scala-steward.conf

”.scala-steward.conf”を追加。

(#1504) fix treadle dependency for mill

millのビルドファイル中のTreadleに関する依存性のバグを修正。

(#1511) Update Development Meetings Info

README中のミーティングのスケジュールを修正。

(#1516) Add Treadle to CI builds

CIのビルドにTreadleを追加。

(#1524) Update build instructions in README

READMEのビルド手順を更新。

(#1530) Instance API for Importing Modules

内容不明(マージされずにクローズされてる&コミットは他の各PRの内容)

(#1539) Update OneHot.scala

PriorityEncoderOHのコメントが修正された。

(#1544) Remove ChiselLegacyAnnotation It was private and unused

プライベート属性かつ内部で使用されていないアノテーションChiselLegacyAnnotationが削除された。

(#1551) Deprecate support for Scala 2.11

Scala 2.11の使用が非推奨になった。警告文の内容的にはChisel 3.4.0がScala 2.11の最終サポートになる模様。

(#1553) Bump Scala to 2.12.12

Scalaのバージョンを2.12.12にアップデート。

ひとまず、概要編は以上。気になったやつはもう少し調べて、まとめてみようと思う。