-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
core/observers/InstructionLogger.cpp
Outdated
INSTLOG("core 0: " << (uint64_t)state->getPrivMode() /*<< " " << HEX16(state->getPc())*/ | ||
<< " " << "(" << HEX8(inst->getOpcode()) << ")"); | ||
} else { | ||
INSTLOG("core 0: " << (uint64_t)state->getPrivMode() /*<< " " << HEX16(state->getPc())*/ |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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)) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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>(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
No description provided.