Skip to content
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

The new decoder #3534

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open

The new decoder #3534

wants to merge 4 commits into from

Conversation

cyyself
Copy link
Contributor

@cyyself cyyself commented Nov 18, 2023

This PR takes over #3498 and removed Zb* and Zk* since #3532 has been merged.

Related issue: #3498

Type of change: other enhancement

Impact: API addition (no impact on existing code)

Development Phase: implementation

Release Notes
Switch to DecodeTable API.

TODO: need
- release version of chisel 3.6.1, 5.1
- Zb/Zbk support
- riscv-opcode path configurable
@cyyself cyyself marked this pull request as ready for review November 18, 2023 10:26
Copy link
Member

@sequencer sequencer left a comment

Choose a reason for hiding this comment

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

some TODO need to be resolved, other LGTM(since I wrote it).
Need review by @jerryz123

@@ -7,3 +7,9 @@
[submodule "dependencies/chisel"]
path = dependencies/chisel
url = https://github.com/chipsalliance/chisel.git
[submodule "dependencies/rvdecoderdb"]
path = dependencies/rvdecoderdb
url = https://github.com/sequencer/rvdecoderdb.git
Copy link
Member

Choose a reason for hiding this comment

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

After @jerryz123 approves, I will transfer this repo to chipsalliance.

src/main/scala/rocket/Decoder.scala Show resolved Hide resolved
Comment on lines +182 to +183
// TODO: configurable
(org.chipsalliance.rvdecoderdb.fromFile.instructions(os.pwd / "dependencies" / "riscv-opcodes") ++
Copy link
Member

Choose a reason for hiding this comment

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

can you fixup this TODO? with out configuring it, downstream users cannot use it.

@@ -199,7 +199,7 @@ class InstructionDecoder(p: InstructionDecoderParameter) {
override def name: String = "rxs2"

override def genTable(op: RocketDecodePattern): BitPat = op.instruction.name match {
case i if Seq("bne", "beq", "blt", "bltu", "bge", "bgeu", "sb", "sh", "sw", "add", "sub", "slt", "sltu", "and", "or", "xor", "sll", "srl", "sra", "czero.eqz", "czero.nez", "sfence.vma", "hfence.vvma", "hfence.gvma", "hsv.b", "hsv.h", "hsv.w", "sd", "addw", "subw", "sllw", "srlw", "sraw", "hsv.d", "mul", "mulh", "mulhu", "mulhsu", "div", "divu", "rem", "remu", "mulw", "divw", "divuw", "remw", "remuw", "amoadd.w", "amoxor.w", "amoswap.w", "amoand.w", "amoor.w", "amomin.w", "amominu.w", "amomax.w", "amomaxu.w", "lr.w", "sc.w", "amoadd.d", "amoswap.d", "amoxor.d", "amoand.d", "amoor.d", "amomin.d", "amominu.d", "amomax.d", "amomaxu.d", "lr.d", "sc.d", "custom0.rs1.rs2", "custom0.rd.rs1.rs2", "custom1.rs1.rs2", "custom1.rd.rs1.rs2", "custom2.rs1.rs2", "custom2.rd.rs1.rs2", "custom3.rs1.rs2", "custom3.rd.rs1.rs2").contains(i) => y
case i if Seq("amomaxu.w", "amoand.w", "amoor.w", "amoxor.w", "amoswap.w", "lr.w", "amomax.w", "amoadd.w", "amomin.w", "amominu.w", "sc.w", "lr.d", "amomax.d", "amoswap.d", "amoxor.d", "amoand.d", "amomin.d", "amoor.d", "amoadd.d", "amomaxu.d", "amominu.d", "sc.d", "hsv.w", "hsv.b", "hfence.vvma", "hsv.h", "hfence.gvma", "hsv.d", "or", "srl", "sltu", "sra", "sb", "add", "xor", "beq", "bge", "sw", "blt", "bgeu", "bltu", "bne", "sub", "and", "slt", "sh", "sll", "addw", "sd", "sllw", "sraw", "subw", "srlw", "mulhsu", "rem", "div", "mul", "mulhu", "mulh", "remu", "divu", "remuw", "divw", "divuw", "mulw", "remw", "sfence.vma", "czero.nez", "czero.eqz", "custom0.rs1.rs2", "custom0.rd.rs1.rs2", "custom1.rs1.rs2", "custom1.rd.rs1.rs2", "custom2.rs1.rs2", "custom2.rd.rs1.rs2", "custom3.rs1.rs2", "custom3.rd.rs1.rs2").contains(i) => y
Copy link
Member

Choose a reason for hiding this comment

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

How about split them with '\n'

Copy link
Contributor

@jerryz123 jerryz123 left a comment

Choose a reason for hiding this comment

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

I do not feel confident in this change, as currently designed. The API change is very drastic.

We can keep the existing IntCtrlSigs bundle, and have a generator param control whether to use the new decoder (this can even be the default) or the old way.

@sequencer
Copy link
Member

sequencer commented Nov 19, 2023

We can keep the existing IntCtrlSigs bundle

I don’t think the reason keeping the original IntCtrl is a good design since for different instruction sets, some control signal will be optional. The current design doesn’t support it.

And have a generator param control whether to use the new decoder (this can even be the default) or the old way.

i don’t think the maintain burden is acceptable for me :(

@jerryz123
Copy link
Contributor

jerryz123 commented Nov 19, 2023

I don’t think the reason keeping the original IntCtrl is a good design since for different instruction sets, some control signal will be optional. The current design doesn’t support it.

I don't like the premise that additional extensions require adding signals to IntCtrlSigs. IntCtrlSigs are the control signals for the subset of the control signals for the base integer ISA... the fields in this bundle should never need to change. We should develop interfaces and APIs that allow for extensions to define their own control signal bundles that propagate through the pipeline.

i don’t think the maintain burden is acceptable for me :(

Aggressively deprecating APIs is a large maintenance burden. I don't see how retaining support for the original decoder is a large burden, if we do it with the correct interfaces. Once done, the original decoder code should never need to change again.

I will look into integrating this without deprecating the existing decoder.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants