-
Notifications
You must be signed in to change notification settings - Fork 40
Add Zclsd extension YAML #577
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
base: main
Are you sure you want to change the base?
Add Zclsd extension YAML #577
Conversation
d37b1aa
to
e322a4d
Compare
e322a4d
to
abc4553
Compare
02d3cc1
to
fb4e75d
Compare
fb4e75d
to
7a01aee
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.
Comments apply to all the instructions.
7a01aee
to
ab9a65c
Compare
875af8d
to
3e10a3f
Compare
3e10a3f
to
d5263f9
Compare
d5263f9
to
addf131
Compare
addf131
to
804d7cb
Compare
@Shehrozkashif, did you see that there are "conflicts that must be resolved"? |
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.
When this content has all been merged into arch/inst/C/c.sd.yaml
, this file should be removed.
@ThinkOpenly yes I can see the conflict Should I keep the new logic, the main branch version, or try to merge both? |
I know your comment is intended to Paul, but I would say to try to manually merge and see what has been done. If it is the work you have been doing, probably just review the upstream changes, and if you agree, keep them, if you dont agree just push changes to them |
Thanks for the advice, @AFOliveira! I'll go ahead and manually merge the changes and review the differences. If the upstream changes align with my work, I’ll keep them; if not, I’ll make the necessary adjustments. Appreciate the help! |
If in doubt, use |
804d7cb
to
d49cdeb
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.
@Shehrozkashif Can you please resolve conversations that are marked as outdated? Github won't let you merge whilst they aren't marked as resolved and when opening a PR it makes it cluttered
Folks, |
@ayosher Apologies for the delay I’ll try to complete it as soon as possible. |
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.
generally, let's move all the register names to x* (xd, xs1, xs2).
arch/inst/C/c.ld.yaml
Outdated
definedBy: | ||
anyOf: | ||
- C | ||
- Zca | ||
base: 64 | ||
- Zclsd | ||
assembly: xd, imm(xs1) | ||
encoding: | ||
match: 011-----------00 |
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.
We need separate encodings for RV32/RV64 since in RV32 xd cannot be odd.
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.
do I have to put them in seprate files ?
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.
See arch/inst/I/slli.yaml
for an example of how to specify multiple encodings in one file.
@@ -13,6 +13,7 @@ definedBy: | |||
anyOf: | |||
- C | |||
- Zca | |||
- Zclsd | |||
base: 64 | |||
assembly: xs2, imm(xs1) | |||
encoding: |
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.
separate RV32/RV64
rd, offset(sp). C.LDSP is only valid when rd≠x0; the code points with rd=x0 are reserved. | ||
definedBy: Zclsd | ||
assembly: rd, offset(sp) | ||
encoding: |
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.
separate encoding. RV32 xd == 0 or odd is reserved
offset(rs1'). | ||
definedBy: Zclsd | ||
assembly: c.sd rs2, offset(rs1) | ||
encoding: |
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.
separate encoding
`sd rs2, offset(sp)`. | ||
definedBy: Zclsd | ||
assembly: rs2, offset(sp) | ||
encoding: |
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.
separate encoding
Signed-off-by: Shehroz Kashif <[email protected]>
a84b926
to
3ba465c
Compare
4c2fad7
to
dee7a5f
Compare
arch/inst/C/c.ld.yaml
Outdated
# SPDX-License-Identifier: BSD-2-Clause | ||
if (xlen() == 32) { | ||
if (implemented?(ExtensionName::Zclsd)) { | ||
Bits<128> val = read_memory<128>(X[creg2reg(xs1)] + imm, $encoding); |
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.
The "128" here should be "64". We're loading a register pair. In RV32 mode, each register is 32 bits, so a pair would be 64 bits.
arch/inst/C/c.ld.yaml
Outdated
X[creg2reg(xd)] = val[63:0]; | ||
X[creg2reg(xd + 1)] = val[127:64]; |
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.
And these ranges should, respectively, be: 31:0
and 63:32
.
_ => report_invalid_width(__FILE__, __LINE__, width, "load") | ||
} | ||
} | ||
} | ||
} | ||
|
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 needs to be retained, at the end of the Sail code.
- name: xd | ||
location: 11-7 |
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.
add a "not" statement here, also including "0" as an invalid value.
Oh, wait. This instruction also exists at arch/inst/c.ldsp.yaml
. You need to do the same sort of merging with this instruction into that file as you did from c.ld.yaml
. Does that make sense?
This is also true for c.sdsp
.
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.
yes ill add it in both
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.
remove this file
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.
can you please explain the reason of removing it ?
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.
Because you're now defining the RV32 version of this instruction in arch/inst/C/c.sd.yaml
, so this file is redundant.
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.
Understood
arch/inst/C/c.sd.yaml
Outdated
definedBy: | ||
anyOf: | ||
- C | ||
- Zca | ||
- Zclsd | ||
base: 64 |
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.
remove this line, since it can be defined for RV32 with your changes.
arch/inst/Zclsd/c.ldsp.yaml
Outdated
if (xd == 0) { | ||
raise(ExceptionCode::IllegalInstruction, mode(), $encoding); | ||
} | ||
|
||
if (xlen() == 32 && (creg2reg(xd) % 2 != 0)) { | ||
raise(ExceptionCode::IllegalInstruction, mode(), $encoding); | ||
} |
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.
with the "not" statement in place, you don't need either of these two checks.
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.
The RV32 changes here need to be merged into arch/inst/c.sdsp.yaml
, then this file removed.
2665c03
to
4b1a4ac
Compare
This PR adds the Zclsd extension to the database. Zclsd introduces compressed load/store pair instructions for RV32 by reusing RV64-only instruction encodings, which helps improve code density and performance when leveraging a wider than XLEN memory interface. It defines 16-bit instruction encodings and utilizes the same even-odd register pairing as the Zdinx extension. Additionally, Zclsd depends on the Zilsd and Zca extensions, and it is incompatible with Zcf due to overlapping encodings
Closes #572