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

Create registers from JSON definition #522

Closed
wants to merge 6 commits into from
Closed

Conversation

colby-nyce
Copy link
Contributor

No description provided.

"initial_value": 0,
"enabled": True}))

#Include PC, Athena expects the PC to always be 64-bits
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you delete lines 243-265? They don't need to be checked into Sparta.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done (including removing resv_valid)

}

private:
void parse(const std::string& register_defns_json_filename)
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename method to parse_.

document.Parse(json_str.c_str());

for (auto& item : document.GetArray()) {
if (item.HasMember("enabled") && !item["enabled"].GetBool()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this may break backwards compatibility. @furuame can you confirm? From the functional model's POV, I believe there is a difference between "this register is invalid" and "this register is valid but not enabled for this arch".

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I can confirm. This should be fine. We handle that scenario in JSON level. The enabled field is used to be overridden by the other arch JSON to turn that register off. The disabled register is never created.

}

RegisterBase::group_idx_type group_idx = group_idx_map_[group_num]++;
cached_strings_.emplace_back(item["group_name"].GetString());
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the group_name be optional as well since group_num is?

Choose a reason for hiding this comment

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

Not sure I understand - I am adding "group_name" and "group_num" to every register json. It was my understanding that neither would be optional.

Copy link
Contributor

@kathlenemagnus-mips kathlenemagnus-mips left a comment

Choose a reason for hiding this comment

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

LGTM. I have one concern about backwards compatibility, but I'm ok with fixing it in a later PR if necessary.

import sys
import pdb

from RV64_CSR import CSR64_DEFS
Copy link
Contributor

Choose a reason for hiding this comment

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

These libraries are missing from the PR.

"size": 8,
"aliases": alias,
"fields": fields,
"initial_value": 0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this need to be changed to "x0"?

Choose a reason for hiding this comment

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

In the __CreateRegDict method, I remove the "initial_value" key from the dict if it is zero, else convert to hex.

"size": 8,
"aliases": ["csr"+str(k)],
"fields": v[2],
"initial_value": v[3],
Copy link
Contributor

Choose a reason for hiding this comment

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

Same concern as above, need to make sure the initial values are hex strings.

@colby-nyce colby-nyce closed this Sep 13, 2024
@colby-nyce colby-nyce deleted the register_json branch September 13, 2024 18:13
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.

4 participants