diff --git a/src/dut.rs b/src/dut.rs index fad6a0e..c1cb4ca 100644 --- a/src/dut.rs +++ b/src/dut.rs @@ -1,6 +1,6 @@ mod top; -use top::Top; use crate::emulator::DebugInfo; +use top::Top; use tracing::info; pub struct SramRequest { @@ -64,29 +64,25 @@ impl Dut { self.clocks += 1; - info!("=============================="); - info!("clocks: {}", self.clocks); - info!("debug_commit: {}", self.top.debug_commit()); - info!("debug_pc: 0x{:x}", self.top.debug_pc()); - info!("debug_reg_wnum: {}", self.top.debug_reg_wnum()); - info!("debug_wdata: 0x{:x}", self.top.debug_wdata()); + info!( + "[dut] clocks: {} commit: {} pc: {:#010x} wnum: {} wdata: {:#018x}", + self.clocks, + self.top.debug_commit(), + self.top.debug_pc(), + self.top.debug_reg_wnum(), + self.top.debug_wdata() + ); Ok({ ( - SramRequest::new( - self.top.inst_sram_en() != 0, - self.top.inst_sram_addr(), - ), - SramRequest::new( - self.top.data_sram_en() != 0, - self.top.data_sram_addr(), - ), + SramRequest::new(self.top.inst_sram_en() != 0, self.top.inst_sram_addr()), + SramRequest::new(self.top.data_sram_en() != 0, self.top.data_sram_addr()), DebugInfo::new( self.top.debug_commit() != 0, self.top.debug_pc(), self.top.debug_reg_wnum(), self.top.debug_wdata(), - ) + ), ) }) } diff --git a/src/emulator.rs b/src/emulator.rs index 5e9fc7d..7e5277a 100644 --- a/src/emulator.rs +++ b/src/emulator.rs @@ -143,11 +143,11 @@ impl Emulator { loop { let pc = self.cpu.pc; let trap = self.execute(); - info!("pc: {:#x}, inst: {}", pc, self.cpu.inst); + info!("[cpu] pc: {:#x}, inst: {}", pc, self.cpu.inst); match trap { Trap::Fatal => { - info!("pc: {:#x}, trap {:#?}", self.cpu.pc, trap); + info!("[cpu] pc: {:#x}, trap {:#?}", self.cpu.pc, trap); return; } _ => {}