Skip to content

Commit

Permalink
[difftest] use reverse order during issue retire
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf committed Oct 17, 2024
1 parent dd7e1e5 commit 685dfe0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
8 changes: 4 additions & 4 deletions difftest/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 11 additions & 2 deletions difftest/offline_t1rocketemu/src/json_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,8 +556,17 @@ impl JsonEventRunner for SpikeRunner {
}

fn retire(&mut self, cycle: u64, issue_idx: u8) -> anyhow::Result<()> {
if let Some(idx) = self.commit_queue.iter().position(|se| se.issue_idx == issue_idx) {
if let Some(se) = self.commit_queue.remove(idx) {
self.commit_queue.clone().into_iter().for_each(|se| {
debug!(
"[{cycle}] Retire: there is se with issue_idx={} ({}) in commit queue now",
se.issue_idx,
se.describe_insn()
);
});

if let Some(idx) = self.commit_queue.iter().rev().position(|se| se.issue_idx == issue_idx) {
// use (len - 1 - idx) to get the real idx, a little tricky
if let Some(se) = self.commit_queue.remove(self.commit_queue.len() - 1 - idx) {
info!(
"[{cycle}] Retire: retire se with issue_idx={issue_idx}, ({})",
se.describe_insn()
Expand Down

0 comments on commit 685dfe0

Please sign in to comment.