-
Notifications
You must be signed in to change notification settings - Fork 1
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
Incorrect SPR number on PowerPC #35
Comments
@janvrany what happens to them on RISC-V when we encode split-fields, is it the "assembly source" or the "value" that gets into these |
It in most complicated cases it is both. For example, consider J-type instruction where 20bit displacement is encoded in 4 different fields and the encoded binary value is shifted one bit right (i.e, you do not encode last bit because it is always zero). The
Here IIUC the issue in POWER can be solved by either:
That being said, there's so many issues with POWER PDL that I'm disinclined to put much effort into "fixing" it. We should (re)start thinking of sourcing POWER model from authoritative sources, like we do for RISC-V. |
Well, in practical terms (i.e. using these SPR numbers) it's not a real issue, because the ISA definition guarantees that What does feel scary to me, is that
That's the thing. It appears there is no "authoritative source" for a lot of things. Even if we were to parse the BookMaster source of the instruction encoding tables and be extremely successful at it — so we would have "the authoritative instruction encoding" — we are still left with prose explanations of assembly, such as that "Compiler and Assembler Note" in the right margin of p.385. The Sail definition of RISC-V seems no better, it's a function from a binary program to a behavior, really with no clear definiton of "instruction" as in something like |
It was never "clear", there are multiple ways how to model instructions in ArchC language and always been.
True, but in case of RISC-V those |
That's not what I am talking about. The problem is not ArchC. The problem is the Green Cloth (and whatever other "authoritative sources" we have for any number of ISAs):
Only in the limited example of instruction-encodings, but not for other aspects such as assembly. Case in point: that right margin of p.385, written in the kind of "prophetic English" which I was talking about in the Cambridge-2014 talk ("…don't step on the rake…boom!"). I would go as far as saying that the ArchC language is actually better than the Green Cloth even though it's wrong, because the Green Cloth is informal no matter how you parse it. |
Now, I am not contesting that the current quality of the POWER ArchC PDL is unusable for what we are trying to do. What I am saying is that parsing Green Cloth will not help, no matter how sophisticated parsing technology. |
On PowerPC, for compatibility with old POWER the encoding of the SPR number in
mtspr
,mfspr
is reversed, see Green Cloth p.385:This explanation, combined with the pseudocode:
and the diagram of the XFX-form on p.384, is extremely confusing.
Be it as it may, both
rs
/rt
andspr
operand modifiers in the PDL are simply%imm
and this obviously results in emitting the wrong code. The bug is especially vicious in the presence of extended mnemonics, because the speciallr
,ctr
,xer
have the reversed encoding baked in theset_asm
, e.g.LR=8
:because
00000 01000
⇔01000 00000
.The text was updated successfully, but these errors were encountered: