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
Self-Refresh Exit command handler improved. #39
Conversation
The variable "spup_ref_act_cycles" stores the number of active auto-refresh cycles during self-refresh exit. The variable "spup_ref_pre_cycles" stores the number of precharged auto-refresh cycles during self-refresh exit. tRP was counted for both "spup_ref_act_cycles" and "spup_ref_pre_cycles". This overlap was removed. Reference file for the "test_transaction_scheduler_with_self_refresh" updated accordingly.
1 similar comment
Dear Sven, Could you please help us to better understand how the variables update happen? Which clock cycle each of the variables should point after the update? Why? Thanks! |
I am mostly basing this on this state machine image I built for the book chapter: http://imgur.com/a/txM7o
This looks a bit scary in context 1, since we are then effectively setting this cycle count to a time in the past, but assuming the controller doesn't issue commands between SREN and SREX, the regular accounting should still be correct as far as I can see. |
Hi Sven, thanks for the explanation. Nice state machine. :) |
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 tried to mark approximately the suspicious code lines. As Éder proposes, we should discuss them maybe in an separate issue.
However, are you OK with removing the double counting of tRP?
// initial auto-refresh. | ||
sref_cycles_idd6 += sref_duration - memSpec.memTimingSpec.RFC; | ||
|
||
// IDD2N current is consumed when exiting the self-refresh state. | ||
if (memSpec.memArchSpec.dll == false) { | ||
spup_cycles += memSpec.memTimingSpec.XS; | ||
latest_pre_cycle = max(timestamp, timestamp + |
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.
last_pre_cycle = timestamp + spup_pre; | ||
|
||
if (memSpec.memArchSpec.dll == false) { | ||
spup_cycles += memSpec.memTimingSpec.XS - spup_pre; | ||
latest_pre_cycle = max(timestamp, timestamp + |
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.
@@ -481,18 +535,63 @@ void CommandAnalysis::evaluate(const MemorySpecification& memSpec, | |||
memSpec.memTimingSpec.XSDLL - memSpec.memTimingSpec.RCD |
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.
spup_ref_act_cycles += spup_act; | ||
spup_ref_pre_cycles += memSpec.memTimingSpec.RP; | ||
|
||
last_pre_cycle = timestamp + spup_act + memSpec.memTimingSpec.RP; | ||
if (memSpec.memArchSpec.dll == false) { | ||
spup_cycles += memSpec.memTimingSpec.XS - spup_act - |
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.
// FIXME: Here should be ((memSpec.memTimingSpec.RFC - memSpec.memTimingSpec.RP) - sref_duration) to avoid overlapping !! | ||
int64_t spup_act = memSpec.memTimingSpec.RFC - sref_duration; | ||
int64_t spup_act = (memSpec.memTimingSpec.RFC - | ||
memSpec.memTimingSpec.RP) - sref_duration; | ||
|
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.
Only this change affects the output (the value assigned to spup_act has changed). It corresponds to the second commit.
The first commit was intended to bring minor improvements to the documentation.
int64_t sref_duration = timestamp - sref_cycle; | ||
|
||
// Negative or zero duration should never happen. | ||
assert(sref_duration > 0); |
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.
We have never punished users that generate a broken command trace with a hard assert. Perhaps it is better to print a warning here? We could consider adding a flag in a future version that turns warning prints into asserts.
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.
Personally, I don't see the assertion as a punishment, but as a helper. As far I can see, people are only interested in valid traces. If this assumption holds, the assertion will ensure that the self-refresh duration is greater than zero (it may be possible that the user fixes the trace for his own benefit). The same principle applies to the second assertion inserted.
However, if you have a strong preference for warnings instead of assertions just let me know.
Other changes: - "warnings.trace" updated to explore new warning conditions during "test_broken_trace". - Error output of "TestLibDRAMPower" redirected to avoid unnecessary polution in "make test" output. - Some comments improved to use the code nomenclature: SREFEN --> SREN and SREFX --> SREX.
Hi Sven, |
Thanks for changing it. I think we should give users a chance to potentially fix their fault command traces / memory controllers before we introduce hard-exits. |
The first commit improves the code readability and adds documentation to all possible situations a SREX command may happen:
The second commit removes an overlap between "spup_ref_act_cycles" and "spup_ref_pre_cycles".
The variable "spup_ref_act_cycles" stores the number of active auto-refresh cycles during self-refresh exit.
The variable "spup_ref_pre_cycles" stores the number of precharged auto-refresh cycles during self-refresh exit.
tRP was counted for both "spup_ref_act_cycles" and "spup_ref_pre_cycles".