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

Conflicts with shared opcodes #146

Open
kdockser opened this issue Nov 8, 2022 · 5 comments
Open

Conflicts with shared opcodes #146

kdockser opened this issue Nov 8, 2022 · 5 comments

Comments

@kdockser
Copy link

kdockser commented Nov 8, 2022

Since the P and V extensions have overlapping functionality, yet are largely suited to different application domains, they are considered mutually incompatible. This avails each extension of the other's major opcode without concern of collision.

As allowed, the proposed Vector Crypto encodings overlap with some of the proposed Packed-SIMD encodings. We are getting conflicts when we run the python script in riscv-opcodes (with crypto opcodes in our own branch):

$ make
Running with args : ['./parse.py', '-c', '-go', '-chisel', '-sverilog', '-rust', '-latex', '-spinalhdl', 'rv*', 'unratified/rv*']
Extensions selected : ['rv*', 'unratified/rv*']
ERROR:: instruction : rstsa16 from rv_p has the same encoding with instruction vsha2ms_vv added from ['rv_zvknh'] in same base extensions
make: *** [Makefile:12: everything] Error 1

Right now both of these extensions are in unratified/rv*, but eventually they will be ratified.

@neelgala We need a means to tell the script which extensions' encodings should be processed and which should be ignored when the opcodes are reused in mutually exclusive extensions.

@aswaterman
Copy link
Member

Note this isn't the only problematic case: for example, the Zcmt extension overlaps the double-precision FP instructions in the C extension.

I think the $pseudo_op designation could be used as a workaround, but I'm unsure whether this is the best solution, hence soliciting @neelgala's input.

egouriou-rivos added a commit to rivosinc/riscv-opcodes that referenced this issue Nov 22, 2022
This reverts commit c532daf because of
a limitation that blocks adding Zvk instructions (vector cryptography)
that conflict with instructions in the P (packed SIMD) extension.

Bug tracking this issue:
 riscv#146

Signed-off-by: Eric Gouriou <ego@rivosinc.com>
@neelgala
Copy link
Collaborator

So when you say "mutually-exclusive extensions" I am assuming that those extensions can never exist together in hardware. This would also mean that those extensions don't occur together in the ISA string. Please correct me if am wrong.

@kdockser the quickest solution is to modify the EXTENSIONS variable in the makefile here. You can basically list out (space separated) all the extensions you want the script to parse. Each of those entries in the list are treated as regex so it shouldn't be tough to get what you want. This should allow you to bypass the above error quickly.

The long term solution here is to use $pseudo_op (as defined in this section). One of conflicting extensions will have the entire encoding for some base instruction, while in the other extension you will do a pseudo_op of this base instructions. For pseudo_ops the encodings can remain the same. So when both these conflicting extensions occur the pseudo_op will be dropped. Based on which extension needs priority you can decided where the base instructions go.

@aswaterman
Copy link
Member

This would also mean that those extensions don't occur together in the ISA string

Yes, that's right.

@baibeta
Copy link

baibeta commented Jan 18, 2023

This would also mean that those extensions don't occur together in the ISA string

Yes, that's right.

I found several RISC-V ip cores support both P and V extensions, eg:
https://www.andestech.com/en/products-solutions/andescore-processors/riscv-nx27v/
The 64-bit NX27V... including ... “P” DSP extension instructions, “V” vector extension instructions...

https://www.nucleisys.com/product/rvipes/900/
RISC-V RV32/64 I/M/A/C/F/D/P/V ISA supported
Configurable vlength VFPU based on V-extensions
SIMD,Partial-SIMD,64-bit and Non-SIMD DSP instructions (P extension)

@aswaterman
Copy link
Member

aswaterman commented Jan 18, 2023

There's no such thing as an extension called "P" currently; there are only proposals. Vendors claiming support for "P" are claiming support for something that isn't a RISC-V standard. So it isn't really relevant.

(Note also it is possible for implementations to support conflicting extensions using a mode switch.)

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

No branches or pull requests

4 participants