Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mips-lib/src/components/mips_reg_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ impl Component for RegFile {
Ok(())
}

fn un_clock(&self) {
fn un_clock(&self, _: &Simulator) {
if let Some(last_op) = self.history.borrow_mut().pop() {
let mut regs = self.registers.borrow_mut();
if regs[last_op.addr as usize] != last_op.data {
Expand Down
4 changes: 2 additions & 2 deletions mips-lib/src/components/physical_mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::{
path::PathBuf,
};
use syncrim::{
common::{Component, Ports},
common::{Component, Ports, Simulator},
signal::Id,
};

Expand Down Expand Up @@ -60,7 +60,7 @@ impl Component for PhysicalMem {
self
}

fn un_clock(&self) {
fn un_clock(&self, _: &Simulator) {
*self.cycle.borrow_mut() -= 1;
if let Some(op) = self.history.borrow_mut().remove(&*self.cycle.borrow()) {
self.mem.borrow_mut().revert(op);
Expand Down
2 changes: 1 addition & 1 deletion riscv/src/components/clic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ impl Component for CLIC {
Ok(())
}

fn un_clock(&self) {
fn un_clock(&self, _: &Simulator) {
// TODO: Add super-clic stack ops
let mut entry = self.history.borrow_mut().pop().unwrap();
if let Some(mut ops) = entry.csr_op {
Expand Down
2 changes: 1 addition & 1 deletion riscv/src/components/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ impl Component for RVMem {
Ok(())
}

fn un_clock(&self) {
fn un_clock(&self, _: &Simulator) {
let entry = self.history.borrow_mut().pop().unwrap();
if let Some(d) = entry.data {
self.memory.write(
Expand Down
2 changes: 1 addition & 1 deletion riscv/src/components/reg_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ impl Component for RegFile {
Ok(())
}

fn un_clock(&self) {
fn un_clock(&self, _: &Simulator) {
//println!("unclock");
let regop = self.history.0.borrow_mut().pop().unwrap();
let mut regstore = self.registers.borrow_mut();
Expand Down
2 changes: 1 addition & 1 deletion src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ pub trait Component {
Ok(())
}
/// update component internal state
fn un_clock(&self) {}
fn un_clock(&self, _simulator: &Simulator) {}
/// reset component internal state to initial value
fn reset(&self) {}

Expand Down
2 changes: 1 addition & 1 deletion src/components/probe_edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl Component for ProbeEdit {
}

// reverse simulation, notice does not touch simulator state, its just internal
fn un_clock(&self) {
fn un_clock(&self, _: &Simulator) {
let mut edit_history = self.edit_history.write().unwrap();
trace!("{} history {:?}", self.id, edit_history);
let _next = edit_history.pop().unwrap(); // pop the next editable value
Expand Down
7 changes: 4 additions & 3 deletions src/simulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@
{
if ordered_components
.iter()
.find(|node| node.get_id_ports().0 == seq_node_inputs.id)
.is_some()

Check warning on line 152 in src/simulator.rs

View workflow job for this annotation

GitHub Actions / build (x86_64-unknown-linux-musl)

called `is_some()` after searching an `Iterator` with `find`

warning: called `is_some()` after searching an `Iterator` with `find` --> src/simulator.rs:151:22 | 151 | .find(|node| node.get_id_ports().0 == seq_node_inputs.id) | ______________________^ 152 | | .is_some() | |______________________________^ help: consider using: `any(|node| node.get_id_ports().0 == seq_node_inputs.id)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some = note: `#[warn(clippy::search_is_some)]` on by default

Check warning on line 152 in src/simulator.rs

View workflow job for this annotation

GitHub Actions / build (x86_64-pc-windows-gnu)

called `is_some()` after searching an `Iterator` with `find`

warning: called `is_some()` after searching an `Iterator` with `find` --> src/simulator.rs:151:22 | 151 | .find(|node| node.get_id_ports().0 == seq_node_inputs.id) | ______________________^ 152 | | .is_some() | |______________________________^ help: consider using: `any(|node| node.get_id_ports().0 == seq_node_inputs.id)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some = note: `#[warn(clippy::search_is_some)]` on by default

Check warning on line 152 in src/simulator.rs

View workflow job for this annotation

GitHub Actions / build (x86_64-apple-darwin)

called `is_some()` after searching an `Iterator` with `find`

warning: called `is_some()` after searching an `Iterator` with `find` --> src/simulator.rs:151:22 | 151 | .find(|node| node.get_id_ports().0 == seq_node_inputs.id) | ______________________^ 152 | | .is_some() | |______________________________^ help: consider using: `any(|node| node.get_id_ports().0 == seq_node_inputs.id)` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#search_is_some = note: `#[warn(clippy::search_is_some)]` on by default
{
panic!("Component {} read data from {}. Sequential to sequential is not allowed, consider adding a pass trough component", seq_node.get_id_ports().0, seq_node_inputs.id)
}
Expand Down Expand Up @@ -197,7 +197,7 @@
};

trace!("sim_state {:?}", simulator.sim_state);
simulator.clock();
simulator.reset();
Ok(simulator)
}

Expand Down Expand Up @@ -473,8 +473,9 @@
_ => self.running_state = RunningState::Stopped,
};

for component in self.ordered_components.clone() {
component.un_clock();
// reverse eval order before uncloak
for component in self.ordered_components.clone().into_iter().rev() {
component.un_clock(self);
}
}
}
Expand Down
Loading