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

Add unratified Zcmop extension #1468

Closed
wants to merge 1 commit into from

Conversation

ved-rivos
Copy link
Contributor

Copy link
Collaborator

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

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

LGTM, but we'll wait until #1467 is merged.

@ved-rivos
Copy link
Contributor Author

@aswaterman Updated with new mnemonic

@aswaterman
Copy link
Collaborator

Code looks fine; can you clean up the PR so it passes regression tests?

@ved-rivos
Copy link
Contributor Author

ved-rivos commented Oct 17, 2023

@aswaterman Do you have a suggestion on how to fix this overlap test?

./check-opcode-overlap-utst default
Instruction c_mop_N (6081) overlaps instruction c_lui (6001, mask e003)
make: *** [Makefile:347: check-opcode-overlap-utst.out] Error 255
Error: Process completed with exit code 2.

@ved-rivos
Copy link
Contributor Author

Updated the overlap list and the test passes locally. Hopefully the regressions should succeed now.

@aswaterman
Copy link
Collaborator

Turns out that the overlap error is actually entirely legitimate: the Zcmop instructions will never be executed as written because they decode to C.LUI. In particular:

$ cat test.c
int main()
{
  asm volatile (".half 0x6681");
  return 0;
}
$ riscv64-unknown-elf-gcc -O2 test.c
$ ./spike --isa=rv64gc_zcmop pk ./a.out
bbl loader
z  0000000000000000 ra 0000000000010104 sp 0000003ffffffb50 gp 0000000000011c48
tp 0000000000000000 t0 00000000000100e0 t1 000000000000000f t2 0000000000000000
s0 0000000000000000 s1 0000000000000000 a0 0000000000000001 a1 0000003ffffffb58
a2 0000000000000000 a3 0000000000000010 a4 0000000000000001 a5 0000000000000000
a6 000000000000001f a7 0000000000000000 s2 0000000000000000 s3 0000000000000000
s4 0000000000000000 s5 0000000000000000 s6 0000000000000000 s7 0000000000000000
s8 0000000000000000 s9 0000000000000000 sA 0000000000000000 sB 0000000000000000
t3 0000000000000000 t4 0000000000000000 t5 0000000000000000 t6 0000000000000000
pc 00000000000100b0 va/inst 0000000000006681 sr 8000000200006020
An illegal instruction was executed!

After my fix:

$ ./spike --isa=rv64gc_zcmop pk ./a.out
bbl loader
Spike executed c.mop.13

So, I'll approve the PR and manually merge my altered version.

Note, @ved-rivos, Zimop shouldn't have this hiccup, since it doesn't overlap an existing encoding.

@ved-rivos
Copy link
Contributor Author

So, I'll approve the PR and manually merge my altered version.

@aswaterman - I am missing the change - the only commit I see is a new line in riscv/decode.h.

@aswaterman
Copy link
Collaborator

Whoops. Editing error.

@aswaterman
Copy link
Collaborator

@ved-rivos see #1486

@ved-rivos
Copy link
Contributor Author

@aswaterman got it !

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.

2 participants