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

CSR/Exception unit #38

Closed
wants to merge 8 commits into from
Closed

Conversation

colby-nyce
Copy link
Collaborator

No description provided.

INSTLOG("core 0: " << (uint64_t)state->getPrivMode() /*<< " " << HEX16(state->getPc())*/
<< " " << "(" << HEX8(inst->getOpcode()) << ")");
} else {
INSTLOG("core 0: " << (uint64_t)state->getPrivMode() /*<< " " << HEX16(state->getPc())*/
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this was probably added for CSR debug. Can it be removed since we already print the RD register values and previous values on line 110? We can keep the privilege mode print, but it doesn't need an if-statement.

@@ -128,4 +137,11 @@ namespace atlas

return nullptr;
}

uint64_t AtlasState::getMStatusInitialValue(const AtlasState* state, const uint64_t xlen_val)
Copy link
Contributor

Choose a reason for hiding this comment

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

This is fine for now, but we should do this type of initialization at the simulation level with a command line option like this:

--reg-init-val mstatus 42949672960

@@ -48,6 +49,11 @@ namespace atlas
fetch_unit_ = getContainer()->getChild("fetch")->getResourceAs<Fetch*>();
execute_unit_ = getContainer()->getChild("execute")->getResourceAs<Execute*>();
translate_unit_ = getContainer()->getChild("translate")->getResourceAs<Translate*>();
if (auto exc = getContainer()->getChild("exception", false)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming you added this because the regression tests were failing. Please add a FIXME comment for us to update the tests later.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

(void)state;
}

void Exception::handleMModeException_(atlas::AtlasState* state)
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks great! I think you'll find that these methods can be combined into a templated method, but this is good for now. Just add asserts to handleSModeException_ and handleUModeException_ to make sure Atlas fails if they get called.

const AtlasInstPtr & insn = state->getCurrentInst();

const auto & rs1 = insn->getRs1();
const auto rs1_val = rs1->dmiRead<uint64_t>();
Copy link
Collaborator

@lzhu-pub lzhu-pub Jan 9, 2025

Choose a reason for hiding this comment

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

I only use dmiRead for memory accesses. Need some guideline here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I know we mentioned adding some macro like READ_RS1 but other than making the code easier to read, it doesn't have a lot of benefits. I can change all the code to use macros later.

core/Exception.cpp Outdated Show resolved Hide resolved
@colby-nyce colby-nyce closed this Jan 13, 2025
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.

5 participants