Skip to content

Commit

Permalink
[difftest] set mcycle to 0 to avoid driver/offline mcycle misalign
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf authored and sequencer committed Jul 30, 2024
1 parent 0fc1375 commit 149f911
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions difftest/test_common/src/spike_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,21 +89,17 @@ impl SpikeRunner {
let proc = self.spike.get_proc();
let state = proc.get_state();

state.set_mcycle((self.cycle + self.spike_cycle) as usize);

let pc = state.get_pc();
let disasm = proc.disassemble();
let insn_bits = proc.get_insn();
let mcycle = (self.cycle + self.spike_cycle) as usize;
state.set_mcycle(0);

let mut event = SpikeEvent::new(spike, self.do_log_vrf);
state.clear();

let new_pc = if event.is_v() || event.is_exit() {
// inst is v / quit
debug!(
"SpikeStep: spike run vector insn ({}), is_vfence={}",
"SpikeStep: spike run vector insn ({}), mcycle={mcycle}",
event.describe_insn(),
event.is_vfence(),
);
event.pre_log_arch_changes(spike, self.vlen).unwrap();
let new_pc_ = proc.func();
Expand All @@ -112,8 +108,8 @@ impl SpikeRunner {
} else {
// inst is scalar
debug!(
"SpikeStep: spike run scalar insn (pc={:#x}, disasm={}, bits={:#x})",
pc, disasm, insn_bits,
"SpikeStep: spike run scalar insn ({}), mcycle={mcycle}",
event.describe_insn(),
);
let new_pc_ = proc.func();
event.log_mem_write(spike).unwrap();
Expand Down

0 comments on commit 149f911

Please sign in to comment.