Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix incorrect comment in ScalaDoc #1756

Merged
merged 1 commit into from
Jan 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/main/scala/chisel3/Reg.scala
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ object RegNext {
* val x = Wire(UInt())
* val y = Wire(UInt(8.W))
* val r1 = RegInit(x) // width will be inferred
* val r2 = RegInit(y) // width is set to 8
* val r2 = RegInit(y) // width will be inferred
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't it set to 8 eventually? What's the mechanism?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inference in FIRRTL

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add it as a comment? It may not be obvious that it is inferred, especially if the example code doesn't assign anything else to r2 that could change its width.

Copy link
Contributor

@chick chick Jan 27, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@edwardcwang Here's the scastie demo. I am not sure of the mechanism, but it confirms, I believe, the correctness of Jack's change

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read the whole ScalaDoc, that’s sort of the point of this whole example: https://www.chisel-lang.org/api/3.4.1/chisel3/RegInit$.html

It’s just that that particular comment is wrong and contradicts the correct info above.

* }}}
*
* 3. [[Aggregate]] initializer - width will be set to match the aggregate
Expand Down