-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support generate structured decoder with DecodeTable #2924
Conversation
ac7dbf1
to
a42bcc7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This API is basically derived from my vector core, Thanks @OceanS2000 for upstreaming this. After this is upstream, we can try to use this to simplify the rocket-chip Decoder.
I think it is a better API than traditional rocket-chip Decoder for these reasons:
- For each instruction, they will get a trait to store it's metadata for decoding, and the control signals can reuse those metadata to construct the decode table.
- For each control signals, originally they can only be accessed via
UInt.apply(msb, lsb)
orUInt.apply(x)
, which is hard to memories the location of control signals. - Adding new control signals needs to change every place, which is a bad practice.
Adding this API is a great thing to unify the Instruction Decode API, and there are things I have been thinking and which can be improved in the future:
- Other than
BoolDecodeField
,trait EnumDecode[T <: DecodePattern, D <: ChiselEnum] extends DecodeField[T, D]
can be considered. - Is possible to unify the design of
Uop
?
Finally, documentation should be improved for this PR, I suggest you adding the mdoc in doc
folder for this decode API.
src/main/scala-2.12/chisel3/util/experimental/decode/DecoderBundle.scala
Outdated
Show resolved
Hide resolved
I believe this is my "simple work around" which mentioned last year, cc @carlosedp |
a42bcc7
to
364d824
Compare
342d9aa
to
1eb2aa4
Compare
1eb2aa4
to
e9eea7b
Compare
DecodeTable
is a structured approach to generate a potentially large decoder, which is usually found in CPU instruction decoder.There is often an external spec containing structured information about instructions. This API provides a new method to generate corresponding decoder rules without too many hassle.
First, a class implementing
DecodePattern
trait encodes structured information (such as name of instruction, type of operation, etc) into its other data members. ThenDecoderField
trait can extract them by programmatically inspecting vale member ofDecodePattern
and generate output pattern asBitPat
to be emitted by our decoder. The newDecoderTable
generates such a decoder and allow all fields given to be retrieved as hardware values.Contributor Checklist
docs/src
?Type of Improvement
API Impact
chisel3.util.experimetal.decoder
API would be extendedBackend Code Generation Impact
Desired Merge Strategy
Release Notes
Reviewer Checklist (only modified by reviewer)
3.4.x
, [small] API extension:3.5.x
, API modification or big change:3.6.0
)?Enable auto-merge (squash)
, clean up the commit message, and label withPlease Merge
.Create a merge commit
.