-
Notifications
You must be signed in to change notification settings - Fork 6
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
Fixed CSR Instruction Handlers and Use New Register Macros #65
Conversation
// TODO cnyce | ||
(void)state; | ||
(void)xlen_val; | ||
return 42949672960; |
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.
@colby-nyce FYI the value here (0xa00000000
) is setting the CSR fields that set the XLEN for user mode (uxl
) and supervisor mode (sxl
). The same value is being written to MSTATUS and SSTATUS in AtlasState::boot
.
@@ -152,6 +153,32 @@ namespace atlas | |||
} | |||
} | |||
|
|||
void AtlasState::onBindTreeLate_() | |||
{ | |||
// Write initial values to CSR registers |
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 not committed to this method of providing CSR values. Open to suggestions. I've used complex, Sparta parameters in the past, but I've found that they can be hard to read in the yaml file sometimes.
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.
Could always create an Action group that are an initialization methods. The first call of run
would run theses methods then they "move themselves out of the way" returning to normal operation.
@@ -0,0 +1,2 @@ | |||
{ |
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.
Format would be like this:
{
"mstatus": "0xa00000000",
"sstatus": "0x200000000"
}
@@ -152,6 +153,32 @@ namespace atlas | |||
} | |||
} | |||
|
|||
void AtlasState::onBindTreeLate_() | |||
{ | |||
// Write initial values to CSR registers |
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.
Could always create an Action group that are an initialization methods. The first call of run
would run theses methods then they "move themselves out of the way" returning to normal operation.
} | ||
|
||
const auto rd_val = sext(old, state->getXlen()); | ||
insn->getRd()->write(rd_val); // dmiWrite? | ||
WRITE_INT_REG(rd, csr_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.
I am wondering how rd==x0 is taken care of. I believe if rd==x0, no value is written. Is that checked in WRITE_INT_REG?
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.
Yes, it is taken care of in the macro. If reg_ident == 0
, then the write does not occur.
Set of fixes needed to get the
rv64mi-p-csr
arch test to pass.