Skip to content

Commit

Permalink
Sayma: mem test - make buffer bigger and test random addressing.
Browse files Browse the repository at this point in the history
  • Loading branch information
hartytp committed Jun 22, 2018
1 parent 3c421ba commit 62be7a6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions artiq/firmware/runtime/main.rs
Expand Up @@ -63,7 +63,7 @@ const SYSREF_PHASE_DAC: u16 = 31;

fn memory_test() {
// const MEMORY: *mut u32 = board_mem::MAIN_RAM_BASE as *mut u32;
let mut memory: [u32; 0x1000] = [0; 0x1000];
let mut memory: [u32; 0x10000] = [0; 0x10000];

*total = 0;
*wrong = 0;
Expand Down Expand Up @@ -94,20 +94,20 @@ fn memory_test() {
}

fn prng32(seed: &mut u32) -> u32 { *seed = 1664525 * *seed + 1013904223; *seed }
//fn prng16(seed: &mut u16) -> u16 { *seed = 25173 * *seed + 13849; *seed }
fn prng16(seed: &mut u16) -> u16 { *seed = 25173 * *seed + 13849; *seed }

for _ in 0..4 {
// Test data bus
test!((); for i in (0..0x1000) { memory[i] = 0xAAAAAAAA });
test!((); for i in (0..0x1000) { memory[i] = 0x55555555 });
test!((); for i in (0..0x10000) { memory[i] = 0xAAAAAAAA });
test!((); for i in (0..0x10000) { memory[i] = 0x55555555 });

// Test counter addressing with random data
test!(let mut seed = 0;
for i in (0..0x1000) { memory[i] = prng32(&mut seed) });
for i in (0..0x10000) { memory[i] = prng32(&mut seed) });

// Test random addressing with counter data
// test!(let mut seed = 0;
// for i in (0..0x10000) { MEMORY[prng16(&mut seed)] = i });
test!(let mut seed = 0;
for i in (0..0x10000) { MEMORY[prng16(&mut seed)] = i });
}
*wrong == 0;
info!("Memory test: {} errors out of {}", wrong, total);
Expand Down

0 comments on commit 62be7a6

Please sign in to comment.