Skip to content

Commit

Permalink
[dut] remove unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
Clo91eaf committed May 10, 2024
1 parent d1fae68 commit d240173
Showing 1 changed file with 3 additions and 17 deletions.
20 changes: 3 additions & 17 deletions src/dut.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ impl SramRequest {
// sram interface
pub struct Dut {
pub top: Top,
clock: bool,
reset: bool,
pub ticks: u64,
pub prepare_for_difftest: bool,
pub inst: u32,
Expand All @@ -36,8 +34,6 @@ impl Dut {

Dut {
top,
clock: false,
reset: false,
ticks: 0,
prepare_for_difftest: false,
inst: 0,
Expand All @@ -46,16 +42,6 @@ impl Dut {
}
}

fn clock_toggle(&mut self) {
self.clock = !self.clock;
self.top.clock_toggle();
}

fn reset_toggle(&mut self) {
self.reset = !self.reset;
self.top.reset_toggle();
}

fn trace(&mut self, ticks: u64) {
if self.trace {
self.top.trace_at(Duration::from_nanos(ticks));
Expand All @@ -65,12 +51,12 @@ impl Dut {
/// drive the instruction SRAM interface
pub fn step(&mut self, inst: u32, data: u64) -> anyhow::Result<(SramRequest, SramRequest, DebugInfo)> {
match self.ticks {
0 | 2 => self.reset_toggle(),
0 | 2 => self.top.reset_toggle(),
_ => {}
}

// a little trick: there must be 2 state transitions after clock posedge
self.clock_toggle();
self.top.clock_toggle();
self.top.eval();
if self.ticks >= 2 {
self.top.set_inst_sram_rdata(inst);
Expand All @@ -79,7 +65,7 @@ impl Dut {
}
self.trace(self.ticks * 2);

self.clock_toggle();
self.top.clock_toggle();
self.top.eval();
self.trace(self.ticks * 2 + 1);

Expand Down

0 comments on commit d240173

Please sign in to comment.