Open ThinkOpenly opened 5 months ago
hi i am Aryan Sharma currently learning this codebase i would like to work in this issue please assign it to me.
I have assigned you, @aryansharma6827 , but please ask questions and I'll ask that you provide occasional updates on progress. If you do feel that you will be unwilling or unable to continue, I ask that you let me know.
can you please elaborate the issue and how to proceed further.
We now emit the following in the JSON output:
"registers": [
{ "name": "mcounteren", "type": "Counteren" },
{ "name": "scounteren", "type": "Counteren" },
{ "name": "mcountinhibit", "type": "Counterin" },
{ "name": "fcsr", "type": "Fcsr" },
[...]
There is additional information (the associated register numbers for CSRs) that should be included. The information can be found in model/riscv_csr_map.sail
:
mapping clause csr_name_map = 0x306 <-> "mcounteren"
mapping clause csr_name_map = 0x106 <-> "scounteren"
mapping clause csr_name_map = 0x320 <-> "mcountinhibit"
mapping clause csr_name_map = 0x003 <-> "fcsr"
[...]
So, the resulting JSON should be enhanced to include this additional information:
"registers": [
{ "name": "mcounteren", "type": "Counteren", "number": "0x306" },
{ "name": "scounteren", "type": "Counteren", "number": "0x106" },
{ "name": "mcountinhibit", "type": "Counterin", "number": "0x320" },
{ "name": "fcsr", "type": "Fcsr", "number": "0x003" },
[...]
This additional information is encoded in a scattered mapping
as a series of mapping clause
statements. mapping clause
AST elements are handled (in src/sail_json_backend/json.ml
) in parse_mapcl
. You can see stanzas for handling "encdec" and "assembly" mapping clause
statements. The work for this issue would entail adding another stanza for "csr_name_map" clauses, storing the number as the value associated with a key which would be the register name.
The other part of the work is adding the "number" field when emitting the registers as JSON. This would entail enhancements to json_of_registers
.
I hope that helps.
Hi, I'm Abhishek Singh. I'm currently working on this issue and have identified the necessary changes. If the assignee is unable to continue, please reassign it to me.
Thanks to 7738de1a632bc0af1e9ce03c6598b1e9498c6a17, we are extracting register names and types:
Some of the "special registers" are associated with a number. In
model/riscv_csr_map.sail
:We should extract these numbers and add them to their respective register data.