5/4にChiselの3.3.0が正式にリリースされた。今回はリリースノートをざっと確認したのでその内容についてまとめておく。
なお今回の記事はリリースノートのひとくちメモという感じで、中身についてはそこまで深くは追求していない。
気になった機能については動作を確認して、別の記事で紹介予定。
- Chisel-3.3.0
- 長いので先にまとめ
- API Modification
- Fix
- (#1136) Make Queue.irrevocable work properly in chisel3 - Close #1134
- (#1224) Improve naming of anonymous/class-in-function Modules
- (#1246) Fix mergify to backports: omit jenkins CI
- (#1252) Fix bidirectional Wire with Analog
- (#1256) Fix deprecation warning that leaks into user code
- (#1258) Fix asTypeOf for Clock
- (#1274) Bug fixes to support code for Interval
- (#1275) Fixed problem creating Interval literals with full ranges
- (#1283) BitPat supports whitespace and underscores
- (#1294) Fixed code example typo in comment
- (#1303) Bugfix: Select.instances now works with blackboxes
- (#1324) fix mill build
- (#1336) Fix := of Reset and AsyncReset to DontCare
- (#1346) Patch fix #1109
- (#1374) Dont wrap elaboration annotations
- (#1380) Use innermost builder cause to trim stack trace
- (#1387) Propagate user compile options for Chisel.Module
- (#1399) Fix mill build
- Feature
- (#1180) Add brief description of (current) chisel versioning and version recommendations.
- (#1183) Add read-under-write parameter to SyncReadMem
- (#1209) Enable @chiselName on non-module classes
- (#1213) Deprecate Driver methods in favor of ChiselStage
- (#1215) Add ChiselEnum to BundleLiterals
- (#1225) Support literals cast to aggregates as async reset reg init values
- (#1227) Bump master SNAPSHOT version.
- (#1236) Add MiMa and CI checks for binary compatibility
- (#1237) Remove over design
- (#1239) Improve error message when assigning from Seq to Vec
- (#1243) Add CCC20 Info at README top
- (#1244) Create .mergify.yml
- (#1253) Compat compile options macro
- (#1260) Update README to reflect CCC20 Extension
- (#1264) Remove Jenkins CI from .mergify.yml
- (#1268) Revert "Compat compile options macro"
- (#1270) Migrate to Dependency Wrapper
- (#1273) Remove unused WriteEmitted phase
- (#1277) Band aid until litOption is implemented for Aggregates.
- (#1284) Provides Double and BigDecimal methods to access literal values for FixedPoint and Interval
- (#1285) Add method asBool to Clock.
- (#1296) Remove redundancy code
- (#1305) specifying type of targets field in ChiselStage
- (#1308) Change when/switch thunk type to Any
- (#1309) Big decimal methods for num types.2
- (#1318) Add Scaladoc about RegNext Unset/Inferred Widths
- (#1325) README: have a link to the classic tutorial
- (#1326) Printf: Add support for tabs, and give helpful error messages #### ([#1323)
- (#1329) Clone child elements lazily in Vec
- (#1332) Bump sbt and tool/plugin dependencies.
- (#1340) Update sbt-site to 1.3.3
- (#1341) Update junit to 4.13
- (#1342) Update paradise to 2.1.1
- (#1345) Upcoming Events: Remove CCC, add Dev Meetings
- (#1356) sbt compatible publish for mill
- (#1357) add testOnly
- (#1360) Make implicit clock and reset final vals
- (#1361) Provide API to set concrete type of implicit reset
- (#1365) Retain default version assignment
- (#1367) Java API Documents Linking
- (#1372) Make mergify open backport PRs & signal on failed cherry-picks
- (#1373) [mergify] Update match string for labeling backported PRs
- (#1377) Remove toNamed (and friends) deprecation.
- (#1382) Set StageError cause in ChiselStage
- (#1383) Add NoChiselNamePrefix to ignore instances in @chiselName
- (#1389) Bump to Scala 2.12.11
- (#1390) Add publishSettings to subprojects.
- (#1394) Scalasteward scalatest 3.1.0
- (#1397) Mux1H: note results unspecified unless exactly one select signal is high
- (#1400) Change BundleLiteral to RecordLiteral
- (#1402) expose typeEquivalent
- (#1404) Use thread local storage for ChiselContext.
- (#1408) Make Counter emit valid FIRRTL
- (#1414) Add tests for async reset regs of non-UInt types
- (#1417) Revert "Make uselessly public fields in utils private"
Chisel-3.3.0
リリースノートは以下。
ここに載っている
- API Modification
- Fix
- Feature
について、ざっと確認した内容を記載していく。
長いので先にまとめ
それなりのバグの修正や、エラーメッセージの改善が行われた感じ。issueを読んでいると、バグ修正等については可能な限り3.2.x系にもバックポートされているので、3.2.x系列でも新しいバージョンを使う方が良さそうではある。
Chiselのユーザーの観点からみて、影響が出る可能性があるのは次のissue。
- (#1183) SyncReadMemに同時アクセス時の挙動を指定するパラメータが追加された
- (#1209) @chiselNameがChiselのモジュール以外にも適用されるようになった
- (#1213) Driverのいくつかのメソッドが非推奨になった
- (#1215) BundleでChiselEnumが使えるようになった
- (#1283) BitPatで空白文字が使えるようになった
- (#1284) ScalaのDouble/BigDecimalからFixedPointへの変換ができるようになった
- (#1326) Printfがタブ文字をサポートした
- (#1361) モジュールのリセットの種類(同期/非同期)を指定するトレイトが追加された
- (#1383) @chiselNameの処理を非適用にするトレイトが追加された
- (#1400) BundleLiteralが実質RecordLiteralになった
これらのissueに関しては別途確認した結果を記事にまとめたい。
今回のリリースで個人的に一番影響が出そうなのは#1213のDriverのメソッドの一部非推奨指定された件。
というのも非推奨扱いになったメソッドにはDriver.execute
も含まれており、自分が使っていたRTLの生成処理が非推奨になってしまった。。。
あとは件名からはピンとこなかったが#1400のBundleLiteral→RecordLiteralの変更は調べてみて「あー、こんなことできるのかー」と思ったので、これも後ほど紹介予定。
API Modification
(#1201) Don't use MuxLookup default for full mapping
下記のコードからRTLを生成した時に
import chisel3._ import chisel3.util.MuxLookup import chisel3.stage.{ChiselGeneratorAnnotation, ChiselStage} class Qux extends RawModule { val in = IO(Input(Vec(2, UInt(2.W)))) val sel = IO(Input(UInt(1.W))) val out = IO(Output(UInt(2.W))) val mapping = Seq( 0.U -> in(0), 1.U -> in(1) ) out := MuxLookup(sel, DontCare, mapping) }
こうなってたのが
module Qux( input [1:0] in_0, input [1:0] in_1, input sel, output [1:0] out ); wire [1:0] _T_1; // @[Mux.scala 68:16] wire _T_3; // @[Mux.scala 68:19] assign _T_1 = sel ? in_1 : 2'h0; // @[Mux.scala 68:16] assign _T_3 = 1'h0 == sel; // @[Mux.scala 68:19] assign out = _T_3 ? in_0 : _T_1; // @[<pastie> 29:7] endmodule
こうなる
module Qux( input [1:0] in_0, input [1:0] in_1, input sel, output [1:0] out ); assign out = sel ? in_1 : in_0; // @[<console> 23:7] endmodule
(#1315) Emit FIRRTL andr, orr for Bits.{andR, orR}
FIRRTL #1338に関係した問題。
class Foo(n: Int) extends RawModule { val in = IO(Input(UInt(n.W))) val out = IO(Output(Vec(3, Bool()))) out(0) := in.andR out(1) := in.orR out(2) := in.xorR }
上記のように1bitのデータにリダクションを行った結果生成されるRTLが次のようになっていた。
module Foo( output out_0, output out_1, output out_2 ); assign out_0 = 1'h1; assign out_1 = |1'h0; assign out_2 = ^1'h0; endmodule
これがたぶん次のようになる、、、はず。
module Foo( output out_0, output out_1, output out_2 ); assign out_0 = 1'h1; assign out_1 = 1'h0; assign out_2 = 1'h0; endmodule
(#1359) Cleanup aspects
ChiselのAOP関連のコードの整理
(#1384) No more compile internal
プロジェクト構造の修正をしてsbtの中間処理を削除できるようにした。
Fix
(#1136) Make Queue.irrevocable work properly in chisel3 - Close #1134
下記のようなQueue.irrevocable
を使ったコードでエラーが発生していたのを修正。
import chisel3._ import chisel3.util._ class Queue5(w:Int , n:Int) extends Module{ val io = IO(new Bundle { val in = Flipped(Decoupled(UInt(w.W))) val out = Decoupled(UInt(w.W)) }) val x = Queue.irrevocable(io.in, n) x.ready := io.out.ready io.out.valid := x.valid io.out.bits := x.bits }
(#1224) Improve naming of anonymous/class-in-function Modules
次のように無名関数を使ったモジュールを変換した際のRTLのモジュール名についての改善
import chisel3._ abstract class CoolModule(x: Int) extends Module { val io = IO(new Bundle { val in = Input(UInt(8.W)) val out = Output(UInt(8.W)) }) io.out := io.in + x.U } class MyModule extends Module { val io = IO(new Bundle { val in = Input(UInt(8.W)) val out = Output(UInt(8.W)) }) val inst = Module(new CoolModule(3) {}) inst.io.in := io.in io.out := inst.io.out }
上記のコードからFIRRTLを生成するとモジュール名が
module _3 : input clock : Clock input reset : Reset output io : {flip in : UInt<8>, out : UInt<8>} node _T = add(io.in, UInt<2>("h03")) @[Test.scala 9:19] node _T_1 = tail(_T, 1) @[Test.scala 9:19] io.out <= _T_1 @[Test.scala 9:10]
のように_3
になっていたのをが修正された。
(#1246) Fix mergify to backports: omit jenkins CI
jenkinsの設定の削除
(#1252) Fix bidirectional Wire with Analog
次のコードのようにBundleでAnalogとnon-Analogの混在ができるようになった。
class MyBundle extends Bundle { // InputとAnalogが混在 val x = Input(UInt(8.W)) val y = Analog(8.W) }
(#1256) Fix deprecation warning that leaks into user code
val valueReg = RegInit(0.U.asTypeOf(new RValue(cSize))
上記のコードを実行すると
[deprecated] Data.scala:488 (1 calls): litArg is deprecated: "litArg is deprecated, use litOption or litTo*Option"
のようにChisel内のコードの警告が出ていた問題が修正された。
(#1258) Fix asTypeOf for Clock
次のコードのひとつ目のアサートが実行できなかった、、、はず、、、の問題が修正された。
class AsTypeOfClockTester extends BasicTester { class MyBundle extends Bundle { val x = UInt(4.W) val y = Clock() } assert(true.B.asTypeOf(Clock()).asUInt.asBool === true.B) assert(0x1f.U.asTypeOf(new MyBundle).asUInt === 0x1f.U) stop() }
(#1274) Bug fixes to support code for Interval
ChiselのFixedPoint
で使われるInterval.getPossibleValues
の戻り値の変更と、getHighestPoosibleValue
の計算のバグが修正された。
(#1275) Fixed problem creating Interval literals with full ranges
同じくFixedPoint
で使われるrange
を使ったInterval literalの生成時に、正しい条件でも例外を吐くバグが修正された(例えばval iLit = 6.0.I(range"[0,6]")
で例外が出ていた)。
#1274/#1275は共にFeaturesで挙げられるScalaのBigDecimal
とDouble
からChiselのFixedPoint
を生成する機能に関連した修正の模様。
(#1283) BitPat supports whitespace and underscores
これはそのまんまBitPatで空白文字がサポートされた。
(#1294) Fixed code example typo in comment
コードサンプルのタイポの修正。
(#1303) Bugfix: Select.instances now works with blackboxes
AOPの方で使う(らしい)Select.instances
がBlackBoxモジュールに対しても使用できるようになった。
(#1324) fix mill build
millのアップデートで非推奨扱いになったものを修正。極力millのAPIを使うように変更。
(#1336) Fix := of Reset and AsyncReset to DontCare
Reset/AsyncResetに対してDontCareが指定できなかったバグを修正
(#1346) Patch fix #1109
エラーメッセージの改善。次のコードはエラーになるが、FIRRTLレベルの例外が発生していてどのソースでエラーが起きているかがわかりにくなっていた。
import chisel3._ class MyModule extends RawModule { def func(): Unit = { val port = IO(Output(UInt(8.W))) //.suggestName("port") port := 3.U } func() } object MyMain extends App { println(chisel3.Driver.emit(() => new MyModule)) }
(#1374) Dont wrap elaboration annotations
エラーメッセージの改善。例外がキャッチされておらずsbtでトラップされていたのを改善 大元はstackoverflowので報告されていた問題
(#1380) Use innermost builder cause to trim stack trace
エラーメッセージの改善。長いスタックトレースをトリムするように変更
(#1387) Propagate user compile options for Chisel.Module
compatibility-mode Modulesでユーザー独自のコンパイルオプションが無視されていたバグを修正。
(#1399) Fix mill build
#1384のmill版
Feature
(#1180) Add brief description of (current) chisel versioning and version recommendations.
READMEにバージョンに関する説明が追加された
(#1183) Add read-under-write parameter to SyncReadMem
SyncReadMem
にread-under-writeというパラメータが追加され、同じアドレスにリードとライトが同時に発生した際の扱いを指定できるようになった。
(#1209) Enable @chiselName on non-module classes
@chiselNameがChiselのモジュール以外にも適用できるようになった
(#1213) Deprecate Driver methods in favor of ChiselStage
Driverの一部のメソッドが非推奨扱いに変更された。"一部のメソッド"には"Driver.execute"も含まれるので、この修正は一番影響が出そう。
(#1215) Add ChiselEnum to BundleLiterals
BundleでChiselEnumが使えるようになった
(#1225) Support literals cast to aggregates as async reset reg init values
AsyncResetを使うRegInitの初期値指定において、リテラルをアグリゲートにキャストして使えるように修正した。
(#1227) Bump master SNAPSHOT version.
バージョンの変更
(#1236) Add MiMa and CI checks for binary compatibility
MimaとCIにバイナリ互換性のチェックを追加
(#1237) Remove over design
renameに関する余計な処理を削除(.getOrElseによるチェックが入っていた)
(#1239) Improve error message when assigning from Seq to Vec
SeqをVecに接続した際のエラーメッセージを改善
(#1243) Add CCC20 Info at README top
READMEにCCC20(Chisel Community Conference 2020)の情報を追加
(#1244) Create .mergify.yml
mergifyの設定ファイルを追加
(#1253) Compat compile options macro
defaultCompileOptionsに関する修正だが、最終的に現時点では非採用になった模様(#1268参照)
(#1260) Update README to reflect CCC20 Extension
CCC20に関する記述のアップデート
(#1264) Remove Jenkins CI from .mergify.yml
Jnekinsの設定を項目を削除
(#1268) Revert "Compat compile options macro"
#1253のリバート
(#1270) Migrate to Dependency Wrapper
classOfをこれのラッパーであるfirrtl.options.Dependencyに置き換え
(#1273) Remove unused WriteEmitted phase
使用されていないWriteEmittedを削除
(#1277) Band aid until litOption is implemented for Aggregates.
Aggregate型に対してisLitを呼ぶと例外が発生していたことに対する応急処置
(#1284) Provides Double and BigDecimal methods to access literal values for FixedPoint and Interval
BigDecimal/DoubleからFixedPointへの変換をサポート。コレに関するバグ修正が#1274/#1275。
(#1285) Add method asBool to Clock.
ClockにasBoolメソッドを追加
(#1296) Remove redundancy code
不要なコードを削除(RawModule.scalaのnameIds
)
(#1305) specifying type of targets field in ChiselStage
ChiselStageの変数targets
の型を明示
(#1308) Change when/switch thunk type to Any
警告の抑止のためにwhen
/ switch
の戻り値をUnit
からAny
に変更
(#1309) Big decimal methods for num types.2
toBigDecimal
メソッドのマジックナンバーを変数に置き換え
(#1318) Add Scaladoc about RegNext Unset/Inferred Widths
RegNext
のScaladocの記述にビット幅が未設定/ビット幅を他の変数から引き継ぐ場合のサンプルを追加。
(#1325) README: have a link to the classic tutorial
READMEにclassic Chisel tutorialのリンクを追加
(#1326) Printf: Add support for tabs, and give helpful error messages #### ([#1323)
Printfでタブ文字が使えるようになった&エラー時のメッセージの追加
(#1329) Clone child elements lazily in Vec
Vecの要素のクローン処理を遅延評価してパフォーマンスを改善(ざっくり3倍くらいになってる)
(#1332) Bump sbt and tool/plugin dependencies.
sbtと依存ライブラリのバージョンを変更
(#1340) Update sbt-site to 1.3.3
sbtのバージョンを1.3.3に変更
(#1341) Update junit to 4.13
junitのバージョンを4.13に変更
(#1342) Update paradise to 2.1.1
paradiseのバージョンを2.1.1に変更
(#1345) Upcoming Events: Remove CCC, add Dev Meetings
READMEからCCCの記述を削除、開発ミーティングの案内を追加
(#1356) sbt compatible publish for mill
millでsbtと同等のpublish処理が走るように修正。どうもmill版でローカルにライブラリを生成すると、sbtとは異なる場所にライブラリができていた模様。
(#1357) add testOnly
millにtestOnly
コマンドを追加
(#1360) Make implicit clock and reset final vals
MultiIOModule
のclock
とreset
をfinal
に変更
(#1361) Provide API to set concrete type of implicit reset
Chiselの暗黙のリセットの種類を指定するAPIがを含んだトレイトRequireSyncReset
/RequireAsyncReset
を追加
(#1365) Retain default version assignment
millにgetVersion
を追加して、依存ライブラリの記述を修正
(#1367) Java API Documents Linking
(#1372) Make mergify open backport PRs & signal on failed cherry-picks
mergify の設定を変更
(#1373) [mergify] Update match string for labeling backported PRs
mergify の設定を変更
(#1377) Remove toNamed (and friends) deprecation.
toNamed
メソッドを非推奨に改めて指定(今はTarget
に変更されているっぽい)
(#1382) Set StageError cause in ChiselStage
ChiselState.run
メソッドで発生させる例外にChsielException
を渡すように変更
(#1383) Add NoChiselNamePrefix to ignore instances in @chiselName
@chiselName
の処理を無視させる処理を行うトレイトNoChiselNamePrefix
を追加
(#1389) Bump to Scala 2.12.11
Scalaのバージョンを2.12.10から2.12.11に変更
(#1390) Add publishSettings to subprojects.
publishSettingsをmacros
とcore
に追加
(#1394) Scalasteward scalatest 3.1.0
scalatestを3.0.8から3.1.0に変更
(#1397) Mux1H: note results unspecified unless exactly one select signal is high
結果についての注記を追加
(#1400) Change BundleLiteral to RecordLiteral
BundleLiteral
を(実質)RecordLiteral
に変更
(#1402) expose typeEquivalent
DataMirror
にtypeEquivalent
メソッドを追加。引数に渡した変数の型が一致するかを調べるメソッド。
(#1404) Use thread local storage for ChiselContext.
ChiselContext
でThreadLocal
を使うように変更
(#1408) Make Counter emit valid FIRRTL
object Counter
のapply
の処理でwrap
をvar
で指定してたのをやめた。
(#1414) Add tests for async reset regs of non-UInt types
AsyncReset
のテストにUInt
以外の型のテストを追加
(#1417) Revert "Make uselessly public fields in utils private"
chisel3.utils
の一部のコードで余計に指定されていたprivate
指定を削除した