Unverified Commit 95125384 authored by mergify[bot]'s avatar mergify[bot] Committed by GitHub
Browse files

Fix ChiselEnum warnings and use Logger for warnings instead of println (backport #1999) (#2002)

* Change Chisel warnings to use logger instead of println

It also uses the same logger as the Builder so that if we ever refactor
that to be passed as an argument, it will be the same logger for both
Builder and warning reporting.

(cherry picked from commit 04caf395)

* Add ChiselEnum.safe factory method and avoid warning

Previously, ChiselEnum would warn any time a UInt is converted to an
Enum. There was no way to suppress this warning. Now there is a factory
method (`.safe`) that does not warn and returns (Enum, Bool) where the
Bool is the result of calling .isValid on an Enum object. The regular
UInt cast is also now smarter and will not warn if all bitvectors of the
width of the Enum are legal states.

(cherry picked from commit 5fe539c7)

# Conflicts:
#	src/test/scala/chiselTests/ChiselSpec.scala

* Update docs for ChiselEnum

(cherry picked from commit bfb77d4c

)

* Resolve merge conflicts and waive false bincompat issue

Co-authored-by: default avatarJack Koenig <koenig@sifive.com>
parent 66d891bd
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment