Skip to content

Commit

Permalink
Add a constant for number of cycles for QC-testing
Browse files Browse the repository at this point in the history
This can be used to compare what happens when given more than one cycle
to consume.
  • Loading branch information
marhel committed Apr 19, 2016
1 parent 799bb1f commit 3bde099
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/musashi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,11 @@ pub fn musashi_written_bytes() -> u16 {
musashi_locations_used as u16
}
}
const EXEC_CYCLES: i32 = 1; // configurable for testing purposes
pub fn execute1(core: &mut Core) -> Cycles {
// println!("execute1 mushashi {:?}", thread::current());
unsafe {
let cycle_count = m68k_execute(1);
let cycle_count = m68k_execute(EXEC_CYCLES);

for (i, &reg) in REGS.iter().enumerate() {
core.dar[i] = m68k_get_reg(ptr::null_mut(), reg);
Expand Down Expand Up @@ -514,7 +515,7 @@ mod tests {
let _mutex = MUSASHI_LOCK.lock().unwrap();

let musashi_cycles = reset_and_execute1(&mut musashi, memory_initializer & mem_mask);
let r68k_cycles = r68k.execute1();
let r68k_cycles = r68k.execute(super::EXEC_CYCLES);
// panics if differences are found. Returns false if an
// exception occurred, and then we cannot compare state further
let res = memory_accesses_equal_unless_exception(&r68k);
Expand Down

0 comments on commit 3bde099

Please sign in to comment.