riscv-software-src / riscv-unified-db

Machine-readable database of the RISC-V specification, and tools to generate various views
Other
20 stars 15 forks source link

Riscv-opcodes replacement #300

Open AFOliveira opened 6 hours ago

AFOliveira commented 6 hours ago

Is your feature request related to a problem? Please describe. We have achieved riscv-opcodes source of information in terms of opcodes and variables, but we don't have it's outputs, which are the most valuable.

Describe the solution you'd like We could create a way of generating the outputs that riscv-opcodes uses. From my experince the encoding.c is used for SPIKE and the .go is used by the Golang language.

Describe alternatives you've considered I know there is someone assigned to generating the riscv-opcodes DB, but if we could produce it's outputs, we could propose to replace it entirely and in a short timespan

AFOliveira commented 6 hours ago

cc @dhower-qc @ThinkOpenly

ThinkOpenly commented 3 hours ago

@BrianAnakPintar, did you want to talk about what you are working on here?

BrianAnakPintar commented 3 hours ago

So there are several outputs generated by riscv-opcodes. Currently I have made a script which reads the instructions yaml files from unified db and produced one of the riscv-opcodes' output. I'm currently verifying to make sure the output is the same as riscv-opcodes's outputs.

Initially we tried recreating the original riscv opcodes DB, but soon found out that most of the data doesn't particularly follow a specific format strictly and could contain a lot of "edge cases". So we tried changing our focus into generating the output files instead which seems to be an easier task as they follow a specific format.

In terms of the outputs here's what is generated by riscv-opcodes.

Once I'm done verifying the json output, I'm planning to see if we can generate encoding.out.h and the inst.go from the unified db.

dhower-qc commented 2 hours ago

IIRC, some (all?) of those files are created from a script in riscv-opcodes using instr_dict.json as input. Do I have that right? And, if so, can we just run that script from the UDB-generated instr_dict.json?

BrianAnakPintar commented 2 hours ago

Actually upon reading more at their code you seem to be correct, it looks like all the files use the instr_dict.json. It seems like we can just use the generated instr_dict.json from UDB and use their scripts to make the rest of the files.