Skip to content

Commit

Permalink
[t1rocket] skip check when spike/rtl reg write idx == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf committed Aug 14, 2024
1 parent d54cb7b commit 9864864
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
30 changes: 13 additions & 17 deletions t1rocketemu/spike_rs/src/spike_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -406,29 +406,25 @@ impl SpikeEvent {
// scalar rf
let data = state.get_reg(self.rd_idx, false);
self.is_rd_written = true;
if data != self.rd_bits {
trace!(
"ScalarRFChange: idx={}, change_from={}, change_to={data}",
self.rd_idx,
self.rd_bits
);
self.rd_bits = data;
}
self.rd_bits = data;
trace!(
"ScalarRFChange: idx={:02x}, data={:08x}",
self.rd_idx,
self.rd_bits
);
}
0b0001 => {
let data = state.get_reg(self.rd_idx, true);
self.is_rd_written = true;
if data != self.rd_bits {
trace!(
"FloatRFChange: idx={}, change_from={}, change_to={data}",
self.rd_idx,
self.rd_bits
);
self.rd_bits = data;
}
self.rd_bits = data;
trace!(
"FloatRFChange: idx={:02x}, data={:08x}",
self.rd_idx,
self.rd_bits
);
}
_ => trace!(
"UnknownRegChange, idx={}, spike detect unknown reg change",
"UnknownRegChange, idx={:02x}, spike detect unknown reg change",
state.get_reg_write_index(idx)
),
});
Expand Down
2 changes: 1 addition & 1 deletion t1rocketemu/src/TestBench.scala
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class TestBench(generator: SerializableModuleGenerator[T1RocketTile, T1RocketTil

// output the probes
// rocket reg write
when(rocketProbe.rfWen)(
when(rocketProbe.rfWen && rocketProbe.rfWaddr =/= 0.U)(
printf(
cf"""{"event":"RegWrite","idx":${rocketProbe.rfWaddr},"data":"${rocketProbe.rfWdata}%x","cycle":${simulationTime}}\n"""
)
Expand Down
2 changes: 1 addition & 1 deletion t1rocketemu/test_common/src/spike_runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl SpikeRunner {
pub fn find_reg_write(&mut self) -> SpikeEvent {
loop {
let se = self.spike_step();
if se.is_scalar() && se.is_rd_written {
if se.is_scalar() && se.is_rd_written && se.rd_idx != 0 {
return se;
}
}
Expand Down

0 comments on commit 9864864

Please sign in to comment.