Skip to content

Commit

Permalink
[difftest] fix retire order
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf authored and sequencer committed Nov 16, 2024
1 parent af03734 commit fad6029
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions difftest/offline_t1emu/src/json_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,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 fad6029

Please sign in to comment.